prompt
stringlengths
71
4.65k
completion
stringlengths
34
5.1k
Construct a Ludii game based on the following description Played on an 8x8 board with pieces with specialized moves: Pawns (8): can move one space forward or two on their first turn, capture diagonally one space forward; Rooks (2): can move any number of spaces orthogonally; Bishops (2): can move any number of spaces diagonally; Knight (2): moves in any direction, one space orthogonally with one space forward diagonally; Queens (1): can move any number of spaces orthogonally or diagonally; Kings (1): can move one space orthogonally or diagonally. Players move three pieces on their first turn. Players capture pieces by moving onto a space occupied by an opponent's piece. When a king can be captured on the next turn, it is in check, and the king must not be in check at the beginning of the opponent's next turn. If this is not possible, it is checkmate, and the opponent wins. ###
(define "CaptureForwardDiagonal" (move Step (directions {FR FL}) (to if:("IsEnemyAt" (to)) (apply (remove (to)))))) (define "KingNotCheckedAndToEmpty" (and (is Empty (to)) (not ("IsInCheck" "King" Mover at:(to))))) (define "CaptureToPiece" (apply (if ("IsEnemyAt" (to)) (remove (to))))) (define "RememberPieceHasMoved" (then (if (= (state at:(last To)) 1) ("PieceHasMoved" (last To))))) (define "PieceHasMoved" (set State at:#1 0)) (define "HasNeverMoved" (= (state at:(mapEntry #1 (mover))) 1)) (define "NextCanNotMove" (not (can Move (do (forEach Piece Next) ifAfterwards:(not ("IsInCheck" "King" Next)))))) (game "Shatera" ("TwoPlayersNorthSouth") (equipment { (board (square 8)) (piece "Pawn" Each (or { (if (is In (from) (sites Start (piece (what at:(from))))) ("DoubleStepForwardToEmpty")) "StepForwardToEmpty" "CaptureForwardDiagonal"})) (piece "Rook" Each (move Slide Orthogonal (to if:("IsEnemyAt" (to)) "CaptureToPiece"))) (piece "King" Each (move Step (to if:(not ("IsFriendAt" (to))) "CaptureToPiece"))) (piece "Bishop" Each (move Slide Diagonal (to if:("IsEnemyAt" (to)) "CaptureToPiece"))) (piece "Knight" Each (move Leap "KnightWalk" (to if:(not ("IsFriendAt" (to))) "CaptureToPiece"))) (piece "Queen" Each (move Slide (to if:("IsEnemyAt" (to)) "CaptureToPiece"))) (regions "Promotion" P1 (sites Top)) (regions "Promotion" P2 (sites Bottom))}) (rules (start { (place "Pawn1" (sites Row 1)) (place "Pawn2" (sites Row 6)) (place "Rook1" {"A1" "H1"}) (place "Knight1" {"B1" "G1"}) (place "Bishop1" {"C1" "F1"}) (place "Queen1" coord:"D1") (place "King1" coord:"E1") (place "Rook2" {"A8" "H8"}) (place "Knight2" {"B8" "G8"}) (place "Bishop2" {"C8" "F8"}) (place "Queen2" coord:"D8") (place "King2" coord:"E8")}) phases:{ (phase "Opening" (play (do (forEach Piece) ifAfterwards:(not ("IsInCheck" "King" Mover)) (then (and (set Value Mover (+ 1 (value Player Mover))) (if (!= (value Player Mover) 1) (moveAgain)))))) (nextPhase Mover (= 2 (value Player Mover)) "Playing")) (phase "Playing" (play (if "SameTurn" (move Promote (last To) (piece {"Queen" "Knight" "Bishop" "Rook"}) Mover) (do (forEach Piece) ifAfterwards:(not ("IsInCheck" "King" Mover))))))} (end (if (and ("IsInCheck" "King" Next) ("NextCanNotMove")) (result Mover Win))))) END
Describe the mechanics of the following Ludii game (define "PiecesOwnedBy" (+ (count Cell at:(handSite #1)) (count in:(sites #1)))) (define "Sow" (move Select (from (sites Mover #1) if:(> (count at:(from)) 1)) (then (sow #2 if:(and (is In (to) (sites Next "Home")) (or (= (count at:(to)) 2) (= (count at:(to)) 4))) apply:(fromTo (from (to)) (to (handSite Mover)) count:(count at:(to))) backtracking:True)))) (game "Um el-Bagara" (players 2) (equipment { (mancalaBoard 2 5 store:None { (track "TrackCCW" "0,E,N,W" loop:True) (track "TrackCW" "4,W,N,E" loop:True)}) (regions "Home1" P1 (sites Bottom)) (regions "Home2" P2 (sites Top)) (regions "Left1" P1 (sites {0..2})) (regions "Left2" P2 (sites {9..7})) (regions "Right1" P1 (sites {2..4})) (regions "Right2" P2 (sites {7..5})) (piece "Seed" Shared) (hand Each)}) (rules (start (set Count 5 to:(sites Track))) (play (or ("Sow" "Left" "TrackCW") ("Sow" "Right" "TrackCCW"))) (end ("MancalaByScoreWhen" (all Passed))))) ###
2x5 board. Play begins with five counters in each hole. Players sow from any one of their holes. Sowing can occur in the following directions: From the leftmost two holes: clockwise. From the rightmost two holes: anti-clockwise. from the center hole: the player may choose either direction. If the final counter falls into a hole in the opponent's row containing either one or three counters, making it now contain two or four, these are taken. If the holes before them also contain two or four, in an unbroken sequence, they may all be captured. Single counters cannot be sown. When neither player can move, the single counters in each player's rows are taken by the player belonging to those rows. The player with the most counters wins. END
Construct a Ludii game based on the following description 10x10 board. Twenty pieces per player, arrayed on the dark-colored spaces. The square in the left-hand corner closest to the player is a dark square. Pieces move one space forward diagonally. When a piece arrives at the furthest rank opposite their starting position, it becomes a king. Kings may move diagonally, forward or backward, any number of spaces (like a bishop in Chess). Captures are made by hopping over an adjacent piece in a diagonal or orthogonal direction, including backwards. Multiple captures are allowed, in which the player may change direction. Kings capture by flying leap. Captures are mandatory, and the maximum capture should be made based on the value of pieces. Kings are worth less than twice the number of regular pieces, but more than twice the number of pieces minus one. (e.g., three kings are worth less than six pieces, but more than five pieces). If more than one maximum capture has the same value, the one that captures more kings takes precedence. It is permitted to use the same space more than once, but not to hop over the same piece twice. Captured pieces are removed after the turn is complete. The maximum capture can be enforced when the opponent catches it, though the opponent may opt not to point it out. A king cannot make three non-capturing moves in a row without moving another king or piece. This rule does not apply if the player only has one king remaining. If one player has only two kings remaining and the opponent has only one king remaining, the player with two kings must win in seven turns. If they do not, the game is a draw. If both players have only one king remaining and neither of them is able to capture or will be forced into a position where their king will be captured on the next turn, the game is a draw. The player who captures all of their opponent's pieces wins, or if they cannot make a legal move. Standard Frisian draughts ###
(define "TwoKingsMoverOneKingEnemy" (and { ("IsOffBoard" (where "Counter" P1)) ("IsOffBoard" (where "Counter" P2)) (= 1 (count Pieces Next)) (= 2 (count Pieces Mover))})) (define "CounterSimpleMove" ("StepToEmpty" (directions {FR FL}))) (define "HopFrisianSequenceCaptureAgain" (do (move Hop (from (last To)) All (between #1 #2 if:(and (not (is In (between) (sites ToClear))) ("IsEnemyAt" (between))) (apply (remove (between) #3))) (to if:(is Empty (to))) (then (and (if (can Move (do (hop (from (last To)) All (between #1 #2 if:(and (not (is In (between) (sites ToClear))) ("IsEnemyAt" (between)))) (to if:(is Empty (to)))) ifAfterwards:(is In (last To) (sites Phase 0)))) (moveAgain)) (forEach Site (sites Occupied by:Mover) (if (!= 0 (state at:(site))) (set State at:(site) 0)))))) ifAfterwards:(is In (last To) (sites Phase 0)))) (define "HopFrisianSequenceCapture" (do (move Hop All (between #1 #2 if:("IsEnemyAt" (between)) (apply (remove (between) #3))) (to if:(is Empty (to))) (then (and (if (can Move (do (hop (from (last To)) All (between #1 #2 if:(and (not (is In (between) (sites ToClear))) ("IsEnemyAt" (between)))) (to if:(is Empty (to)))) ifAfterwards:(is In (last To) (sites Phase 0)))) (moveAgain)) (forEach Site (sites Occupied by:Mover) (if (!= 0 (state at:(site))) (set State at:(site) 0)))))) ifAfterwards:(is In (last To) (sites Phase 0)))) (define "IsUnpromoted" ("IsPieceAt" "Counter" Mover (last To))) (define "HopCounter" (or (do (move Hop (from #1) Orthogonal (between before:1 after:1 if:(and (not (is In (between) (sites ToClear))) ("IsEnemyAt" (between))) (apply (remove (between) at:EndOfTurn))) (to if:(is Empty (to))) #2) ifAfterwards:(is In (last To) (sites Phase 0))) ("HopInternationalDraughtsStyle" (from #1) #2))) (game "Frisian Draughts" (players 2) (equipment { (board (square 10)) (piece "Counter" P1 N) (piece "Counter" P2 S) (piece "DoubleCounter" Each maxState:128) (regions P1 (sites Bottom)) (regions P2 (sites Top))}) (rules (start { (place "Counter1" (difference (expand (sites Bottom) steps: (- 4 1)) (sites Phase 1)) value:10) (place "Counter2" (difference (expand (sites Top) steps: (- 4 1)) (sites Phase 1)) value:10)}) (play (if "SameTurn" (if "IsUnpromoted" (max Moves withValue:True ("HopCounter" (last To) (then (and ("ReplayIfCanMove" ("HopCounter" (last To)) ("PromoteIfReach" (sites Next) "DoubleCounter" (then (set Value at:(last To) 19)))) (forEach Site (sites Occupied by:Mover) (if (!= 0 (state at:(site))) (set State at:(site) 0))))))) (max Moves withValue:True ("HopFrisianSequenceCaptureAgain" before:(count Rows) after:(count Rows) at:EndOfTurn))) (priority { (max Moves withValue:True (or { (forEach Piece "DoubleCounter" ("HopFrisianSequenceCapture" before:(count Rows) after:(count Rows) at:EndOfTurn)) (forEach Piece "Counter" ("HopCounter" (from) (then (and ("ReplayIfCanMove" ("HopCounter" (last To)) ("PromoteIfReach" (sites Next) "DoubleCounter" (then (set Value at:(last To) 19)))) (forEach Site (sites Occupied by:Mover) (if (!= 0 (state at:(site))) (set State at:(site) 0)))))))})) (or (forEach Piece "Counter" ("CounterSimpleMove") (then (and ("PromoteIfReach" (sites Next) "DoubleCounter" (then (set Value at:(last To) 19))) (forEach Site (sites Occupied by:Mover) (if (!= 0 (state at:(site))) (set State at:(site) 0)))))) (forEach Piece "DoubleCounter" (if (if (> 2 (state at:(from))) True (not (can Move (forEach Piece "Counter" ("CounterSimpleMove"))))) (move Slide Diagonal)) (then (if ("IsNotOffBoard" (where "Counter" Mover)) (and (set State at:(last To) (+ 1 (state at:(last To)))) (forEach Site (sites Occupied by:Mover) (if (and (!= (site) (last To)) (!= 0 (state at:(site)))) (set State at:(site) 0))))))))}) (then (and (if (and ("TwoKingsMoverOneKingEnemy") (= Undefined (value Player Mover))) (set Value Mover 0)) (if (and ("NewTurn") (!= Undefined (value Player Mover))) (set Value Mover (+ 1 (value Player Mover)))))))) (end { ("BlockWin") (if (= 7 (value Player Mover)) (result Mover Draw))}))) END
Modify the Ludii game according to the following option changes: Played on a size 3 board. -> Played on a size 4 board. (game "Tabu Y" (players 2) (equipment { (board (hex Triangle 3)) (piece "Disc")}) (rules (play (move Add (to (sites Empty) if:(not (is In (to) (sites Around (last To))))))) (end (if (is Connected 3 Sides) (result Mover Win))))) ###
(game "Tabu Y" (players 2) (equipment { (board (hex Triangle 4)) (piece "Disc")}) (rules (play (move Add (to (sites Empty) if:(not (is In (to) (sites Around (last To))))))) (end (if (is Connected 3 Sides) (result Mover Win))))) END
Construct a Ludii game based on the following description 9x9 intersecting lines, with diagonals in each 3x3 square. Two triangles on opposite sides, the apices of which intersect the central point on that side of the square. A line from the apex bisects the base, and this line is bisected with another line which intersects with the other two sides of the triangle. Forty pieces per player, which start on the four rows closest to the player, and on half of the central row. The central space remains empty. Players alternate turns moving a piece to an empty adjacent spot along the lines. Pieces may capture the adjacent piece of an opponent by hopping over it to an empty space directly behind it in a straight line. Multiple hops can be made in one turn if possible, with direction changes allowed. The player who captures all of their opponent's pieces wins. ###
(define "BoardSize" 9) (game "Satoel" (players 2) (equipment { (board (merge { (square "BoardSize" diagonals:Alternating) (shift 2 8 (rotate 180 (wedge 3))) (shift 2 -2 (wedge 3))}) use:Vertex) (piece "Marker" Each (or ("HopSequenceCapture") ("StepToEmpty")))}) (rules (start { (place "Marker1" (forEach (sites Board) if:(< (site) (centrePoint)))) (place "Marker2" (forEach (sites Board) if:(and (> (site) (centrePoint)) (< (site) (* "BoardSize" "BoardSize")))))}) (play (if "SameTurn" (or ("HopSequenceCaptureAgain") (move Pass)) (forEach Piece))) (end ("CaptureAll" Next)))) END
Describe the mechanics of the following Ludii game (define "Dim" 16) (define "HopSequence" ("Hop" #1 (then (if (can Move ("Hop" (last To))) (moveAgain))))) (define "Hop" (move Hop (from #1) (between if:(is Occupied (between))) (to if:(and ("IsEmptyAndNotVisited" (to)) (or (not ("FromIsOnTheRegionToFill" #1)) ("ToIsOnTheRegionToFill" (to))))) #2)) (define "ToIsOnTheRegionToFill" (is In #1 (sites (player (mapEntry (mover)))))) (define "FromIsOnTheRegionToFill" (is In #1 (sites (player (mapEntry (mover)))))) (game "Halma" (players 2) (equipment { (board (square ("Dim"))) (piece "Counter" Each) (regions "Home" P1 (difference (expand (intersection (sites Bottom) (sites Right)) steps:(+ 1 (/ ("Dim") 4)) Orthogonal) (sites { (ahead (coord row:0 column:(- ("Dim") 1)) steps:(+ 1 (/ ("Dim") 4)) N) (ahead (coord row:0 column:(- ("Dim") 1)) steps:(+ 1 (/ ("Dim") 4)) W)}))) (regions "Home" P2 (difference (expand (intersection (sites Top) (sites Left)) steps:(+ 1 (/ ("Dim") 4)) Orthogonal) (sites { (ahead (coord row:(- ("Dim") 1) column:0) steps:(+ 1 (/ ("Dim") 4)) E) (ahead (coord row:(- ("Dim") 1) column:0) steps:(+ 1 (/ ("Dim") 4)) S)}))) (map {(pair P1 P2) (pair P2 P1)})}) (rules (start { (place "Counter1" (sites P1)) (place "Counter2" (sites P2))}) phases:{ (phase "Movement" (play (forEach Piece (or ("HopSequence" (from)) (move Step (to if:(and (is Empty (to)) (or (not ("FromIsOnTheRegionToFill" (from))) ("ToIsOnTheRegionToFill" (to))))))))) (nextPhase (is Mover (next)) "MultiJump")) (phase "MultiJump" (play (or ("HopSequence" (last To)) (move Pass))) (nextPhase (not (is Mover (next))) "Movement"))} (end ("FillWin" (sites (player (mapEntry (mover)))))))) ###
Played on a 16x16 checkered board. Can be played with two or four players. It is played with nineteen pieces for a two-player game, thirteen for a four-player game. The pieces begin play in opposing corners of the board, called the \ The version of the game played with 2 players. The game is played on a 16x16 board. END
Construct a Ludii game based on the following description Play on an equilateral hexagonal triangle-tessellated grid. The board is seeded randomly with a black stone, a white stone, and a neutral stone. Players take turn seeding new groups. Every placement triggers growth of all enemy groups, where growth is defined as adding a stone to all empty cells adjacent to a group. When the board fills up, the person who has more pieces on the board wins. Played on a size 7 board. ###
(game "Inkblots" (players 2) (equipment { (board (tri Hexagon 7)) (tile "Triangle" Each) (tile "Triangle" Neutral)}) (rules (meta (swap)) (start (place Random {"Triangle1" "Triangle2" "Triangle0"})) (play (move Add (to (sites Empty)) (then (add (piece (id "Triangle" Next)) (to (intersection (expand (sites Occupied by:Next) Orthogonal) (sites Empty))))))) (end (if (no Moves Next) (byScore { (score P1 (count Pieces P1)) (score P2 (count Pieces P2))}))))) END
Construct a global Ludii definition which fulfills the following requirements. Move again if all the dice are not used when using the ludeme (forEach Die ...). ###
(define "ReplayNotAllDiceUsed" (if (not (all DiceUsed)) (moveAgain))) END
Modify the Ludii game according to the following option changes: Triangle-Square Omni-Grid - Recommended Variant -> Triangle-Square Grid Order 4 board -> Order 5 board Largest orthogonal group scores 1 point per piece times the total count of the opponent's pieces -> Largest group scores 1 point per piece. (define "Icosahedron" (board (add (remove (tri Limping 4) vertices:{0 1 3 4 5 6 7 8 9 10 11 13 15 17 18 19 20 23 24 25 26 27 31 32 34 35 36 37 39 40 42 43 44 45 46 47}) edges:{ {0 1} {0 2} {0 3} {0 9} {0 10} {1 2} {1 4} {1 6} {6 11} {7 11} {8 11} {1 9} {2 3} {3 5} {3 8} {3 10} {6 9} {8 10} {9 10} {9 11} {10 11}}) use:Vertex)) (define "HexCell" (board (hex Hexagon 4) use:Cell)) (define "HexHex" (board (tri Hexagon 4) use:Vertex)) (define "TriSquare" (board (tiling T33434 (- 4 2)) use:Vertex)) (define "HexLimp" (board (tri Limping (- 4 1)) use:Vertex)) (define "SquareGrid" (board (square 4) use:Vertex)) (define "BoardUsed" "TriSquare") (define "Connection" All) (define "PiePhase" (phase "Pie" (play (if (is Mover P1) (or { (move Add (piece (mover)) (to (sites Empty))) (move Add (piece (next)) (to (sites Empty))) (move Pass)} (then (if (< 0 (counter)) (set NextPlayer (player (next))) (moveAgain)))) (or (move Propose "Accept Pie Offer and Move" (then (set NextPlayer (player (mover))))) (move Propose "Swap Pieces" (then (do (forEach Site (sites Occupied by:Mover) (remember Value (site))) next:(forEach Site (sites Occupied by:Next) (and (remove (site)) (add (piece (mover)) (to (site))))) (then (forEach Value (values Remembered) (and (remove (value)) (add (piece (next)) (to (value)))) (then (and (forget Value All) (set NextPlayer (player (next))))))))))))) (nextPhase (or (is Proposed "Swap Pieces") (is Proposed "Accept Pie Offer and Move")) "Placement"))) (define "SpecialOrthoScoring" (and (set Score Mover (* (max (sizes Group Orthogonal Mover)) (count Pieces Next))) (set Score Next (* (max (sizes Group Orthogonal Next)) (count Pieces Mover))))) (define "SpecialScoring" (and (set Score Mover (* (max (sizes Group All Mover)) (count Pieces Next))) (set Score Next (* (max (sizes Group All Next)) (count Pieces Mover))))) (define "SimpleOrthoScoring" (set Score Mover (max (sizes Group Orthogonal Mover)))) (define "SimpleScoring" (set Score Mover (max (sizes Group All Mover)))) (game "Faraday" (players 2) (equipment { "BoardUsed" (piece "Ball" P1) (piece "Ball" P2)}) (rules (meta (no Repeat Positional)) (start (set Score Each 0)) phases:{ "PiePhase" (phase "Placement" (play (move Add (piece (mover)) (to (sites Empty) if:(or (<= 4 (count Pieces Next in:(sites Around (to) All))) (< 0 (- (count Pieces Next in:(sites Around (to) All)) (count Pieces Mover in:(sites Around (to) All)))))) (then (and { ("SpecialOrthoScoring") (set Var "Last2Move" (mover)) (if (not (no Moves Mover)) (moveAgain))})))) (end (if (all Passed) { (if (!= (score Mover) (score Next)) (byScore)) (if (and (= (score Mover) (score Next)) (= (var "Last2Move") (mover))) (result Mover Loss)) (if (and (= (score Mover) (score Next)) (!= (var "Last2Move") (mover))) (result Mover Loss))} (byScore))))})) ###
(define "Icosahedron" (board (add (remove (tri Limping 4) vertices:{0 1 3 4 5 6 7 8 9 10 11 13 15 17 18 19 20 23 24 25 26 27 31 32 34 35 36 37 39 40 42 43 44 45 46 47}) edges:{ {0 1} {0 2} {0 3} {0 9} {0 10} {1 2} {1 4} {1 6} {6 11} {7 11} {8 11} {1 9} {2 3} {3 5} {3 8} {3 10} {6 9} {8 10} {9 10} {9 11} {10 11}}) use:Vertex)) (define "HexCell" (board (hex Hexagon 5) use:Cell)) (define "HexHex" (board (tri Hexagon 5) use:Vertex)) (define "TriSquare" (board (tiling T33434 (- 5 2)) use:Vertex)) (define "HexLimp" (board (tri Limping (- 5 1)) use:Vertex)) (define "SquareGrid" (board (square 5) use:Vertex)) (define "BoardUsed" "TriSquare") (define "Connection" Orthogonal) (define "PiePhase" (phase "Pie" (play (if (is Mover P1) (or { (move Add (piece (mover)) (to (sites Empty))) (move Add (piece (next)) (to (sites Empty))) (move Pass)} (then (if (< 0 (counter)) (set NextPlayer (player (next))) (moveAgain)))) (or (move Propose "Accept Pie Offer and Move" (then (set NextPlayer (player (mover))))) (move Propose "Swap Pieces" (then (do (forEach Site (sites Occupied by:Mover) (remember Value (site))) next:(forEach Site (sites Occupied by:Next) (and (remove (site)) (add (piece (mover)) (to (site))))) (then (forEach Value (values Remembered) (and (remove (value)) (add (piece (next)) (to (value)))) (then (and (forget Value All) (set NextPlayer (player (next))))))))))))) (nextPhase (or (is Proposed "Swap Pieces") (is Proposed "Accept Pie Offer and Move")) "Placement"))) (define "SpecialOrthoScoring" (and (set Score Mover (* (max (sizes Group Orthogonal Mover)) (count Pieces Next))) (set Score Next (* (max (sizes Group Orthogonal Next)) (count Pieces Mover))))) (define "SpecialScoring" (and (set Score Mover (* (max (sizes Group Orthogonal Mover)) (count Pieces Next))) (set Score Next (* (max (sizes Group Orthogonal Next)) (count Pieces Mover))))) (define "SimpleOrthoScoring" (set Score Mover (max (sizes Group Orthogonal Mover)))) (define "SimpleScoring" (set Score Mover (max (sizes Group Orthogonal Mover)))) (game "Faraday" (players 2) (equipment { "BoardUsed" (piece "Ball" P1) (piece "Ball" P2)}) (rules (meta (no Repeat Positional)) (start (set Score Each 0)) phases:{ "PiePhase" (phase "Placement" (play (move Add (piece (mover)) (to (sites Empty) if:(or (<= 3 (count Pieces Next in:(sites Around (to) Orthogonal))) (< 0 (- (count Pieces Next in:(sites Around (to) Orthogonal)) (count Pieces Mover in:(sites Around (to) Orthogonal)))))) (then (and { ("SimpleScoring") (set Var "Last2Move" (mover)) (if (not (no Moves Mover)) (moveAgain))})))) (end (if (all Passed) { (if (!= (score Mover) (score Next)) (byScore)) (if (and (= (score Mover) (score Next)) (= (var "Last2Move") (mover))) (result Mover Loss)) (if (and (= (score Mover) (score Next)) (!= (var "Last2Move") (mover))) (result Mover Loss))} (byScore))))})) END
Construct a Ludii game based on the following description Each player has six pieces. They take turns placing the pieces on the intersections, attempting to make three in a row. If they are unsuccessful after all the pieces are placed, they then take turns moving their piece one spot along one of the lines until someone makes three in a row (Murray 1951: 43). The game is played according to the rules of Murray. ###
(game "Achi" (players 2) (equipment { (board (concentric Square rings:2) use:Vertex) (hand Each) (piece "Marker" Each ("StepToEmpty" ~ (then ("ReplayIfLine3" Orthogonal exact:True))))}) (rules (start (place "Marker" "Hand" count:6)) phases:{ (phase "Placement" (play (if "SameTurn" ("RemoveAnyEnemyPiece") (move (from (handSite Mover)) (to (sites Empty)) (then ("ReplayIfLine3" Orthogonal exact:True))))) (nextPhase Mover ("HandEmpty" Mover) "Movement")) (phase "Movement" (play (if "SameTurn" ("RemoveAnyEnemyPiece") (forEach Piece))))} (end (if (<= (count Pieces Next) 2) (result Mover Win))))) END
Construct a global Ludii definition which fulfills the following requirements. Defines two opposite table tracks and using hand sites. ###
(define "TableTracksOppositeWithHands2" { (track "Track1" {24 11..0 12..23 #1} P1 directed:True) (track "Track2" {25 23..12 0..11 #1} P2 directed:True)}) END
Describe the mechanics of the following Ludii game (define "SowedHoles" (if (is Mover P1) (values Remembered "SowedHolesP1") (values Remembered "SowedHolesP2"))) (define "RemmemberSowedHoles" (if (is Mover P1) (remember Value "SowedHolesP1" #1 unique:True) (remember Value "SowedHolesP2" #1 unique:True))) (define "NextHole" ("NextSiteOnTrack" #2 from:#1 "Track")) (game "Adjiboto" (players 2) (equipment { (mancalaBoard 2 5 store:None (track "Track" "0,E,N,W" loop:True)) (piece "Seed" Shared) (hand Each) (regions P1 (sites Bottom)) (regions P2 (sites Top))}) (rules (start (set Count 10 to:(sites Track))) phases:{ (phase "Opening" (play (move Select (from (difference (sites Mover) (sites ("SowedHoles"))) if:(< 1 (count at:(to)))) (then (and (sow origin:True) ("RemmemberSowedHoles" (last From)))))) (nextPhase Mover (< 8 (count Turns)))) (phase "Main" (play (move Select (from (sites Mover) if:(< 1 (count at:(to)))) (then (sow if:(or { (= 1 (count at:("NextHole" (to) 1))) (= 3 (count at:("NextHole" (to) 1))) (= 5 (count at:("NextHole" (to) 1)))}) apply:(fromTo (from ("NextHole" (to) 1)) (to (handSite Mover)) count:(count at:("NextHole" (to) 1))) origin:True forward:True)))) (end (if (no Moves Next) { (if (< (count Cell at:(handSite Next)) 50) (result Mover Win)) (if (>= (count Cell at:(handSite Next)) 50) (result Mover Draw))})))})) ###
2x5 board. Ten counters in each hole. Sowing occurs in an anti-clockwise direction, sowing first into the hole from which the counters originally came. Opening phase: In the first ten turns, each player must sow from each of their five holes. Main phase: Captures are made when the last counter of a sowing falls into a hole preceding a hole containing one, three, or five counters. These counters are taken. Any subsequent holes also containing one, three, or five counters are captured, until a hole is reached that does not have one of these numbers of counters. The exception to this is in the first move when no captures are made. Sowing cannot begin from a hole with a single counter. A player wins when his opponent can no longer sow. However, if a player can no longer move, they can redistribute their captured beans into their holes, and if all five can be filled with ten, the game is a draw. END
Describe the mechanics of the following Ludii game (game "Compart" (players 2) (equipment { (board (square 11) use:Vertex) (piece "Marker" Each)}) (rules (meta (swap)) (play (move Add (to (sites Empty) if:(not (is In (to) (sites (values Remembered)))) (apply (addScore Mover 1))) (then (do (forEach Site (sites Group at:(last To) if:(not (is Enemy (who at:(to))))) (remember Value (site))) next:(if (< 0 (count Sites in:(difference (sites Empty) (sites (values Remembered))))) (moveAgain) (forget Value All)))))) (end (if (is Full) { (if (= (score P1) (score P2)) (result Mover Win)) (if True (byScore misere:True))})))) ###
Played with black and white stones on an initially empty square board. On your turn, for every viable area with one or more empty points, place a stone of your color on one of those points. A viable area is a viable point along with all other such points one can reach from it through a series of steps onto orthogonally adjacent viable points. A viable point is a point that is empty or occupied by a friendly stone. When the board is full, the player with fewer stones on the board wins. If there is a tie, whoever placed the last stone wins. Ties are only possible on even-sized boards. To make the game fair, the second player will have the option, on their first turn only, to swap sides with their opponent instead of making a regular move. An 11x11 board is currently selected. END
Construct a Ludii game based on the following description Goal: You try to both reduce the number of your own groups as much as possible, and also to block your opponent's ability to reduce his groups down to fewer than yours. Whoever decides to end the game must fill the empty spaces with opponent's pieces, and only then, wins by having equal or fewer groups. Play: Starting with the board empty, player's take turns placing a piece of their color on an empty position that does not abut any friendly piece. If it is impossible to place a piece, the player, instead, moves a piece to the first empty position in any direction. But whenever a new opportunity for placement is available, the turn must be used for placement. Ending the Game: The game ends at the choice of the player about to move, but only at the beginning of a turn in which there is no forced placement. Before scoring, the empty spaces are filled with the opponent's pieces. The player who ended the game wins unless the opponent has fewer groups. Because the empty spaces are filled with opponent's pieces, a player who ends the game too soon will lose. On the other hand, since ties go to the player who ends the game, it is important to end the game as soon as you can actually win. Variations: Options are available to select the board size, and also to use other movement rules, instead of the standard one. Board & size: Hexhex with edges alternately 2 and 3 Movement: Pieces step or jump once, to the first empty position in that direction. ###
(define "Jumping" (forEach Piece ("HopAllPiecesToEmpty" ~ ~ (range 0 18)))) (define "Stepping" (forEach Piece ("StepToEmpty"))) (define "Sliding" (forEach Piece (move Slide))) (define "Hopping" (forEach Piece (or ("HopAllPiecesToEmpty") ("StepToEmpty")))) (define "Shooting" (forEach Piece (move (from) (to (sites LineOfSight Farthest at:(from)) if:(is Empty (to)))))) (game "Abrobad" (players 2) (equipment { (board (hex Limping 2)) (piece "Hex" Each)}) (rules (play (priority (move Add (to (sites Empty) if:(= 0 (count Sites in:(sites Around (to) Own))))) (or "Jumping" (move Propose "Conclude" (then (if (is Proposed "Conclude") (add (piece (next)) (to (sites Empty)) (then (and (set Score Mover (count Groups if:(= (who at:(to)) (mover)))) (set Score Next (count Groups if:(= (who at:(to)) (next))))))))))))) (end (if (is Proposed "Conclude") (if (<= (score Mover) (score Next)) (result Mover Win)) (result Next Win))))) END
Describe the mechanics of the following Ludii game (game "1D Chess" (players 2) (equipment { (board (rectangle 1 8)) ("ChessRook" "Rook") ("ChessKing" "King") (piece "Knight" Each ("LeapCapture" { {F F}}))}) (rules (start { (place "Rook1" coord:"C1") (place "Knight1" coord:"B1") (place "King1" coord:"A1") (place "Rook2" coord:"F1") (place "Knight2" coord:"G1") (place "King2" coord:"H1")}) (play (do (forEach Piece) ifAfterwards:(not ("IsInCheck" "King" Mover)))) (end { ("Checkmate" "King") (if (or (no Moves Mover) (= (counter) 100)) (result Mover Draw))}))) ###
Here, the King and Rook move as usual, and the knight moves exactly two squares, and may jump over a piece doing that. Gardner asks his readers whether white can win. (White can make a draw by taking the opponents rook and thus giving stalemate.). Board of length 8. END
Modify the Ludii game according to the following option changes: Each player has 6 holes on each row. -> Each player has 10 holes on each row. (define "Columns" 6) (game "Katra" (players 2) (equipment { (mancalaBoard 4 "Columns" store:None { (track "TrackCCW1" "0,E,N1,W" loop:True P1) (track "TrackCCW2" "12,E,N1,W" loop:True P2) (track "TrackCW1" "5,W,N1,E" loop:True P1) (track "TrackCW2" "18,E,S1,W" loop:True P2)}) (regions "Home" P1 (sites Track "TrackCCW1")) (regions "Home" P2 (sites Track "TrackCCW2")) (regions "Outer" P1 (sites Bottom)) (regions "Outer" P2 (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:(if (< 1 (count at:(to))) (if (is In (to) (sites Mover "Outer")) (and (moveAgain) (set Var "Replay" (to))) (if (< 1 (count at:("OppositePit" (to)))) (and { (fromTo (from ("OppositePit" (to))) (to (to)) count:(count at:("OppositePit" (to)))) (moveAgain) (set Var "Replay" (to))}) (if (< 1 (count at:("OppositeOuterPit" (to)))) (and { (fromTo (from ("OppositeOuterPit" (to))) (to (to)) count:(count at:("OppositeOuterPit" (to)))) (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:(if (< 1 (count at:(to))) (if (is In (to) (sites Mover "Outer")) (and (moveAgain) (set Var "Replay" (to))) (if (< 1 (count at:("OppositePit" (to)))) (and { (fromTo (from ("OppositePit" (to))) (to (to)) count:(count at:("OppositePit" (to)))) (moveAgain) (set Var "Replay" (to))}) (if (< 1 (count at:("OppositeOuterPit" (to)))) (and { (fromTo (from ("OppositeOuterPit" (to))) (to (to)) count:(count at:("OppositeOuterPit" (to)))) (moveAgain) (set Var "Replay" (to))})))))) (if (!= (value Player Mover) 2) (set Value Mover 2)))))))) (end "ForEachNonMoverNoMovesLoss"))) ###
(define "Columns" 10) (game "Katra" (players 2) (equipment { (mancalaBoard 4 "Columns" store:None { (track "TrackCCW1" "0,E,N1,W" loop:True P1) (track "TrackCCW2" "20,E,N1,W" loop:True P2) (track "TrackCW1" "9,W,N1,E" loop:True P1) (track "TrackCW2" "30,E,S1,W" loop:True P2)}) (regions "Home" P1 (sites Track "TrackCCW1")) (regions "Home" P2 (sites Track "TrackCCW2")) (regions "Outer" P1 (sites Bottom)) (regions "Outer" P2 (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:(if (< 1 (count at:(to))) (if (is In (to) (sites Mover "Outer")) (and (moveAgain) (set Var "Replay" (to))) (if (< 1 (count at:("OppositePit" (to)))) (and { (fromTo (from ("OppositePit" (to))) (to (to)) count:(count at:("OppositePit" (to)))) (moveAgain) (set Var "Replay" (to))}) (if (< 1 (count at:("OppositeOuterPit" (to)))) (and { (fromTo (from ("OppositeOuterPit" (to))) (to (to)) count:(count at:("OppositeOuterPit" (to)))) (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:(if (< 1 (count at:(to))) (if (is In (to) (sites Mover "Outer")) (and (moveAgain) (set Var "Replay" (to))) (if (< 1 (count at:("OppositePit" (to)))) (and { (fromTo (from ("OppositePit" (to))) (to (to)) count:(count at:("OppositePit" (to)))) (moveAgain) (set Var "Replay" (to))}) (if (< 1 (count at:("OppositeOuterPit" (to)))) (and { (fromTo (from ("OppositeOuterPit" (to))) (to (to)) count:(count at:("OppositeOuterPit" (to)))) (moveAgain) (set Var "Replay" (to))})))))) (if (!= (value Player Mover) 2) (set Value Mover 2)))))))) (end "ForEachNonMoverNoMovesLoss"))) END
Modify the Ludii game according to the following option changes: The game is played with 2 players. -> The game is played with 3 players. (define "PiecesOwnedBy" (count Cell at:(handSite #1))) (define "NumPlayers" 2) (game "Pic" (players "NumPlayers") (equipment { (board (concentric {(* 3 "NumPlayers")}) (track "Track" {0 2 4 5 3 1} loop:True) use:Vertex) (piece "Seed" Shared) (hand Each) (regions P1 (sites {0 2 4})) (regions P2 (sites {5 3 1}))}) (rules (start (set Count 12 to:(sites Track))) (play (or { (move Select (from (sites Mover) if:(is Occupied (from))) (then (sow apply:(if (and (not (is In (to) (sites Mover))) (= 3 (count at:(to)))) (and (fromTo (from (to)) (to (handSite Mover)) count:3) (set State at:(to) (mover)))))))} (then (forEach Site (sites Board) (if (and (is Occupied (site)) (!= 0 (state at:(site)))) (and (fromTo (from (site)) (to (handSite (state at:(site)))) count:(count at:(site))) (set State at:(site) (state at:(site))))))))) (end (if ("NoPieceOnBoard") (byScore { (score P1 ("PiecesOwnedBy" P1)) (score P2 ("PiecesOwnedBy" P2))}))))) ###
(define "PiecesOwnedBy" (count Cell at:(handSite #1))) (define "NumPlayers" 3) (game "Pic" (players "NumPlayers") (equipment { (board (concentric {(* 3 "NumPlayers")}) (track "Track" {0 1 3 5 7 8 6 4 2} loop:True) use:Vertex) (piece "Seed" Shared) (hand Each) (regions P1 (sites {0 1 3})) (regions P2 (sites {5 7 8})) (regions P3 (sites {6 4 2}))}) (rules (start (set Count 12 to:(sites Track))) (play (or { (move Select (from (sites Mover) if:(is Occupied (from))) (then (sow apply:(if (and (not (is In (to) (sites Mover))) (= 3 (count at:(to)))) (and (fromTo (from (to)) (to (handSite Mover)) count:3) (set State at:(to) (mover)))))))} (then (forEach Site (sites Board) (if (and (is Occupied (site)) (!= 0 (state at:(site)))) (and (fromTo (from (site)) (to (handSite (state at:(site)))) count:(count at:(site))) (set State at:(site) (state at:(site))))))))) (end (if ("NoPieceOnBoard") (byScore { (score P1 ("PiecesOwnedBy" P1)) (score P2 ("PiecesOwnedBy" P2)) (score P3 ("PiecesOwnedBy" P3))}))))) END
Construct a Ludii game based on the following description 2x12 board, divided in half, where the spaces are rendered as points. Fifteen pieces per player. Two six-sided dice. Both players begin on the same side of the board, one player (who plays first) with five pieces on the rightmost point of the starting row, four on the fifth and sixth points and two in the eleventh point in the opposite row. The other player has three pieces each on the right five points in the second row. 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. On each throw the player also plays a throw of 6 in addition to the throw presented by the dice. Pieces move in an anti-clockwise direction around the board. A piece cannot move to a point that is occupied by more than one of the opponent's pieces. If a piece lands on a point occupied by a single piece belonging to the opponent, the opponent's piece is removed from the board and must enter again from the leftmost point in the row where the pieces began. A piece may be borne off the board when a throw is greater than the number of points left on the board. The first player to bear all of their pieces off the board wins. ###
(define "Move" (forEach Site (sites Occupied by:Mover) (if ("CanEscape" #1) ("RemoveAPiece") (move (from (site)) (to #1 if:("NoEnemyOrOnlyOne" (to)) ("HittingCapture" ("Bar"))))))) (define "CanEscape" ("IsOffBoard" #1)) (define "AllPieceEscaped" (no Pieces Mover)) (define "Bar" (mapEntry (mover))) (define "RemoveAPiece" (move Remove (site))) (define "NextSiteFromDist6" ("NextSiteOnTrack" 6 from:#1)) (define "NextSiteFrom" ("NextSiteOnTrack" (pips) from:#1)) (game "Myles" (players 2) (equipment { ("BackgammonBoard" ("BackgammonTracksSameDirectionWithBar")) (dice num:2) (map {(pair 1 19) (pair 2 6)}) (piece "Disc" Each)}) (rules (start { (place Stack "Disc1" 12 count:5) (place Stack "Disc1" 20 count:4) (place Stack "Disc1" 21 count:4) (place Stack "Disc1" 15 count:2) (place Stack "Disc2" 25 count:3) (place Stack "Disc2" 24 count:3) (place Stack "Disc2" 23 count:3) (place Stack "Disc2" 22 count:3) (place Stack "Disc2" 21 count:3)}) (play ("RollEachNewTurnMove" (if (all DiceUsed) ("Move" ("NextSiteFromDist6" (site))) (forEach Die if:("DieNotUsed") ("Move" ("NextSiteFrom" (site))) (then (moveAgain)))))) (end (if ("AllPieceEscaped") (result Mover Win))))) END
Construct a Ludii game based on the following description Three rows of holes, arranged vertically, the outer two have twelve holes and the central one has thirteen. Twelve pieces per player, which begin in the outer rows. Four sticks, black on one side and white on the other, the number of white faces up is the value of the throw; all black faces up = 6. A player must throw a 1 (sig) to unlock a piece, which moves from the top hole in the player's row to the top hole of the central row. When a piece reaches the thirteenth space in the central row, they must throw a sig to enter the opponent's home row, at the bottom hole in that row, and proceed up that row to the top and then back into the central row. When entering the opponent's row, the opponent's piece in their bottom hole is sent to the next available hole in their row. In the central row, when a piece lands on a hole with an opponent's piece, the opponent's piece is sent back to start in their home row. A player landing on a hole occupied by an opponent in the home row captures the opponent's piece. The player who captures all of the opponent's pieces wins. The game is played with 4 dice. ###
(define "Move" (or (if ("IsInTrack" (from) "HomeTrack") (if (if ("PieceActivated" (from)) True ("Sig")) (if (not ("IsFriendAt" ("NextSiteOnTrack" ("ThrowValue") "HomeTrack"))) (move (from) (to ("NextSiteOnTrack" ("ThrowValue") "HomeTrack") "CaptureEnemyPiece") (then (if (and (not ("PieceActivated" (last To))) ("Sig")) ("ActivatePiece" (last To)))))))) (if ("IsInTrack" (from) "EnemyTrack") (if (not ("IsFriendAt" ("NextSiteOnTrack" ("ThrowValue") "EnemyTrack"))) (move (from) (to ("NextSiteOnTrack" ("ThrowValue") "EnemyTrack") "CaptureEnemyPiece")))))) (define "CaptureEnemyPieceInEntering" (apply if:("IsEnemyAt" (to)) (if ("IsOffBoard" ("FirstAvailableInHome" Next)) (remove (to)) (fromTo (from (to)) (to ("FirstAvailableInHome" Next)))))) (define "FirstAvailableInHome" (min (array (intersection (sites Empty) (sites #1 "Home"))))) (define "IsInTrack" (is In #1 (sites Track Mover #2))) (define "CaptureEnemyPiece" (apply if:("IsEnemyAt" (to)) (if (is In (to) (sites Next "Home")) (remove (to)) (if ("IsOffBoard" ("FirstAvailableInHome" Next)) (remove (to)) (fromTo (from (to)) (to ("FirstAvailableInHome" Next))))))) (define "PieceActivated" (!= 0 (state at:#1))) (define "ActivatePiece" (set State at:#1 1)) (define "Sig" (= 1 ("ThrowValue"))) (define "ThrowValue" (mapEntry "Throw" (count Pips))) (define "BottomSite" 36) (game "Sig (Tidikelt)" (players 2) (equipment { (board (merge { (rectangle 12 3) (shift 1 -1 (rectangle 13 1))}) { (track "HomeTrack1" "0,N,E1,S" P1 directed:True) (track "HomeTrack2" "2,N,W1,S" P2 directed:True) (track "EnemyTrack1" "2,N,W1,S" P1 directed:True) (track "EnemyTrack2" "0,N,E1,S" P2 directed:True)} use:Vertex) (piece "Stick" Each) (regions "AllSites" (sites Board)) ("StickDice" 4) (map "Throw" {(pair 0 6) (pair 1 1) (pair 2 2) (pair 3 3) (pair 4 4)}) (map "FirstEnemySite" {(pair P1 2) (pair P2 0)}) (regions "Home" P1 (sites Left)) (regions "Home" P2 (sites Right))}) (rules (start { (place "Stick1" (sites Left)) (place "Stick2" (sites Right))}) (play ("RollMove" (or (if (and ("Sig") (= (mover) (who at:("BottomSite")))) (move (from ("BottomSite")) (to (mapEntry "FirstEnemySite" (mover)) if:(not (is Friend (mapEntry "FirstEnemySite" (mover)))) "CaptureEnemyPieceInEntering"))) (forEach Piece ("Move"))))) (end ("CaptureAll" Next)))) END
Describe the mechanics of the following Ludii game (game "Mbenga Alignment Game" (players 2) (equipment { (board (rectangle 3 3 diagonals:Alternating) use:Vertex) (hand Each) (piece "Marker" Each)}) (rules (start (place "Marker" "Hand" count:3)) (play (move (from (handSite Mover)) (to (sites Empty)))) (end (if (is Line 3) (result Mover Win))))) ###
3x3 intersecting lines with diagonals. Three pieces per player. Players alternate turns placing a piece on the board. The first player to place three of their pieces in a row wins. END
Describe the mechanics of the following Ludii game (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 "CaptureToPiece" (apply (if ("IsEnemyAt" (to)) (remove (to))))) (define "PieceHasMoved" (set State at:#1 0)) (define "RememberPieceHasMoved" (then (if (= (state at:(last To)) 1) ("PieceHasMoved" (last To))))) (game "Long Assize" ("TwoPlayersNorthSouth") (equipment { (board (square 8)) (piece "King" Each (or ("StepToNotFriend") (if (= 1 (state at:(from))) (move Hop (between if:(not ("IsEnemyAt" (between)))) (to if:(not ("IsFriendAt" (to))) "CaptureToPiece"))) ("RememberPieceHasMoved"))) ("ChessRook" "Rook") (piece "Bishop" Each (move Hop Diagonal (between if:True) (to if:(not ("IsFriendAt" (to))) "CaptureToPiece"))) ("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" (or (if (is In (from) (sites Start (piece (what at:(from))))) ("DoubleStepForwardToEmpty" "SetEnPassantLocation")) "EnPassant") (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 Row 1)) (place "Pawn2" (sites Row 6)) (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") ("DrawIfNoMoves" Next) (if (= (count Pieces Next) 1) (result Mover Win))}))) ###
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 to the second square on its first move if it has not yet been checked and does not hop over an opponent's piece. 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 Fil (elephant): Two squares diagonally, jumping over the first. Cannot capture another Fil. 2 x Knight: Moves as a chess knight. 8 x Pawn: Moves one space forward orthogonally; one space forward diagonally to capture. May move two spaces on its first move. En passant is allowed. Promoted to Queen when reaching the eighth rank, and may make the Queen's leap on its first move after being promoted. 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. Stalemate results in a draw. Capturing all of an opponent's pieces except the King also results in a win. END
Modify the Ludii game according to the following option changes: The board has 1 row. -> The board has 2 rows. The board has 2 columns. -> The board has 3 columns. (game "Domineering" (players 2) (equipment { (board (rectangle 1 2)) (tile "Horz" P1 {R F} numSides:4) (tile "Vert" P2 {F} numSides:4)}) (rules (play (move Add (piece (mover) state:0) (to (sites Empty)))) (end ("NoMoves" Loss)))) ###
(game "Domineering" (players 2) (equipment { (board (rectangle 2 3)) (tile "Horz" P1 {R F} numSides:4) (tile "Vert" P2 {F} numSides:4)}) (rules (play (move Add (piece (mover) state:0) (to (sites Empty)))) (end ("NoMoves" Loss)))) END
Construct a Ludii game based on the following description The goal is to place three mines in every row, column and region. The digits in the grid represent the number of mines in the neighbouring cells. ###
(game "Sudoku Mine" (players 1) (equipment { (board (square 9) (values Cell (range 0 1))) (hints { (hint 5 1) (hint 7 2) (hint 8 1) (hint 10 3) (hint 19 1) (hint 24 3) (hint 29 3) (hint 35 4) (hint 39 3) (hint 41 3) (hint 45 4) (hint 51 2) (hint 56 3) (hint 61 2) (hint 70 3) (hint 72 1) (hint 73 1) (hint 75 1)}) (regions {Columns Rows}) (piece "Bomb" P1)}) (rules (play (satisfy { (forAll Hint (is Count (sites Around (from)) of:1 (hint))) (forAll Hint (= (what at:(from)) 0)) (is Sum 3)})) (end (if (is Solved) (result P1 Win))))) END
What does the following global Ludii definition do? (define "HopStackEnemyCaptureTopDistance" (move Hop #1 #2 (between before:(count Rows) after:(count Rows) if:("IsEnemyAt" (between)) (apply (fromTo (from (between)) (to)))) (to if:(and (is In (from) (sites Occupied by:Mover)) (is Empty (to)))) stack:True #3)) ###
Defines a hop move in all the directions specified (by default Adjacent) over a stack with on top an enemy to an empty site at any distance. The enemy piece is moved to the top of the jumping stack. END
Construct a Ludii game based on the following description 2x12 board, divided in half. Spaces on each side take the form of semi-circular sockets, into which the pieces fit. Fifteen pieces per player. Three six-sided dice. Players move according to the number on each die by moving one piece the value on one die then another piece the value on the other die, or by moving one piece the value of one die and then the value of the other. One player begins with all of their pieces on the space furthest to the left on their side, the other with their pieces on the point directly opposite it. Pieces move in opposite directions around the board, toward the point where the opponent's pieces begin, and bearing off the board from there. A player cannot have two of their pieces on the same spot in the starting quadrant. When a piece lands on the same space as a single opponent's piece, the opponent's piece is sent back to where it began. The first person to bear off all their pieces wins. If players move their pieces such that they fill up all the points in a quadrant, and the other fills up all of the points in an adjacent quadrant such that neither player can move, the game is a draw. It is a prime win when one player has twelve pieces arranged on consecutive points so that the other player cannot pass them. When the player sends four pieces back to the beginning while preserving this state, it is a prime win. ###
(define "RemoveAPiece" (move Remove (from))) (define "SiteToMoveOnTrack" ("NextSiteOnTrack" (pips))) (game "Emperador" (players 2) (equipment { ("TableBoard" "TableTracksOppositeWithHands") (dice d:6 num:3) (hand Each) (regions "StartingQuadrant" P1 (sites {0..5})) (regions "StartingQuadrant" P2 (sites {12..17})) (piece "Disc" Each (forEach Die if:("DieNotUsed") (if ("IsOffBoard" "SiteToMoveOnTrack") "RemoveAPiece" (if (or { (is Empty ("SiteToMoveOnTrack")) (and ("IsFriendAt" "SiteToMoveOnTrack") (if (is In (to) (sites Mover "StartingQuadrant")) (not ("IsSingletonStack" "SiteToMoveOnTrack")) True)) (and ("IsEnemyAt" "SiteToMoveOnTrack") ("IsSingletonStack" "SiteToMoveOnTrack"))}) (move (from) (to "SiteToMoveOnTrack" ("HittingCapture" (handSite (who at:(to))))))))))}) (rules (start { (place Stack "Disc1" 0 count:15) (place Stack "Disc2" 12 count:15)}) (play ("RollEachNewTurnMove" (or (forEach Piece top:True) (forEach Piece container:(mover) top:True) (then ("ReplayNotAllDiceUsed"))))) (end { ("EscapeWin") (if (and (no Moves P1) (no Moves P2)) (result Mover Draw))}))) END
Describe the mechanics of the following Ludii game (game "Domineering" (players 2) (equipment { (board (rectangle 6 6)) (tile "Horz" P1 {R F} numSides:4) (tile "Vert" P2 {F} numSides:4)}) (rules (play (move Add (piece (mover) state:0) (to (sites Empty)))) (end ("NoMoves" Loss)))) ###
Two players have a collection of dominoes which they place on the grid in turn, covering up squares. One player places tiles vertically, while the other places them horizontally. The first player who cannot move loses. The board has 6 rows. The board has 6 columns. The Last player to play wins. END
Describe the mechanics of the following Ludii game (define "PlayAPiece" (if (= (count Pips) 6) (forEach Piece "King_noCross") (if (= (count Pips) 5) (forEach Piece "Queen") (if (= (count Pips) 4) (forEach Piece "Elephant") (if (= (count Pips) 3) (forEach Piece "Knight") (if (= (count Pips) 2) (forEach Piece "Rook") (forEach Piece "Pawn"))))))) (game "Shatranj al-Mustatila" ("TwoPlayersNorthSouth") (equipment { (board (rectangle 16 4)) ("ChessKing" "King_noCross") (piece "Queen" Each ("StepToNotFriend" Diagonal)) (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)))))) ("ChessKnight" "Knight") ("ChessRook" "Rook") ("ChessPawn" "Pawn" ~ (then ("PromoteIfReach" (sites Mover "Promotion") "Queen"))) (regions "Promotion" P1 (sites Top)) (regions "Promotion" P2 (sites Bottom)) (dice d:6 from:1 num:1)}) (rules (start { (place "Pawn1" (union (sites Row 4) (sites Row 5))) (place "Pawn2" (union (sites Row 10) (sites Row 11))) (place "Elephant1" (sites {"A1" "D1"})) (place "Knight1" (sites {"B2" "C2"})) (place "Rook1" (sites {"A2" "D2"})) (place "King_noCross1" coord:"B1") (place "Queen1" coord:"C1") (place "Elephant2" (sites {"A16" "D16"})) (place "Knight2" (sites {"B15" "C15"})) (place "Rook2" (sites {"A15" "D15"})) (place "King_noCross2" coord:"C16") (place "Queen2" coord:"B16")}) (play (do (do (roll) next:(if ("IsInCheck" "King_noCross" Next (forEach Piece)) (move Pass (then (trigger "NextCanNotEscape" (next)))) ("PlayAPiece"))) ifAfterwards:(not ("IsInCheck" "King_noCross" Mover (forEach Piece Next))))) (end { ("Checkmate" "King_noCross") (if (is Triggered "CanNotEscape" Next) (result Mover Win)) (if (not (can Move (forEach Piece Next))) (result Mover Win))}))) ###
4x16 board. The pieces move as follows, with the number per player: Shah (king)x1: moves one space orthogonally or diagonally. Fers (counselor)x1: one square diagonally; Rukh (rook)x2: any number of spaces orthogonally; Pil (elephant)x2: two squares diagonally, jumping over the first, cannot capture another Pil; Asb (horse)x2: moves orthogonally one space and then diagonally one space, jumping over any intervening pieces; Sarbaz (soldier)x8: moves one space forward orthogonally or one space forward diagonally to capture. No en passant, promoted to Fers when reaching the sixteenth rank. Pieces are placed with the Shah and Fers in the center of the row closest to the player (Shah to the right), a Pil on either side of them, the Asb on the two center squares in the second row, flanked by the Rukh, and the Sarbaz on the fifth and sixth rows. Movement of the pieces is determined by one six-sided die, with the following throws: 6=Shah, 5=Fers, 4=Pil, 3=Asb, 2=Rukh, 1=Sarbaz. No castling. Stalemate results in win for player causing it. When the Shah is in check, the opponent must roll a 6 for it to escape. The player who checkmates the Shah wins. END
Construct a global Ludii definition which fulfills the following requirements. Defines a surround capture in all the directions specified (by default Adjacent). The enemy piece is removed. ###
(define "SurroundCapture" (surround (from (last To)) #1 (between #2 if:("IsEnemyAt" (between)) (apply (remove (between)))) (to if:("IsFriendAt" (to))) #3)) END
What does the following global Ludii definition do? (define "RollMove" (do (roll) next:#1 #2)) ###
Roll dice before to compute the legal moves. END
Construct a Ludii game based on the following description The following rules are additionally used to the chess rules: - Pawns can only advance one space on their first move. There is no en passant capturing. - A pawn can only promote to a captured piece. - There is no castling. - If 20 moves are played without a capture or promotion, the player with the most `points' on the board wins. (Pawn=1 pt., Bishop/Knight=3, Rook=5, Queen = 9.) The game starts like in the encyclopedia of Chess Variants. ###
(define "PromoteMove" (or { (if ("WasCaptured" (id "Queen" Mover)) (move Promote #1 (piece {"Queen"}) Mover)) (if ("WasCaptured" (id "Knight" Mover)) (move Promote #1 (piece {"Knight"}) Mover)) (if ("WasCaptured" (id "Rook" Mover)) (move Promote #1 (piece {"Rook"}) Mover)) (if ("WasCaptured" (id "Bishop" Mover)) (move Promote #1 (piece {"Bishop"}) Mover))} #2)) (define "WasCaptured" (is In #1 (values Remembered "CapturedPieces"))) (define "CaptureForwardDiagonal" (move Step (directions {FR FL}) (to if:("IsEnemyAt" (to)) (apply (and (remove (to)) (remember Value "CapturedPieces" (what at:(to)))))))) (define "CaptureToPieceAndResetCounter" (apply (if ("IsEnemyAt" (to)) (and (remove (to) (then (set Counter))) (remember Value "CapturedPieces" (what at:(to))))))) (game "Quick Chess" ("TwoPlayersNorthSouth") (equipment { (board (rectangle 6 5)) (piece "Pawn" Each (or { "StepForwardToEmpty" "CaptureForwardDiagonal"} (then (and (if (and (is In (last To) (sites Mover "Promotion")) (can Move ("PromoteMove" (last To)))) (moveAgain)) (set Counter))))) (piece "Rook" Each (move Slide Orthogonal (to if:("IsEnemyAt" (to)) "CaptureToPieceAndResetCounter"))) (piece "King" Each (move Step (to if:(not ("IsFriendAt" (to))) "CaptureToPieceAndResetCounter"))) (piece "Bishop" Each (move Slide Diagonal (to if:("IsEnemyAt" (to)) "CaptureToPieceAndResetCounter"))) (piece "Knight" Each (move Leap "KnightWalk" (to if:(not ("IsFriendAt" (to))) "CaptureToPieceAndResetCounter"))) (piece "Queen" Each (move Slide (to if:("IsEnemyAt" (to)) "CaptureToPieceAndResetCounter"))) (regions "Promotion" P1 (sites Top)) (regions "Promotion" P2 (sites Bottom))}) (rules (start { (place "Pawn1" (sites Row 1)) (place "Pawn2" (sites Row 4)) (place "Rook1" {"E1"}) (place "Knight1" {"A1"}) (place "Bishop1" {"D1"}) (place "Queen1" coord:"C1") (place "King1" coord:"B1") (place "Rook2" {"E6"}) (place "Knight2" {"A6"}) (place "Bishop2" {"D6"}) (place "Queen2" coord:"C6") (place "King2" coord:"B6")}) (play (if "SameTurn" ("PromoteMove" (last To)) (do (forEach Piece) ifAfterwards:(not ("IsInCheck" "King" Mover))) (then (if (= 19 (counter)) (and (forEach Player (forEach Site (sites Occupied by:Player) (if (= (what at:(site)) (id "Pawn" Player)) (addScore Player 1) (if (= (what at:(site)) (id "Rook" Player)) (addScore Player 5) (if (= (what at:(site)) (id "Queen" Player)) (addScore Player 9) (if (!= (what at:(site)) (id "King" Player)) (addScore Player 3))))))) (set Var "NoEnoughCapture" 1)))))) (end { ("Checkmate" "King") (if (no Moves Mover) (result Mover Draw)) (if (= (var "NoEnoughCapture") 1) (byScore))}))) END
Construct a Ludii game based on the following description Monty Hall asks to choose one of three doors. One of the doors hides a car and the other two doors have a goat. You select which door you pick, but you don’t open it right away. The game opens one of the other two doors, and there is no prize behind it. At this moment, there are two closed doors. You can keep the same choice or selecting the other door. If you get the car you win if not you loss. ###
(game "Monty Hall Problem" (players 1) (equipment { (board (rectangle 1 3)) (piece "Car" Shared) (piece "Goat" Shared)}) (rules (start { (place Random {"Car"}) (place Random {"Goat"} count:2) (set Hidden What (sites Board) to:P1)}) phases:{ (phase "FirstChoice" (play (move Select (from (sites Board)) (then (set Hidden What (sites Random (forEach (sites Board) if:(and (!= (site) (last To)) (!= (id "Car" Shared) (what at:(site))))) num:1) False to:P1)))) (nextPhase "FinalChoice")) (phase "FinalChoice" (play (move Select (from (sites Board)) (then (set Hidden What (sites Board) False to:P1)))) (end { (if ("IsPieceAt" "Car" Shared (last To)) (result P1 Win)) (if ("IsPieceAt" "Goat" Shared (last To)) (result P1 Loss))}))})) END
Construct a Ludii game based on the following description 8x8 board. The pieces move as follows, with the number per player: King (x1): moves one space orthogonally or diagonally; Counselor (x1): One square diagonally, but may move two spaces forward orthogonally on the first move, jumping over the Soldier in front of it on the first move of the game; Rook (x2): Any number of spaces orthogonally; Elephant (x2): Two squares diagonally, jumping over the first, cannot capture another Elephant; Horse (x2): Moves as a chess knight. Soldier (x8): Moves one space forward orthogonally; one space forward diagonally to capture. The Soldier in front of the Counselor may jump to the space in front of the Counselor when it has used its special move on the first turn, this must be done as the second move of the game, i.e. on the next turn after the Counselor had made its special move. No en passant. Soldiers promote to Counselor when reaching the eighth rank. No castling. Stalemate results in a win for player causing it. The player who checkmates the king wins. ###
(game "Rumi Shatranj" ("TwoPlayersNorthSouth") (equipment { (board (square 8)) (hand Each size:5) ("ChessKing" "King_noCross") ("ChessRook" "Rook") (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)))))) ("ChessKnight" "Knight") ("ChessPawn" "Pawn" ~ (then ("ReplayInMovingOn" (sites Mover "Promotion")))) (piece "Ferz_noCross" Each ("StepToNotFriend" Diagonal)) (regions "Promotion" P1 (sites Top)) (regions "Promotion" P2 (sites Bottom))}) (rules (start { (place "Pawn1" (sites Row 1)) (place "Pawn2" (sites Row 6)) (place "Rook1" {"A1" "H1"}) (place "Knight1" {"B1" "G1"}) (place "Elephant1" {"C1" "F1"}) (place "Ferz_noCross1" coord:"D1") (place "King_noCross1" coord:"E1") (place "Rook2" {"A8" "H8"}) (place "Knight2" {"B8" "G8"}) (place "Elephant2" {"C8" "F8"}) (place "Ferz_noCross2" coord:"D8") (place "King_noCross2" coord:"E8")}) phases:{ (phase "OpeningCounselor" (play (forEach Piece "Ferz_noCross" (move Hop Forward (between if:True) (to if:(is Empty (to)) (apply (remove (to))))))) (nextPhase Mover "OpeningSoldier")) (phase "OpeningSoldier" (play (forEach Piece "Pawn" (if (is In (from) (sites {"D2" "D7"})) (move Hop Forward (between if:True) (to if:(is Empty (to)) (apply (remove (to)))))))) (nextPhase Mover "Playing")) (phase "Playing" (play (if "SameTurn" (move Promote (last To) (piece "Ferz_noCross") Mover) (do (forEach Piece) ifAfterwards:(not ("IsInCheck" "King_noCross" Mover))))))} (end { ("Checkmate" "King_noCross") ("BlockWin")}))) END
Construct a Ludii game based on the following description 2x7 board. Six counters in each hole. Play begins from any one of a player's holes, even if there is just one. Sowing occurs in an anti-clockwise direction. If they end in a hole with counters, these are picked up and sowing continues. If sowing ends in an empty hole, the contents of the next hole are captured and the turn ends. When sowing, if the contents of a hole are brought to four, they are immediately captured by the player in whose row the counters are located. Play ends when a player has no counters in their holes, remaining player takes all the remaining counters. In the next round, the player with the smaller number of counters captured from the previous round fills as many of their holes as they can, starting from the left and filling each hole with six counters. Leftover counters are placed in the player's store. The opponent then does the same. Any holes remaining empty are out of play for this round, otherwise play continues as before. The right to begin alternates from round to round. Further rounds are played until one player has fewer than six counters. ###
(define "NextHoleFrom" ("NextSiteOnTrack" #2 from:#1)) (define "LeftMostEmpty" (trackSite FirstSite from:(mapEntry "LeftMost" Mover) if:(is Empty (to)))) (define "OneRowIsEmpty" (or (all Sites (sites Bottom) if:(= 0 (count at:(site)))) (all Sites (sites Top) if:(= 0 (count at:(site)))))) (define "PlayableSites" (sites (values Remembered "Playable"))) (define "PiecesOwnedBy" (+ (count at:(mapEntry #1)) (count in:(sites #1)))) (game "Pallankuli" (players 2) (equipment { (mancalaBoard 2 7 store:None (track "Track" "0,E,N,W" loop:True)) (piece "Seed" Shared) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (map "LeftMost" {(pair P1 0) (pair P2 13)}) (hand Each)}) (rules (start { (set Count 6 to:(sites Track)) (set RememberValue "Playable" (union (sites Top) (sites Bottom)))}) phases:{ (phase "Sowing" (play (or { (move Select (from (if ("SameTurn") (sites {(var "Replay")}) (sites Mover)) if:(and (is Occupied (from)) (is In (from) ("PlayableSites")))) (then (do (set Var "NumSowed" (count at:(last To))) next:(sow apply:(if (and (!= 4 (count at:(to))) (< 1 (count at:(to)))) (and (moveAgain) (set Var "Replay" (to))) (if (= 1 (count at:(to))) (if (is Occupied ("NextHoleFrom" (to) 1)) (fromTo (from ("NextHoleFrom" (to) 1)) (to (handSite Mover)) count:(count at:("NextHoleFrom" (to) 1)))))) skipIf:(not (is In (to) ("PlayableSites")))) (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 (if (is In (to) (sites P1)) (handSite P1) (handSite P2))) count:4))) (set Var "NumSowed" 0))))))} (then (if ("OneRowIsEmpty") (and { (forEach Site (sites P1) (fromTo (from (site)) (to (handSite P1)) count:(count at:(site)))) (forEach Site (sites P2) (fromTo (from (site)) (to (handSite P2)) count:(count at:(site)))) (forget Value "Playable" All)}))))) (end (if ("NoPieceOnBoard") { (if (> 6 (count Cell at:(handSite P1))) (result P2 Win)) (if (> 6 (count Cell at:(handSite P2))) (result P1 Win))})) (nextPhase ("NoPieceOnBoard") "BetweenRounds")) (phase "BetweenRounds" (play (if (<= 6 (count Cell at:(handSite Mover))) (move (from (handSite Mover)) (to ("LeftMostEmpty") if:(is In (to) (sites Mover))) count:6 (then (remember Value "Playable" (last To)))))) (nextPhase (all Passed) "Sowing"))})) END
Modify the Ludii game according to the following option changes: A 8x8 board is currently selected -> A 6x6 board is currently selected (define "Step" (move Step (from) (to if:(and { (is Empty (to)) (= 0 (count Sites in:(difference (sites Around (to) Own Orthogonal) (sites {(from)})))) (not (and (< 0 (count Sites in:(sites Around (from) Enemy Orthogonal))) (= 0 (count Sites in:(sites Around (to) Enemy Orthogonal))))) (or { (and (= 0 (count Sites in:(sites Around (from) Enemy Orthogonal))) (< 0 (count Sites in:(sites Around (to) Enemy Orthogonal)))) (or { (and (or (= (from) (+ (to) 10)) (= (from) (- (to) 10))) ("Inward" N S)) (and (or (= (from) (+ (to) 1)) (= (from) (- (to) 1))) ("Inward" E W)) (and (or (= (from) (+ (to) (+ 10 1))) (= (from) (- (to) (+ 10 1)))) ("Inward" SW NE)) (and (or (= (from) (+ (to) (- 10 1))) (= (from) (- (to) (- 10 1)))) ("Inward" SE NW))})})})))) (define "Hop" (move Hop (from #1) Orthogonal (between if:(is Occupied (between)) (apply (remove (between)))) (to if:(and { (is Empty (to)) (= 0 (count Sites in:(sites Around (to) Own Orthogonal)))})) (then (and { (remove (sites Outer)) (set Var 1) (if (can Move (move Hop (from (last To)) Orthogonal (between if:(is Occupied (between)) (apply (remove (between)))) (to if:(and { (is Empty (to)) (= 0 (count Sites in:(sites Around (to) Own Orthogonal)))})))) (moveAgain) (set Var 0))})))) (define "Inward" (> (max (count Sites in:(sites Direction from:(from) #1)) (count Sites in:(sites Direction from:(from) #2))) (max (count Sites in:(sites Direction from:(to) #1)) (count Sites in:(sites Direction from:(to) #2))))) (game "Cage" (players 2) (equipment { (board (square 10)) (piece "Disc" Each)}) (rules (start { (place "Disc1" (difference (sites Phase 0) (sites Outer))) (place "Disc2" (difference (sites Phase 1) (sites Outer)))}) (play (forEach Piece (if (!= 1 (var)) (or ("Hop" ~) ("Step")) ("Hop" if:(= (from) (last To)))))) (end (if (or (= 0 (count Sites in:(sites Occupied by:P1))) (= 0 (count Sites in:(sites Occupied by:P2)))) (result Mover Win))))) ###
(define "Step" (move Step (from) (to if:(and { (is Empty (to)) (= 0 (count Sites in:(difference (sites Around (to) Own Orthogonal) (sites {(from)})))) (not (and (< 0 (count Sites in:(sites Around (from) Enemy Orthogonal))) (= 0 (count Sites in:(sites Around (to) Enemy Orthogonal))))) (or { (and (= 0 (count Sites in:(sites Around (from) Enemy Orthogonal))) (< 0 (count Sites in:(sites Around (to) Enemy Orthogonal)))) (or { (and (or (= (from) (+ (to) 8)) (= (from) (- (to) 8))) ("Inward" N S)) (and (or (= (from) (+ (to) 1)) (= (from) (- (to) 1))) ("Inward" E W)) (and (or (= (from) (+ (to) (+ 8 1))) (= (from) (- (to) (+ 8 1)))) ("Inward" SW NE)) (and (or (= (from) (+ (to) (- 8 1))) (= (from) (- (to) (- 8 1)))) ("Inward" SE NW))})})})))) (define "Hop" (move Hop (from #1) Orthogonal (between if:(is Occupied (between)) (apply (remove (between)))) (to if:(and { (is Empty (to)) (= 0 (count Sites in:(sites Around (to) Own Orthogonal)))})) (then (and { (remove (sites Outer)) (set Var 1) (if (can Move (move Hop (from (last To)) Orthogonal (between if:(is Occupied (between)) (apply (remove (between)))) (to if:(and { (is Empty (to)) (= 0 (count Sites in:(sites Around (to) Own Orthogonal)))})))) (moveAgain) (set Var 0))})))) (define "Inward" (> (max (count Sites in:(sites Direction from:(from) #1)) (count Sites in:(sites Direction from:(from) #2))) (max (count Sites in:(sites Direction from:(to) #1)) (count Sites in:(sites Direction from:(to) #2))))) (game "Cage" (players 2) (equipment { (board (square 8)) (piece "Disc" Each)}) (rules (start { (place "Disc1" (difference (sites Phase 0) (sites Outer))) (place "Disc2" (difference (sites Phase 1) (sites Outer)))}) (play (forEach Piece (if (!= 1 (var)) (or ("Hop" ~) ("Step")) ("Hop" if:(= (from) (last To)))))) (end (if (or (= 0 (count Sites in:(sites Occupied by:P1))) (= 0 (count Sites in:(sites Occupied by:P2)))) (result Mover Win))))) END
Describe the mechanics of the following Ludii game (define "Surrounded" (surround (from (last To)) Orthogonal (between if:(and (is In (between) (sites Corners)) ("IsEnemyAt" (between))) (apply (remove (between)))) (to if:("IsFriendAt" (to))))) (game "Dai Hasami Shogi" (players 2) (equipment { (board (square 9)) (piece "Marker" Each (or (move Slide Orthogonal) ("HopAllPiecesToEmpty" Orthogonal) (then (or ("CustodialCapture" Orthogonal (max 1)) "Surrounded")))) (regions P1 (expand (sites Bottom))) (regions P2 (expand (sites Top)))}) (rules (start { (place "Marker1" (sites P1)) (place "Marker2" (sites P2))}) (play (forEach Piece)) (end { (if (is Line 5 Orthogonal if:(not (is In (to) (sites Mover)))) (result Mover Win)) (if (and (< (count Pieces P1) 5) (< (count Pieces P2) 5)) (result Mover Draw))}))) ###
Played on a 9x9 board with nine Go pieces per player occupying their two nearest ranks. Pieces move as a rook in Shogi. Pieces may also move by hopping over an adjacent piece of any color. This does not capture the piece, and multiple hops are not allowed in on turn. The goal is to create an orthogonal line of five of a player's pieces outside the player's starting rows. The game is played on a Shogi board. END
Construct a Ludii game based on the following description 7x7 lines, intersecting to form a square. Diagonals are drawn in the four quadrants of the board. Two triangles, their apices intersecting the main board at opposite midpoints. The base of the triangle is bisected by a line drawn from the apex, and this line is bisected and intersects with the other two sides of the triangle. Twenty pieces per player, which begin on the points in the triangles and the first two rows of points in the square on the side closest to the player. Players alternate turns moving a piece to an empty adjacent spot along the lines of the board. A piece may capture an opponent's piece by hopping over it to an empty point on the opposite side of the opponent's piece along the lies of the board. Multiple captures are allowed. The player who captures all the opponent's pieces wins. ###
(game "Mughal Pathan" (players 2) (equipment { (board (add (merge { (square 7) (shift 1 6 (rotate 180 (wedge 3))) (shift 1 -2 (wedge 3))}) edges:{ {0 8} {8 16} {16 24} {24 32} {32 40} {40 48} {6 12} {12 18} {18 24} {24 30} {30 36} {36 42} {3 9} {9 15} {15 21} {21 29} {29 37} {37 45} {45 39} {39 33} {33 27} {27 19} {19 11} {11 3}}) use:Vertex) (piece "Marker" Each (or ("HopSequenceCapture") ("StepToEmpty")))}) (rules (start { (place "Marker1" (union (sites Bottom) (expand (sites Row 2)))) (place "Marker2" (union (sites Top) (expand (sites Row 8))))}) (play (if ("SameTurn") (or ("HopSequenceCaptureAgain") (move Pass)) (forEach Piece))) (end ("CaptureAll" Next)))) END
Construct a Ludii game based on the following description 4x9 board. Two counters in each hole. Players alternate turns sowing from one of the holes in their rows in an anti-clockwise direction. When a counter falls into a hole in their inner row, the player captures the counters from both of the opposite holes on the opponent's side of the board; if one of the two opposite holes is empty, no capture is made. Captures counters are sown on the player's side of the board. Play continues until one player captures all of the counters or one player forfeits. ###
(define "Columns" 9) (define "NoPieceNext" (= (count in:(sites Next "Home")) 0)) (define "LastHole" (last To afterConsequence:True)) (game "Ngolo" (players 2) (equipment { (mancalaBoard 4 "Columns" store:None { (track "Track1" "0,E,N1,W" loop:True P1) (track "Track2" "18,E,N1,W" loop:True P2)}) (regions "Home" P1 (sites Track "Track1")) (regions "Home" P2 (sites Track "Track2")) (regions "Inner" P1 (difference (sites Track "Track1") (sites Bottom))) (regions "Inner" P2 (difference (sites Track "Track2") (sites Top))) (piece "Seed" Shared)}) (rules (start (set Count 2 to:(union (sites P1 "Home") (sites P2 "Home")))) (play (or (move Pass) (move Select (from (sites Mover "Home") if:(< 0 (count at:(from)))) (then (sow "Track" owner:(mover) apply:(if (and { (!= (count at:("OppositeOuterPit" (to))) 0) (!= (count at:("OppositePit" (to))) 0) (is In (to) (sites Mover "Inner"))}) (and { (fromTo (from ("OppositeOuterPit" (to))) (to (to)) count:(count at:("OppositeOuterPit" (to)))) (fromTo (from ("OppositePit" (to))) (to (to)) count:(count at:("OppositePit" (to)))) (sow (to) count:(+ (count at:("OppositePit" (to))) (count at:("OppositeOuterPit" (to)))) "Track" owner:(mover))}))))))) (end { (if ("NoPieceNext") (result Mover Win)) (if (was Pass) (result Next Win))}))) END
Construct a Ludii game based on the following description Play begins with six counters in each hole. Sowing is anti-clockwise. If the last counter of a sowing lands in the player's own hole making it even, the counters are captured. If the contents of the hole before it is also even, these are also taken, continuing until an odd or empty hole is reached. If the last counter makes a hole odd, the turn ends. If a player has no counters in their holes at the end of the turn, the opponent must play so that the player can play on the next turn. Play ends when neither player is able to move; the last player who was able to move takes the remaining counters and the player with the most counters captured wins. ###
(define "PiecesOwnedBy" (+ (count Cell at:(handSite #1)) (count in:(sites #1)))) (game "Halusa" (players 2) (equipment { (mancalaBoard 2 6 store:None (track "Track" "0,E,N,W" loop:True)) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (piece "Seed" Shared) (hand Each)}) (rules (start (set Count 6 to:(sites Track))) (play (do (move Select (from (sites Mover) if:(> (count at:(from)) 0)) (then (sow if:(and (is In (to) (sites Mover)) (is Even (count at:(to)))) apply:(fromTo (from (to)) (to (handSite Mover)) count:(count at:(to))) backtracking:True))) ifAfterwards:(> (count in:(sites Next)) 0))) (end ("MancalaByScoreWhen" (no Moves Mover))))) END
Construct a global Ludii definition which fulfills the following requirements. Checks if a specific piece type reached a region and makes a player is wining. This ludemeplex can be used only in an ending condition. ###
(define "PieceTypeReachWin" (if (is Within (id #1) in:#2) (result #3 Win))) END
Construct a Ludii game based on the following description 2x6 board with two stores. Four counters in each hole. Sowing occurs in an anti-clockwise direction. When the final counter lands in a hole containing one or two counters, thus making it contain two or three counters, these are captured. When this capture is made, other holes with two or three counters in them, in an uninterrupted sequence behind the hole from which the first capture was made, are captured. The player who captures the most counters wins. ###
(define "PiecesOwnedBy" (+ (count Cell at:(mapEntry #1)) (count in:(sites #1)))) (game "Adidada" (players 2) (equipment { (mancalaBoard 2 6 (track "Track" "1,E,N,W" loop:True)) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (map {(pair P1 FirstSite) (pair P2 LastSite)}) (piece "Seed" Shared)}) (rules (start (set Count 4 to:(sites Track))) (play (move Select (from (sites Mover) if:(< 0 (count at:(from)))) (then (sow if:(and (is In (to) (sites Next)) (or (= (count at:(to)) 2) (= (count at:(to)) 3))) apply:(fromTo (from (to)) (to (mapEntry (mover))) count:(count at:(to))) backtracking:True)))) (end ("MancalaByScoreWhen" (no Moves Mover))))) END
Construct a global Ludii definition which fulfills the following requirements. Defines backgammon tracks following the same direction for each player in using the hands of the players. ###
(define "BackgammonTracksSameDirectionWithHands" { (track "Track1" {26 25..20 18..13 0..5 7..12 #1} P1 directed:True) (track "Track2" {27 25..20 18..13 0..5 7..12 #1} P2 directed:True)}) END
Modify the Ludii game according to the following option changes: A 3x3 board is currently selected -> A 4x4 board is currently selected (define "UpdateScores" (and (set Score P1 (count Sites in:(forEach (sites Phase 1) if:(is Occupied (site))))) (set Score P2 (count Sites in:(forEach (sites Phase 0) if:(is Occupied (site))))))) (define "DistanceToEndSquare" (count Sites in:(sites Direction from:(last From) ("LastDirection" Cell) stop:(is Empty (to)) distance:(size Stack at:(last From))))) (define "EnoughSpaceInDirection" (<= (size Stack at:(from)) (count Sites in:(sites Direction from:(from) (directions Cell from:(from) to:#1) distance:(size Stack at:(from)))))) (define "ZeroEmptyInRangeInDirection" (= 0 (count Sites in:(intersection (sites Empty) (sites Direction from:(from) (directions Cell from:(from) to:#1) distance:(size Stack at:(from))))))) (define "ContainedMove" (move Select (from (sites Occupied by:P1)) (to (sites Around (from) NotEmpty) if:(and (or ("EnoughSpaceInDirection" (to)) ("ZeroEmptyInRangeInDirection" (to))) (all Sites (sites Around (from) NotEmpty) if:(not (and (< (count Sites in:(sites Direction from:(from) (directions Cell from:(from) to:(to)) stop:(is Empty (to)) distance:(size Stack at:(from)))) (count Sites in:(sites Direction from:(from) (directions Cell from:(from) to:(site)) stop:(is Empty (to)) distance:(size Stack at:(from))))) (or ("EnoughSpaceInDirection" (site)) ("ZeroEmptyInRangeInDirection" (site)))))))) (then (forEach Site (sites Direction from:(last From) ("LastDirection" Cell) stop:(is Empty (to)) distance:(size Stack at:(last From))) (if (= ("DistanceToEndSquare") (count Steps (last From) (site))) (add (piece "Disc1") (to (site)) count:(- (size Stack at:(last From)) (- ("DistanceToEndSquare") 1)) stack:True) (add (piece "Disc1") (to (site)) stack:True)))))) (define "OverflowMove" (move Select (from (sites Occupied by:P1)) (to (sites Around (from)) if:(and (not ("EnoughSpaceInDirection" (to))) (not ("ZeroEmptyInRangeInDirection" (to))))) (then (forEach Site (sites Direction from:(last From) ("LastDirection" Cell) distance:(size Stack at:(last From))) (add (piece "Disc1") (to (site)) stack:True))))) (game "Overflow" (players 2) (equipment { (board (square 3)) (piece "Disc" P1)}) (rules (start { (place "Disc1" (sites Board)) (set Score P1 (count Sites in:(sites Phase 1))) (set Score P2 (count Sites in:(sites Phase 0)))}) (play (do (or ("ContainedMove") ("OverflowMove") (then (remove (last From) count:(size Stack at:(last From))))) ifAfterwards:(= 1 (count Groups)) (then ("UpdateScores")))) (end (if (= 0 (* (score P1) (score P2))) (byScore))))) ###
(define "UpdateScores" (and (set Score P1 (count Sites in:(forEach (sites Phase 1) if:(is Occupied (site))))) (set Score P2 (count Sites in:(forEach (sites Phase 0) if:(is Occupied (site))))))) (define "DistanceToEndSquare" (count Sites in:(sites Direction from:(last From) ("LastDirection" Cell) stop:(is Empty (to)) distance:(size Stack at:(last From))))) (define "EnoughSpaceInDirection" (<= (size Stack at:(from)) (count Sites in:(sites Direction from:(from) (directions Cell from:(from) to:#1) distance:(size Stack at:(from)))))) (define "ZeroEmptyInRangeInDirection" (= 0 (count Sites in:(intersection (sites Empty) (sites Direction from:(from) (directions Cell from:(from) to:#1) distance:(size Stack at:(from))))))) (define "ContainedMove" (move Select (from (sites Occupied by:P1)) (to (sites Around (from) NotEmpty) if:(and (or ("EnoughSpaceInDirection" (to)) ("ZeroEmptyInRangeInDirection" (to))) (all Sites (sites Around (from) NotEmpty) if:(not (and (< (count Sites in:(sites Direction from:(from) (directions Cell from:(from) to:(to)) stop:(is Empty (to)) distance:(size Stack at:(from)))) (count Sites in:(sites Direction from:(from) (directions Cell from:(from) to:(site)) stop:(is Empty (to)) distance:(size Stack at:(from))))) (or ("EnoughSpaceInDirection" (site)) ("ZeroEmptyInRangeInDirection" (site)))))))) (then (forEach Site (sites Direction from:(last From) ("LastDirection" Cell) stop:(is Empty (to)) distance:(size Stack at:(last From))) (if (= ("DistanceToEndSquare") (count Steps (last From) (site))) (add (piece "Disc1") (to (site)) count:(- (size Stack at:(last From)) (- ("DistanceToEndSquare") 1)) stack:True) (add (piece "Disc1") (to (site)) stack:True)))))) (define "OverflowMove" (move Select (from (sites Occupied by:P1)) (to (sites Around (from)) if:(and (not ("EnoughSpaceInDirection" (to))) (not ("ZeroEmptyInRangeInDirection" (to))))) (then (forEach Site (sites Direction from:(last From) ("LastDirection" Cell) distance:(size Stack at:(last From))) (add (piece "Disc1") (to (site)) stack:True))))) (game "Overflow" (players 2) (equipment { (board (square 4)) (piece "Disc" P1)}) (rules (start { (place "Disc1" (sites Board)) (set Score P1 (count Sites in:(sites Phase 1))) (set Score P2 (count Sites in:(sites Phase 0)))}) (play (do (or ("ContainedMove") ("OverflowMove") (then (remove (last From) count:(size Stack at:(last From))))) ifAfterwards:(= 1 (count Groups)) (then ("UpdateScores")))) (end (if (= 0 (* (score P1) (score P2))) (byScore))))) END
Modify the Ludii game according to the following option changes: The game involves a pile of 5 pieces. -> The game involves a pile of 10 pieces. (define "NumRemove" (+ 1 (count MovesThisTurn))) (define "Max" (if (= 1 (count Turns)) (- 5 1) (* 2 (value Player (prev MoverLastTurn))))) (game "Fibonacci Nim" (players 2) (equipment { (board (square 1)) (piece "Marker" Neutral)}) (rules (start (set Count 5 at:0)) (play (if "SameTurn" (or (if (<= "NumRemove" "Max") (move Select (from (last To)) (then (if (= (count at:(last To)) 1) (remove (last To)) (and (set Count at:(last To) (- (count at:(last To)) 1)) (moveAgain)))))) (move Pass (then (set Value Mover (- ("NumRemove") 1))))) (move Select (from (sites Occupied by:Neutral)) (then (if (= (count at:(last To)) 1) (remove (last To)) (and (set Count at:(last To) (- (count at:(last To)) 1)) (moveAgain))))))) (end (if (no Moves Next) (result Mover Win))))) ###
(define "NumRemove" (+ 1 (count MovesThisTurn))) (define "Max" (if (= 1 (count Turns)) (- 10 1) (* 2 (value Player (prev MoverLastTurn))))) (game "Fibonacci Nim" (players 2) (equipment { (board (square 1)) (piece "Marker" Neutral)}) (rules (start (set Count 10 at:0)) (play (if "SameTurn" (or (if (<= "NumRemove" "Max") (move Select (from (last To)) (then (if (= (count at:(last To)) 1) (remove (last To)) (and (set Count at:(last To) (- (count at:(last To)) 1)) (moveAgain)))))) (move Pass (then (set Value Mover (- ("NumRemove") 1))))) (move Select (from (sites Occupied by:Neutral)) (then (if (= (count at:(last To)) 1) (remove (last To)) (and (set Count at:(last To) (- (count at:(last To)) 1)) (moveAgain))))))) (end (if (no Moves Next) (result Mover Win))))) END
Describe the mechanics of the following Ludii game (define "StepMove" (move Step #1 (to if:(and (= 0 (state at:(to))) (if (< (count MovesThisTurn) 2) (is Empty (to)) (is In (to) (union (sites Occupied by:Next) (sites Empty))))) (apply (if ("IsEnemyAt" (to)) (remove (to))))) (then (if (= 2 (count Sites in:(forEach (sites Board) if:(= 1 (state at:(site)))))) (forEach Site (sites Board) (if (= 1 (state at:(site))) (set State at:(site) 0))) (and (set State at:(last From) 1) (moveAgain)))))) (game "Boxijn Barildaan" (players 2) (equipment { (board (merge { (shift 1 0 (rectangle 4 2)) (shift 0 1 (rectangle 2 4))}) use:Vertex) (piece "Marker" Each ("StepMove"))}) (rules (start { (place "Marker1" (expand (sites Bottom))) (place "Marker2" (expand (sites Top)))}) (play (if ("SameTurn") ("StepMove" (from (last To))) (forEach Piece))) (end ("CaptureAll" Next)))) ###
Four squares, arranged in a cross shape. The game is played along the lines. Four pieces per player, which begin on the corners of a square, opposite the square where the opponent's pieces are arranged. Players alternate turns moving their pieces. Pieces move three spaces along the lines on the board, capturing any piece on the third. The first two spaces in the move must be empty. Pieces may change direction in a turn, as long as the lines are followed and there is no backtracking. The player who captures all of the opponent's pieces wins. END
Modify the Ludii game according to the following option changes: The game is played on the Graph2. -> The game is played on the Graph3. The players play on HackenbushR-B version. -> The players play on HackenbushR-G-B version. (define "Ground" (sites Bottom)) (define "NotConnectedToTheGround" (= 0 (count Sites in:(intersection ("Ground") (sites Group Edge at:(site) if:(is Occupied (to))))))) (define "RemoveCutBranch" (forEach Site (sites Group Edge at:(site)) (remove Edge (site)))) (game "Hackenbush" (players 2) (equipment { (board (graph vertices:{ {0 0} {2 0} {4 0} {6 0} {8 0} {10 0} {15 0} {4 2} {6 2} {10 2} {6 3} {4 4} {3 4} {3 5} {4 5} {6 5} {6 6} {7 6} {8 3} {8 4} {9 4} {9 5} {10 5} {10 4}} edges:{ {0 1} {1 2} {2 3} {4 3} {4 5} {6 5} {2 7} {3 8} {5 9} {8 10} {10 11} {11 12} {11 13} {11 14} {10 15} {15 16} {17 15} {8 18} {18 19} {18 20} {20 21} {20 22} {20 23}}) use:Edge) (piece "Marker" Each) (piece "Disc" Shared) (piece "Cross" Neutral) (regions All (expand (sites Bottom)))}) (rules (start { (set Neutral Edge ("Ground")) (set P1 Edge (sites {6..12})) (set P2 Edge (difference (sites Board Edge) (union (sites {6..12}) (sites {0..5}))))}) (play (move Remove (sites Occupied by:Mover) (then (forEach Site (sites Incident Edge of:Edge at:(last To)) (if ("NotConnectedToTheGround") ("RemoveCutBranch")))))) (end (if (no Moves Mover) (result Next Win))))) ###
(define "Ground" (sites Bottom)) (define "NotConnectedToTheGround" (= 0 (count Sites in:(intersection ("Ground") (sites Group Edge at:(site) if:(is Occupied (to))))))) (define "RemoveCutBranch" (forEach Site (sites Group Edge at:(site)) (remove Edge (site)))) (game "Hackenbush" (players 2) (equipment { (board (graph vertices:{ {0 0} {2 0} {4 0} {6 0} {8 0} {10 0} {15 0} {5 1} {4 3} {5 5} {9 1} {7 3} {7 5} {3 6} {10 4} {7 8} {8 11} {10 10} {10 9} {5 10} {4 11} {3 11} {3 12} {4 12} {7 12} {9 12} {8 13} {9 14} {11 14} {11 12} {13 12}} edges:{ {0 1} {1 2} {2 3} {4 3} {4 5} {6 5} {2 7} {7 8} {8 9} {4 10} {10 11} {11 12} {9 13} {9 12} {12 14} {13 15} {14 15} {15 16} {16 19} {19 20} {20 21} {21 22} {22 23} {20 23} {16 17} {17 18} {16 24} {24 26} {16 25} {25 26} {26 27} {27 28} {28 29} {29 30}}) use:Edge) (piece "Marker" Each) (piece "Disc" Shared) (piece "Cross" Neutral) (regions All (expand (sites Bottom)))}) (rules (start { (set Neutral Edge ("Ground")) (set P1 Edge (sites {6 8 10})) (set P2 Edge (sites {9 12 13})) (set Shared Edge (difference (sites Board Edge) (union (union (sites {6 8 10}) (sites {0..5})) (sites {9 12 13}))))}) (play (move Remove (difference (sites Occupied by:All on:Edge) (union (sites Occupied by:Neutral on:Edge) (sites Occupied by:Next on:Edge))) (then (forEach Site (sites Incident Edge of:Edge at:(last To)) (if ("NotConnectedToTheGround") ("RemoveCutBranch")))))) (end (if (no Moves Mover) (result Next Win))))) END
Construct a Ludii game based on the following description 8x8 board. The pieces move as follows, with the number per player: 1 x Shah (king): moves one space orthogonally or diagonally. 1 x Fers (counselor): One square diagonally or, one the first turn, may jump two squares diagonally or orthogonally, over any pieces on the first square. There can be no capture with this move. 2 x Rukh (rook): Any number of spaces orthogonally. 2 x Pil (elephant): Two squares diagonally, jumping over the first. 2 x Asb (horse): Moves as a chess knight. 8 x Sarbaz (soldier): Moves one space forward orthogonally; one space forward diagonally to capture. No en passant. Promoted to Fers when reaching the eighth rank. On its first move, this promoted piece may also use the jumping move of the Fers. No castling. An opponent's piece is captured by moving a player's own piece onto a space occupied by the opponent's piece. When a Shah can be captured on the next turn by an opponent's piece, it is in check. The Shah must not be in check at the end of the player's turn. If this is not possible, it is checkmate and the opponent wins. Stalemate results in a win for that player causing it. ###
(define "RememberMoved" (set State at:#1 1)) (define "MovedBefore" (= 1 (state at:#1))) (game "Shatranj (Turkey)" ("TwoPlayersNorthSouth") (equipment { (board (square 8)) ("ChessKing" "King_noCross") (piece "Ferz_noCross" (or ("StepToNotFriend" Diagonal) (if (not ("MovedBefore" (from))) (move Hop (between if:True) (to if:(is Empty (to))))) (then (if (not ("MovedBefore" (last To))) ("RememberMoved" (last To)))))) (piece "Elephant" (move Hop Diagonal (between if:True) (to if:(not ("IsFriendAt" (to))) (apply (if ("IsEnemyAt" (to)) (remove (to))))))) ("ChessKnight" "Knight") ("ChessRook" "Rook") ("ChessPawn" "Pawn" ~ (then ("PromoteIfReach" (sites Mover "Promotion") "Ferz_noCross"))) (regions "Promotion" P1 (sites Top)) (regions "Promotion" P2 (sites Bottom))}) (rules (start { (place "Pawn1" (sites Row 1)) (place "Pawn2" (sites Row 6)) (place "Rook1" {"A1" "H1"}) (place "Knight1" {"B1" "G1"}) (place "Elephant1" {"C1" "F1"}) (place "Ferz_noCross1" coord:"D1") (place "King_noCross1" coord:"E1") (place "Rook2" {"A8" "H8"}) (place "Knight2" {"B8" "G8"}) (place "Elephant2" {"C8" "F8"}) (place "Ferz_noCross2" coord:"D8") (place "King_noCross2" coord:"E8")}) (play (do (forEach Piece) ifAfterwards:(not ("IsInCheck" "King_noCross" Mover)))) (end { ("Checkmate" "King_noCross") (if (no Moves Mover) (result Mover Loss))}))) END
Construct a Ludii game based on the following description There is a large number of akṣas (beans) in a container, divisible by five. One player grasps a random number of them, and throws them onto a mat. The beans grabbed by the player is a \ The game is played with the rules of Syed. ###
(define "Treta" (= 3 (% (count at:#1) 4))) (define "Dvapara" (= 2 (% (count at:#1) 4))) (define "Kali" (= 1 (% (count at:#1) 4))) (define "Krta" (= 0 (% (count at:#1) 4))) (game "Aksadyuta" (players 2) (equipment { (board (square 1)) (piece "Bean" Shared) (hand Each)}) (rules (start (place "Bean" 0 count:55)) (play (move (from (sites Board)) (to (handSite Mover)) count:(value Random (range 1 (count at:0))))) (end { (if (is Mover P2) { (if (and ("Krta" (handSite P1)) (not ("Krta" (handSite P2)))) (result P1 Win)) (if (and ("Krta" (handSite P2)) (not ("Krta" (handSite P1)))) (result P2 Win)) (if (and ("Kali" (handSite P1)) (not ("Kali" (handSite P2)))) (result P1 Loss)) (if (and ("Kali" (handSite P2)) (not ("Kali" (handSite P1)))) (result P2 Loss)) (if (and ("Treta" (handSite P1)) ("Dvapara" (handSite P2))) (result P1 Win)) (if (and ("Treta" (handSite P2)) ("Dvapara" (handSite P1))) (result P2 Win)) (if (and ("Krta" (handSite P1)) ("Krta" (handSite P2))) (result Mover Draw)) (if (and ("Kali" (handSite P1)) ("Kali" (handSite P2))) (result Mover Draw)) (if (and ("Dvapara" (handSite P1)) ("Dvapara" (handSite P2))) (result Mover Draw)) (if (and ("Treta" (handSite P1)) ("Treta" (handSite P2))) (result Mover Draw))})}))) END
Construct a global Ludii definition which fulfills the following requirements. Defines an intervene capture in all the directions specified (by default Adjacent). The enemy piece is removed. ###
(define "InterveneCapture" (intervene (from (last To)) #1 (to if:("IsEnemyAt" (to)) (apply (remove (to)))) #2)) END
Modify the Ludii game according to the following option changes: 12 Holes per row. -> 15 Holes per row. (define "NextHoleFrom" ("NextSiteOnTrack" 1 from:#1 #2)) (define "AHoleHasMoreThanOneCounter" (not (all Sites (forEach (sites Mover) if:(< 1 (count at:(site)))) if:(= 0 (count at:(site)))))) (define "NoPiece" (all Sites (sites Player "Home") if:(= 0 (count at:(site))))) (define "Columns" 12) (game "Tsoro" (players 2) (equipment { (mancalaBoard 4 "Columns" store:None { (track "Track1" "0,E,N1,W" loop:True P1) (track "Track2" "24,E,N1,W" loop:True P2)}) (regions "Home" P1 (sites Track "Track1")) (regions "Home" P2 (sites Track "Track2")) (regions "Inner" P1 (difference (sites Track "Track1") (sites Bottom))) (regions "Inner" P2 (difference (sites Track "Track2") (sites Top))) (piece "Seed" Shared)}) (rules (start (set Count 2 to:(union (sites Top) (sites Bottom)))) (play (move Select (from (if ("SameTurn") "LastHoleSowed" (sites Mover "Home")) if:(if "AHoleHasMoreThanOneCounter" (> (count at:(from)) 1) (and (= (count at:(from)) 1) (= 0 (count at:("NextHoleFrom" (from) Mover)))))) (then (sow "Track" owner:(mover) apply:(if (= (count at:(to)) 1) (if (is In (to) (sites Mover "Inner")) (if (> (count at:("OppositePit" (to))) 0) (and (remove ("OppositePit" (to))) (if (> (count at:("OppositeOuterPit" (to))) 0) (remove ("OppositeOuterPit" (to))))))) (moveAgain)))))) (end (forEach NonMover if:("NoPiece") (result Player Loss))))) ###
(define "NextHoleFrom" ("NextSiteOnTrack" 1 from:#1 #2)) (define "AHoleHasMoreThanOneCounter" (not (all Sites (forEach (sites Mover) if:(< 1 (count at:(site)))) if:(= 0 (count at:(site)))))) (define "NoPiece" (all Sites (sites Player "Home") if:(= 0 (count at:(site))))) (define "Columns" 15) (game "Tsoro" (players 2) (equipment { (mancalaBoard 4 "Columns" store:None { (track "Track1" "0,E,N1,W" loop:True P1) (track "Track2" "30,E,N1,W" loop:True P2)}) (regions "Home" P1 (sites Track "Track1")) (regions "Home" P2 (sites Track "Track2")) (regions "Inner" P1 (difference (sites Track "Track1") (sites Bottom))) (regions "Inner" P2 (difference (sites Track "Track2") (sites Top))) (piece "Seed" Shared)}) (rules (start (set Count 2 to:(union (sites Top) (sites Bottom)))) (play (move Select (from (if ("SameTurn") "LastHoleSowed" (sites Mover "Home")) if:(if "AHoleHasMoreThanOneCounter" (> (count at:(from)) 1) (and (= (count at:(from)) 1) (= 0 (count at:("NextHoleFrom" (from) Mover)))))) (then (sow "Track" owner:(mover) apply:(if (= (count at:(to)) 1) (if (is In (to) (sites Mover "Inner")) (if (> (count at:("OppositePit" (to))) 0) (and (remove ("OppositePit" (to))) (if (> (count at:("OppositeOuterPit" (to))) 0) (remove ("OppositeOuterPit" (to))))))) (moveAgain)))))) (end (forEach NonMover if:("NoPiece") (result Player Loss))))) END
Describe the mechanics of the following Ludii game (define "RevealAPiece" (move Select (from (sites Hidden What to:Mover)) (then (and { (set Hidden What at:(last To) False to:P1) (set Hidden Who at:(last To) False to:P1) (set Hidden What at:(last To) False to:P2) (set Hidden Who at:(last To) False to:P2) #1})))) (define "StepMove" (move Step Orthogonal (to if:(or (is Empty (to)) (and { (not (is Hidden What at:(to) to:Mover)) ("IsEnemyAt" (to)) (or ("ZuMovingOnJiang") (and ("HigherValue") (not ("JiangMovingOnZu"))))})) (apply (remove (to)))))) (define "JiangMovingOnZu" (and ("IsPieceAt" "Jiang" Mover (from)) ("IsPieceAt" "Zu" Next (to)))) (define "ZuMovingOnJiang" (and ("IsPieceAt" "Zu" Mover (from)) ("IsPieceAt" "Jiang" Next (to)))) (define "HigherValue" (>= (value Piece at:(from)) (value Piece at:(to)))) (game "Banqi" (players 2) (equipment { (board (rectangle 4 8)) (piece "Jiang" Each ("StepMove")) (piece "Ju" Each ("StepMove")) (piece "Ma" Each ("StepMove")) (piece "Pao" Each ("StepMove")) (piece "Shi" Each ("StepMove")) (piece "Xiang" Each ("StepMove")) (piece "Zu" Each ("StepMove"))}) (rules (start { (place Random {"Zu1"} count:5 value:1) (place Random {"Zu2"} count:5 value:1) (place Random {"Pao1"} count:2 value:4) (place Random {"Pao2"} count:2 value:4) (place Random {"Ju1"} count:2 value:6) (place Random {"Ju2"} count:2 value:6) (place Random {"Ma1"} count:2 value:5) (place Random {"Ma2"} count:2 value:5) (place Random {"Xiang1"} count:2 value:2) (place Random {"Xiang2"} count:2 value:2) (place Random {"Shi1"} count:2 value:3) (place Random {"Shi2"} count:2 value:3) (place Random {"Jiang1"} count:1 value:7) (place Random {"Jiang2"} count:1 value:7) (set Hidden {What Who} (sites Board) to:P1) (set Hidden {What Who} (sites Board) to:P2)}) phases:{ (phase "Opening" P1 (play ("RevealAPiece" (set NextPlayer (player (who at:(last To)))))) (nextPhase Mover "Play")) (phase "Play" (play (or (forEach Piece) ("RevealAPiece"))))} (end ("BlockWin")))) ###
The 32 pieces are shuffled and randomly allocated face-down to squares on the board. The first player turns up a piece to begin the game. The color of that first uncovered piece is the color he or she will play in the game. The second player then makes a move, and the two alternate until the game is finished. There are three kinds of moves. A player may turn a piece face-up, move a piece, or capture an enemy piece. In some game variants, multiple captures may be made in one turn. Turning a piece face-up is a legal move if there are any face-down pieces on the board. Once revealed, a piece may move, capture, or be captured. A player may only move face-up pieces of their own color. Unlike Xiangqi, all pieces move identically: a piece may move only one square up, down, left, or right. A piece may never move onto a square that is already occupied unless such a move is a legal capture. A player may only capture with a face-up piece of their own color, and may only capture a face-up piece of the opposing color. In all captures, the captured piece is removed from the board and its square is occupied by the capturing piece. The pieces are ranked, forming a hierarchy with the general at the top and soldiers at the bottom. Only pieces of equal or lower rank may be captured, with one exception. For instance, a chariot may capture a horse, and the general may capture either, but a horse cannot capture a chariot, and neither can capture the general. The one exception concerns generals and soldiers: the general cannot capture soldiers, and soldiers can capture the general. In the Hong Kong version, the pieces are ranked in this order: General>Chariot>Horse>Cannon, Advisor>Minster>Soldier. This ranking reflects the approximate value of the corresponding pieces in Xiangqi (though the relative rank of horse and cannon is arguable). All pieces capture exactly as they move: one square up, down, left, or right. The game ends when a player cannot move, and that player is the loser. Most often, the game is lost because all of a player's pieces have been captured and so he has no pieces to move. However, it is possible for one player to surround all of the other player's remaining pieces in a manner that makes it impossible for them to move. END
Modify the Ludii game according to the following option changes: The board in Wikipedia. -> The board in Wikipedia. (define "MinotaurThreat" ("GoCloserToTheseus" E ("GoCloserToTheseus" W ("GoCloserToTheseus" N ("GoCloserToTheseus" S))) (then ("MinotaurThreatAgain")))) (define "MinotaurThreatAgain" ("GoCloserToTheseus" E ("GoCloserToTheseus" W ("GoCloserToTheseus" N ("GoCloserToTheseus" S))))) (define "GoCloserToTheseus" (if (and ("NoEdgeBetweenCells" (where (id "Minotaur0")) (ahead (where (id "Minotaur0")) #1)) ("OriginalCloserToTheseus" #1)) ("MoveMinotaur" #1) #2 #3)) (define "MoveMinotaur" (fromTo (from (where (id "Minotaur0"))) (to (ahead (from) #1) (apply (if (= (id "Theseus") (what at:(to))) (remove (to))))))) (define "SmartCloserToTheseus" (> (count Steps (step (from (where (id "Minotaur0"))) Orthogonal (to if:("NoEdgeBetweenCells" (from) (to)))) (where (id "Minotaur0")) (where (id "Theseus"))) (count Steps (step (from (ahead (where (id "Minotaur0")) #1)) Orthogonal (to if:("NoEdgeBetweenCells" (from) (to)))) (ahead (where (id "Minotaur0")) #1) (where (id "Theseus"))))) (define "OriginalCloserToTheseus" (> (count Steps Orthogonal (where (id "Minotaur0")) (where (id "Theseus"))) (count Steps Orthogonal (ahead (where (id "Minotaur0")) #1) (where (id "Theseus"))))) (define "NoEdgeBetweenCells" ("NoSites" (intersection (sites Occupied by:Shared on:Edge) ("EdgeInCommon" #1 #2)))) (define "EdgeInCommon" (intersection (sites Incident Edge of:Cell at:#1) (sites Incident Edge of:Cell at:#2))) (game "Theseus and the Minotaur" (players 1) (equipment { (board (rectangle 4 7)) (piece "Theseus" P1 (move Step Orthogonal (to if:(and (is Empty (to)) ("NoEdgeBetweenCells" (from) (to)))))) (piece "Minotaur" Neutral) (piece "Marker" Shared) (regions "Exit" {1})}) (rules (start { (place "Theseus" coord:"C3") (place "Minotaur0" coord:"A3") (set Shared Edge (union (sites Outer Edge) (sites {31 38 39 20 27 28})))}) (play (or (forEach Piece) (move Pass) (then (if (not (is In (where (id "Theseus")) (sites "Exit"))) ("MinotaurThreat"))))) (end { (if (no Pieces Mover) (result Mover Loss)) (if (is In (where (id "Theseus")) (sites "Exit")) (result Mover Win))}))) ###
(define "MinotaurThreat" ("GoCloserToTheseus" E ("GoCloserToTheseus" W ("GoCloserToTheseus" N ("GoCloserToTheseus" S))) (then ("MinotaurThreatAgain")))) (define "MinotaurThreatAgain" ("GoCloserToTheseus" E ("GoCloserToTheseus" W ("GoCloserToTheseus" N ("GoCloserToTheseus" S))))) (define "GoCloserToTheseus" (if (and ("NoEdgeBetweenCells" (where (id "Minotaur0")) (ahead (where (id "Minotaur0")) #1)) ("OriginalCloserToTheseus" #1)) ("MoveMinotaur" #1) #2 #3)) (define "MoveMinotaur" (fromTo (from (where (id "Minotaur0"))) (to (ahead (from) #1) (apply (if (= (id "Theseus") (what at:(to))) (remove (to))))))) (define "SmartCloserToTheseus" (> (count Steps (step (from (where (id "Minotaur0"))) Orthogonal (to if:("NoEdgeBetweenCells" (from) (to)))) (where (id "Minotaur0")) (where (id "Theseus"))) (count Steps (step (from (ahead (where (id "Minotaur0")) #1)) Orthogonal (to if:("NoEdgeBetweenCells" (from) (to)))) (ahead (where (id "Minotaur0")) #1) (where (id "Theseus"))))) (define "OriginalCloserToTheseus" (> (count Steps Orthogonal (where (id "Minotaur0")) (where (id "Theseus"))) (count Steps Orthogonal (ahead (where (id "Minotaur0")) #1) (where (id "Theseus"))))) (define "NoEdgeBetweenCells" ("NoSites" (intersection (sites Occupied by:Shared on:Edge) ("EdgeInCommon" #1 #2)))) (define "EdgeInCommon" (intersection (sites Incident Edge of:Cell at:#1) (sites Incident Edge of:Cell at:#2))) (game "Theseus and the Minotaur" (players 1) (equipment { (board (square 8)) (piece "Theseus" P1 (move Step Orthogonal (to if:(and (is Empty (to)) ("NoEdgeBetweenCells" (from) (to)))))) (piece "Minotaur" Neutral) (piece "Marker" Shared) (regions "Exit" {16})}) (rules (start { (place "Theseus" coord:"H5") (place "Minotaur0" coord:"A8") (set Shared Edge (union (sites Outer Edge) (sites {17 26 28 20 21 46 63 48 56 64 73 58 109 115 124 97 88})))}) (play (or (forEach Piece) (move Pass) (then (if (not (is In (where (id "Theseus")) (sites "Exit"))) ("MinotaurThreat"))))) (end { (if (no Pieces Mover) (result Mover Loss)) (if (is In (where (id "Theseus")) (sites "Exit")) (result Mover Win))}))) END
Construct a Ludii game based on the following description Three-Player Hex is played on the Hex board, typically with five cells per side. As in standard Hex, players take turn placing a piece of their color on an empty cell, and the first player to connect the opposite sides of the board marked his color with a chain of his pieces wins. As soon as it it no longer possible for a player to connect his edges, that player is eliminated from the game and may not place any more stones. The game is played on a 4x4 board The first player to connect his two sides wins. ###
(game "Three-Player Hex" (players 3) (equipment { (board (hex 4)) (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 Goal: Form an orthogonally connected path of friendly stones that surrounds at least one non-friendly stone. Set-up: Two stones, one of each colour, are placed next to each other adjacent to the center of the board. Then Black starts. Play: Each turn has two parts that both must be completed: A PLACEMENT and a SWAP. -- The PLACEMENT is made diagonally from a selected stone of the same color. -- The SWAP is done by exchanging the contents of the 2 cells that lie between the selected stone and the placed stone. For a SWAP to be valid, the contents of these cells must be different, i.e.: two stones of different color, or an empty space and a stone. If a turn cannot be completed with a placement to an empty position, the placement must be made by placing on top of an opponent's stone. The placement and swap rules apply to the visible stones and must still be followed. Voluntary passing is not allowed. When neither player can move, the game ends in a draw. To help visualise the moves, the 'Show Last Move' option shows an arrow from the placement site to the supporting friendly piece and the swap pieces are to either side of this arrow. Optional Variants: -- Larger Board to reduce the strategic effect of the edge cells. / Smaller board to focus on stacked play as a significant part of the game. -- Double move protocol for a shorter, more tactical game, that maintains a balance of material on every turn. Edge 343434 Hexagon Turns alternate ###
(define "DiagonalVector" (sites Around (from) Diagonal)) (define "UnconfinedStiesOf" (forEach (sites Board) if:(!= Infinity (count Steps Adjacent (step Adjacent (to if:(or (is Empty (to)) (is #1 (who at:(to)))))) (site) (sites Outer))))) (define "SetScoreOf" (set Score #1 (- 0 (count Sites in:(difference (sites Occupied by:#1) ("UnconfinedStiesOf" #1)))))) (define "MakeSwap" (if (is Empty ("SwapSite" 1)) (fromTo (from ("SwapSite" 0)) (to ("SwapSite" 1))) (if (is Empty ("SwapSite" 0)) (fromTo (from ("SwapSite" 1)) (to ("SwapSite" 0))) (set Var "Piece1" ("SwapPiece" 1) (then (add (piece ("SwapPiece" 0)) (to ("SwapSite" 1) (apply (remove (to)))) (then (add (piece (var "Piece1")) (to ("SwapSite" 0) (apply (remove (to)))))))))) (then (and { ("SetScoreOf" Mover) ("SetScoreOf" Next) (forget Value All)})))) (define "SwapPiece" (what at:("SwapSite" #1) level:(topLevel at:("SwapSite" #1)))) (define "SwapSite" (arrayValue (values Remembered) index:#1)) (define "Placement" (move Select (from #1 if:(> 2 (count Stack at:(from)))) (to "DiagonalVector" if:(and { (is In (to) (sites Occupied by:Mover top:True)) (= 2 (count Sites in:("SwapSites" (to) (from)))) (or (= 1 (count Sites in:(intersection ("SwapSites" (to) (from)) (sites Occupied by:Mover top:True)))) (= 1 (count Sites in:(intersection ("SwapSites" (to) (from)) (sites Occupied by:Next top:True)))))})) (then (and { (add (piece (id "Disc" Mover)) (to (last From)) stack:True) (forEach Site ("SwapSites" (last To) (last From)) (remember Value (site)))})))) (define "SwapSites" (intersection (sites Around #1 Adjacent) (sites Around #2 Adjacent))) (game "Veloop (Hex)" (players 2) (equipment { (board (renumber (rotate 90 (hex Limping 3))) use:Cell) (piece "Disc" Each)}) (rules (start { (place "Disc1" 10) (place "Disc2" 16)}) (play (priority ("Placement" (sites Empty)) ("Placement" (sites Occupied by:Next)) (then ("MakeSwap")))) (end (if (!= 0 (+ (score P1) (score P2))) (byScore))))) END
Construct a Ludii game based on the following description This is basically 4-player Othello, albeit more \ The game is playing with four players. ###
(define "ReverseBoundedPieces" (custodial (from (site)) (between if:(is Enemy (state at:(between))) (apply (allCombinations (add (piece "Ball0" state:(mover)) (to (site))) (set State at:(between) (mover))))) (to if:(is Friend (state at:(to)))))) (game "Rolit" (players 4) (equipment { (board (square 8)) (piece "Ball" Neutral)}) (rules (start { (place "Ball0" coord:"D5" state:1) (place "Ball0" coord:"E5" state:2) (place "Ball0" coord:"E4" state:3) (place "Ball0" coord:"D4" state:4)}) (play (priority (forEach Site (sites Empty) (append "ReverseBoundedPieces")) (move Add (piece "Ball0" state:(mover)) (to (sites Around (sites Occupied by:Neutral) Empty))) (then (forEach Player (set Score Player (count Sites in:(sites State (player)))))))) (end (if (all Passed) (byScore))))) END
Modify the Ludii game according to the following option changes: The mover loses if it does not have 2 pieces on each track. -> The mover loses if it does not have 3 pieces on each track. The game is played on the Kolowis Awithlaknannai board. -> The game is played on an experimental 6x9 board. (define "NPiecesOnTrack" (end (forEach Track if:(> #1 (count Pieces Mover in:(sites Track))) (result Mover Loss)))) (define "NoCaptureProposal" 101) (define "SlideToCapture" (move Slide "AllTracks" (between if:(or (= (between) (from)) (is Empty (between)))) (to if:("IsEnemyAt" (to)) (apply if:False (remove (to)))) (then (set Counter)))) (game "Surakarta" (players 2) (equipment { (surakartaBoard (square 7) loops:3) (piece "Marker" Each (or { (move Step All (to if:(is Empty (to)))) ("SlideToCapture")}))}) (rules (start { (place "Marker1" (expand (sites Bottom))) (place "Marker2" (expand (sites Top)))}) (play (if (is Proposed "End") (or (move Vote "End") (move Vote "No" (then (set Counter)))) (or (if (>= (counter) "NoCaptureProposal") (move Propose "End" (then (vote "End")))) (forEach Piece)))) ("NPiecesOnTrack" 2))) ###
(define "NPiecesOnTrack" (end (forEach Track if:(> #1 (count Pieces Mover in:(sites Track))) (result Mover Loss)))) (define "NoCaptureProposal" 101) (define "SlideToCapture" (move Slide "AllTracks" (between if:(or (= (between) (from)) (is Empty (between)))) (to if:("IsEnemyAt" (to)) (apply if:False (remove (to)))) (then (set Counter)))) (game "Surakarta" (players 2) (equipment { (surakartaBoard (rectangle 6 9)) (piece "Marker" Each (or { (move Step All (to if:(is Empty (to)))) ("SlideToCapture")}))}) (rules (start { (place "Marker1" (expand (sites Bottom))) (place "Marker2" (expand (sites Top)))}) (play (if (is Proposed "End") (or (move Vote "End") (move Vote "No" (then (set Counter)))) (or (if (>= (counter) "NoCaptureProposal") (move Propose "End" (then (vote "End")))) (forEach Piece)))) ("NPiecesOnTrack" 3))) END
Construct a Ludii game based on the following description 5x5 grid, with diagonals in each quadrant. A triangle, with the apex connecting to the midpoint of one side of the grid. A line is drawn connecting the apex of the triangle to the midpoint of its base, and another triangle is drawn within the triangle connecting the midpoints of the larger triangle. One player plays as twelve dogs, arranged on the lower two rows of points and the two outer points on the central line; the other plays as one jaguar, placed on the apex of the smaller triangle. The jaguar moves first. Pieces move to an empty adjacent space along the lines of the board. The jaguar may hop over an adjacent dog to an empty space immediately on the opposite side of it, capturing the dog. Dogs cannot capture. The dogs win by blocking the jaguar so it cannot move; the jaguar wins when only six dogs remain. ###
(game "La Yagua" (players 2) (equipment { (board (add (rotate 180 ("AlquerqueGraphWithBottomTriangle")) edges:{{27 29} {29 25}}) use:Vertex) (piece "Jaguar" P1 (or "HopCapture" "StepToEmpty")) (piece "Dog" P2 "StepToEmpty")}) (rules (start { (place "Dog2" (union (expand (sites Bottom) steps:1) (sites {"A3" "E3"}))) (place "Jaguar1" coord:"C7")}) (play (forEach Piece)) (end ("NoMovesLossAndLessNumPiecesPlayerLoss" P2 6)))) END
Describe the mechanics of the following Ludii game (game "Challis Ghutia" (players 2) (equipment { (board (square 9) use:Vertex) (piece "Marker" Each (or ("HopSequenceCapture") ("StepToEmpty")))}) (rules (start { (place "Marker1" (union (expand (sites Bottom) steps:3) (sites {"F5" "G5" "H5" "I5"}))) (place "Marker2" (union (expand (sites Top) steps:3) (sites {"A5" "B5" "C5" "D5"})))}) (play (if "SameTurn" (or ("HopSequenceCaptureAgain") (move Pass)) (forEach Piece))) (end ("CaptureAll" Next)))) ###
9x9 intersecting lines forming a square. Forty pieces per player, lined up on the intersections on the rows closest to them, and the right half of the central line. Players alternate turns moving pieces to an empty adjacent spot along the lines. A piece may capture an opponent's piece by hopping over it to the empty spot immediately on the opposite side of it, following the lines of the board. Multiple captures are allowed. The player who captures all of the opponent's pieces wins. END
Modify the Ludii game according to the following option changes: Each player has 6 holes per row. -> Each player has 8 holes per row. (define "PiecesOwnedBy" (+ (count Cell at:(handSite #1)) (count in:(sites #1 "Home")))) (define "Sow" (then (sow "Track" owner:(mover) apply:(if (> (count at:(to)) 1) (moveAgain) (if (is In (to) (sites Mover "Inner")) (and { (fromTo (from (to)) (to (handSite Mover)) count:(count at:(to))) (if (> (count at:("OppositePit" (to))) 0) (fromTo (from ("OppositePit" (to))) (to (handSite Mover)) count:(count at:("OppositePit" (to))))) (if (> (count at:("OppositeOuterPit" (to))) 0) (fromTo (from ("OppositeOuterPit" (to))) (to (handSite Mover)) count:(count at:("OppositeOuterPit" (to))))) (set Pending) (moveAgain)})))))) (define "StylizedMove" (if (is Mover P1) (difference (expand (intersection (sites Row 1) (sites Left)) steps:2 E) (expand (intersection (sites Row 1) (sites Left)) steps:1 E)) (difference (expand (intersection (sites Row 2) (sites Right)) steps:2 W) (expand (intersection (sites Row 2) (sites Right)) steps:1 W)))) (define "MoveAgainAfterCapture" (and (is Pending) ("SameTurn"))) (define "Columns" 6) (game "Mefuvha" (players 2) (equipment { (mancalaBoard 4 "Columns" store:None { (track "Track1" "0,E,N1,W" loop:True P1) (track "Track2" "12,E,N1,W" loop:True P2)}) (regions "Home" P1 (sites Track "Track1")) (regions "Home" P2 (sites Track "Track2")) (regions "Inner" P1 (difference (sites Track "Track1") (sites Bottom))) (regions "Inner" P2 (difference (sites Track "Track2") (sites Top))) (piece "Seed" Shared) (hand Each)}) (rules (start { (set Count 2 to:(difference (union (sites P1 "Home") (sites P2 "Home")) (union (expand (intersection (sites Row 1) (sites Left)) steps:1 E) (expand (intersection (sites Row 2) (sites Right)) steps:1 W)))) (set Count 1 to:(union (difference (expand (intersection (sites Row 1) (sites Left)) steps:1 E) (sites Left)) (difference (expand (intersection (sites Row 2) (sites Right)) steps:1 W) (sites Right))))}) (play (if "MoveAgainAfterCapture" (move Select (from (sites Next "Home") if:(> (count at:(from)) 0)) (then (fromTo (from (last From)) (to (handSite Mover)) count:(count at:(last From))))) (priority (move Select (from (if ("SameTurn") "LastHoleSowed" (if (< (count Turns) 3) "StylizedMove" (sites Mover "Home"))) if:(> (count at:(from)) 1)) "Sow") (move Select (from (if ("SameTurn") "LastHoleSowed" (sites Mover "Home")) if:(= (count at:(from)) 1)) "Sow")))) (end ("MancalaByScoreWhen" (no Moves Mover))))) ###
(define "PiecesOwnedBy" (+ (count Cell at:(handSite #1)) (count in:(sites #1 "Home")))) (define "Sow" (then (sow "Track" owner:(mover) apply:(if (> (count at:(to)) 1) (moveAgain) (if (is In (to) (sites Mover "Inner")) (and { (fromTo (from (to)) (to (handSite Mover)) count:(count at:(to))) (if (> (count at:("OppositePit" (to))) 0) (fromTo (from ("OppositePit" (to))) (to (handSite Mover)) count:(count at:("OppositePit" (to))))) (if (> (count at:("OppositeOuterPit" (to))) 0) (fromTo (from ("OppositeOuterPit" (to))) (to (handSite Mover)) count:(count at:("OppositeOuterPit" (to))))) (set Pending) (moveAgain)})))))) (define "StylizedMove" (if (is Mover P1) (difference (expand (intersection (sites Row 1) (sites Left)) steps:2 E) (expand (intersection (sites Row 1) (sites Left)) steps:1 E)) (difference (expand (intersection (sites Row 2) (sites Right)) steps:2 W) (expand (intersection (sites Row 2) (sites Right)) steps:1 W)))) (define "MoveAgainAfterCapture" (and (is Pending) ("SameTurn"))) (define "Columns" 8) (game "Mefuvha" (players 2) (equipment { (mancalaBoard 4 "Columns" store:None { (track "Track1" "0,E,N1,W" loop:True P1) (track "Track2" "16,E,N1,W" loop:True P2)}) (regions "Home" P1 (sites Track "Track1")) (regions "Home" P2 (sites Track "Track2")) (regions "Inner" P1 (difference (sites Track "Track1") (sites Bottom))) (regions "Inner" P2 (difference (sites Track "Track2") (sites Top))) (piece "Seed" Shared) (hand Each)}) (rules (start { (set Count 2 to:(difference (union (sites P1 "Home") (sites P2 "Home")) (union (expand (intersection (sites Row 1) (sites Left)) steps:1 E) (expand (intersection (sites Row 2) (sites Right)) steps:1 W)))) (set Count 1 to:(union (difference (expand (intersection (sites Row 1) (sites Left)) steps:1 E) (sites Left)) (difference (expand (intersection (sites Row 2) (sites Right)) steps:1 W) (sites Right))))}) (play (if "MoveAgainAfterCapture" (move Select (from (sites Next "Home") if:(> (count at:(from)) 0)) (then (fromTo (from (last From)) (to (handSite Mover)) count:(count at:(last From))))) (priority (move Select (from (if ("SameTurn") "LastHoleSowed" (if (< (count Turns) 3) "StylizedMove" (sites Mover "Home"))) if:(> (count at:(from)) 1)) "Sow") (move Select (from (if ("SameTurn") "LastHoleSowed" (sites Mover "Home")) if:(= (count at:(from)) 1)) "Sow")))) (end ("MancalaByScoreWhen" (no Moves Mover))))) END
Construct a Ludii game based on the following description Objectives One player has a gold fleet consisting of one large flagship and twelve escorts, with the objective of evading capture while breaking through his or her opponent's blockade to transport the flagship to the perimeter of the board. The other player has a silver fleet of twenty ships, and forms a blockade to trap the gold flagship and destroy the gold fleet's escorts with the objective of capturing the flagship. Setup Gold player places the flagship on the center square of the game board, and positions the rest of the ships anywhere within the boldly ruled central area of the board. Silver player then positions the silver ships on twenty squares in the lightly ruled peripheral area of the board. Play Gold player chooses who goes first. Players move alternately by making two moves or one capture anywhere on the board. When the flagship is moved, only one move or capture is made (thus only the flagship). Moves A player may move two of the smaller playing pieces any number of vacant squares either horizontally or vertically on the board (as a rook in Chess, except that no captures can be made with this move), although if the flagship is moved, the gold player may not move another playing piece. Captures A player may move any playing piece (including the flagship) one square diagonally to capture one of his opponent's playing pieces. (This move is similar to the capture-move of the pawn in Chess, except that captures can be made on any of the four diagonals.) This game uses displacement capture (like Chess), rather than custodial capture (like Hnefatafl), thus when a capture is made, the captured piece is removed from the board and the vacated square is occupied by the captor. Play continues until one player achieves his or her objective. If the flagship of the gold fleet reaches one of the outermost squares on the board, gold player wins. If the flagship is captured before it reaches the outer edge of the board, silver player wins. ###
(game "Breakthru" (players 2) (equipment { (board (square 11)) (piece "Disc" Each (or (if ("NewTurn") ("StepToEnemy" Diagonal)) (move Slide Orthogonal (then (if ("NewTurn") (moveAgain)))))) (piece "Commander" P1 (if ("NewTurn") (or ("StepToEnemy" Diagonal) (move Slide Orthogonal)))) (hand Each) (regions "CentreSites" (expand (sites Centre) steps:2))}) (rules (start { (place "Commander1" (sites Centre)) (place "Disc1" (handSite P1) count:12) (place "Disc2" (handSite P2) count:20)}) phases: { (phase "PlacementP1" (play (move (from (handSite P1)) (to (intersection (sites "CentreSites") (sites Empty))) (then (if (is Occupied (handSite P1)) (moveAgain))))) (nextPhase (is Empty (handSite P1)) "PlacementP2")) (phase "PlacementP2" (play (move (from (handSite P2)) (to (difference (sites Empty) (sites "CentreSites"))) (then (if (is Occupied (handSite P2)) (moveAgain))))) (nextPhase (is Empty (handSite P2)) "Movement")) ("PhaseMovePiece" "Movement" (end { ("PieceTypeReachWin" "Commander1" (sites Outer) P1) (if ("IsOffBoard" (where "Commander" P1)) (result P2 Win))}))})) END
Construct a Ludii game based on the following description 3x6 board. Six pieces per player, which begin one in each space in the row closest to the player. Six sticks, used as dice. One side is polished, and the other is rough. The value of a throw is equal to the number of polished sides which land face up. A throw of sig (five polished or five rough sides up) must be made to move a piece that has not yet been moved; a throw of sig moves it 1 and grants the player another throw. If six polished sides up are thrown, the player gets another throw. If this throw is a sig, the player's throw = 7 and the player may either free the first piece and move it seven spaces or free all six pieces, moving them each one, and moving the first piece the remaining one space. Also, if the player throws six rough sides on their first turn, they get three extra throws. If any of these three throws is a sig, the value of the throw = 13, and the player may free the first piece and move it thirteen spaces, or free all of the player's pieces, moving them each one space, and then moving the first piece the remainder of the spaces. Pieces move from left to right in the player's home row, right to left in the central row, left to right in the opponent's home row, right to left in the central row, and then left to right in the player's home row. When a player's piece lands on a space occupied by an opponent's piece, the opponent's piece is captured. The player who captures all of their opponent's pieces wins. ###
(define "Move" (move (from (from) if:("ActivatedPiece" (from))) (to ("NextSiteOnTrack" (if (= 1 (var "SpecialSig")) (+ 1 ("ThrowValue")) ("ThrowValue"))) if:(not ("IsFriendAt" (to))) (apply "CaptureMove")))) (define "MoveToActivate" (move (from (from) if:(and (not ("ActivatedPiece" (from))) (or ("Sig") (= 1 (var "SpecialSig"))))) (to ("NextSiteOnTrack" 1) if:(not ("IsFriendAt" (to))) (apply "CaptureMove")) (then (and ("ActivePiece" (last To)) (if (= 1 (var "SpecialSig")) (and { (moveAgain) (set Var (+ (var) 1))})))))) (define "CaptureMove" (if ("IsEnemyAt" (to)) (remove (to)))) (define "Sig" (or (= 1 ("ThrowValue")) (= 5 ("ThrowValue")))) (define "ActivePiece" (set State at:#1 1)) (define "ActivatedPiece" (= (state at:#1) 1)) (define "ExtraThrowValue" (mapEntry "ExtraThrow" (count Pips))) (define "ThrowValue" (count Pips)) (game "Sig (El Oued Capture)" (players 2) (equipment { (board (rectangle 3 6) { (track "Track1" "0,E,N1,W,N1,E,S1,W" loop:True P1) (track "Track2" "17,W,S1,E,S1,W,N1,E" P2 directed:True)}) (piece "Marker" Each) (hand Each) ("StickDice" 6) (map "ExtraThrow" {(pair 0 3) (pair 1 1) (pair 2 0) (pair 3 0) (pair 4 0) (pair 5 1) (pair 6 1)})}) (rules (start { (place "Marker1" (sites Bottom)) (place "Marker2" (sites Top))}) (play ("RollMove" (priority (forEach Piece ("MoveToActivate")) (forEach Piece ("Move"))) (then (if (!= 0 ("ExtraThrowValue")) (and (if (= 3 ("ExtraThrowValue")) (if (<= (var) 0) (set Var 2))) (if (!= (mover) (prev)) (and (moveAgain) (if (!= 1 ("ThrowValue")) (set Var "SpecialSig" 1))))) (if (> (var) 0) (and { (set Var (- (var) 1)) (moveAgain)}) (set Var "SpecialSig" 0)))))) (end ("CaptureAll" Next)))) END
Construct a Ludii game based on the following description 6x6 grid. Twelve pieces per player. In the first phase, players alternate turns placing their pieces on an empty space on the board. They are forbidden from placing two of their own pieces orthogonally adjacent to one another. Once all of the pieces are placed, players alternate turns moving the pieces in an orthogonal direction to an empty adjacent spot. When they place a piece so that two are in a row, they capture one of the opponent's pieces. The player who captures all of the opponent's pieces wins. ###
(define "IfLine2OrthogonalMoveAgain" (then (if (is Line 2 Orthogonal) (moveAgain)))) (game "Bolotudu" (players 2) (equipment { (board (square 6)) (hand Each) (piece "Marker" Each ("StepToEmpty" Orthogonal "IfLine2OrthogonalMoveAgain"))}) (rules (start (place "Marker" "Hand" count:12)) phases:{ (phase "Placement" (play (move (from (handSite Mover)) (to (difference (sites Empty) (sites Around (sites Occupied by:Mover) Orthogonal))))) (nextPhase ("HandEmpty" P2) "Movement")) (phase "Movement" (play (if "SameTurn" (move Remove (sites Occupied by:Next)) (forEach Piece))))} (end ("CaptureAll" Next)))) END
Construct a global Ludii definition which fulfills the following requirements. Checks if a site returned by a track is not off board. ###
(define "IsNotOffBoard" (!= #1 Off)) END
Construct a Ludii game based on the following description Board starts empty. Place on an empty location, unless it is next to more of your own pieces. Passing is not allowed. You lose if at the end of your turn, one of your stones is surrounded. Hex N / N-1 Grid Order 4 board ###
(define "Icosahedron" (board (add (remove (tri Limping 4) vertices:{0 1 3 4 5 6 7 8 9 10 11 13 15 17 18 19 20 23 24 25 26 27 31 32 34 35 36 37 39 40 42 43 44 45 46 47}) edges:{ {0 1} {0 2} {0 3} {0 9} {0 10} {1 2} {1 4} {1 6} {6 11} {7 11} {8 11} {1 9} {2 3} {3 5} {3 8} {3 10} {6 9} {8 10} {9 10} {9 11} {10 11}}) use:Vertex)) (define "HexCell" (board (hex Hexagon 4) use:Cell)) (define "HexHex" (board (tri Hexagon 4) use:Vertex)) (define "TriSquare" (board (tiling T33434 (- 4 2)) use:Vertex)) (define "HexLimpCell" (board (hex Limping (- 4 1)) use:Cell)) (define "HexLimp" (board (tri Limping (- 4 1)) use:Vertex)) (define "SquareGrid" (board (square 4) use:Vertex)) (define "BoardUsed" "HexLimp") (define "Connection" Orthogonal) (game "Claustro" (players 2) (equipment { "BoardUsed" (piece "Ball" P1) (piece "Ball" P2)}) (rules (start (set Score Each 0)) (play (move Add (piece (mover)) (to (sites Empty) if:(<= 0 (- (count Pieces Next in:(sites Around (to) Orthogonal)) (count Pieces Mover in:(sites Around (to) Orthogonal))))) (then (if (not (all Sites (sites Occupied by:Mover) if:(can Move (step (from (site)) Orthogonal (to if:(is Empty (to))))))) (trigger "End" Mover) (if (not (all Sites (sites Occupied by:Next) if:(can Move (step (from (site)) Orthogonal (to if:(is Empty (to))))))) (trigger "End" Next)))))) (end (if (or (is Triggered "End" Mover) (is Triggered "End" Next)) (if (is Triggered "End" Mover) (result Mover Loss)) (result Mover Win))))) END
Describe the mechanics of the following Ludii game (define "PiecesOwnedBy" (+ (count Cell at:(handSite #1)) (count in:(sites #1)))) (define "Columns" 40) (game "En Gehe" (players 2) (equipment { (mancalaBoard 2 "Columns" store:None (track "Track" "0,E,N,W" loop:True)) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (piece "Seed" Shared) (hand Each)}) (rules (start (set Count 4 to:(sites Track))) (play (move Select (from (if ("SameTurn") "LastHoleSowed" (sites Mover)) if:(> (count at:(from)) 0)) (then (sow apply:(if (> (count at:(to)) 1) (moveAgain) (if (and (is In (to) (sites Mover)) (> (count at:("OppositePit" (to))) 0)) (and (fromTo (from ("OppositePit" (to))) (to (handSite Mover)) count:(count at:("OppositePit" (to)))) (fromTo (from (to)) (to (handSite Mover)) count:(count at:(to)))))))))) (end ("MancalaByScoreWhen" (no Moves Mover))))) ###
2x40-50 board. Each team controls one row. Play begins with each hole containing four counters (usually seeds or pebbles). A player picks up the counters in a hole in his team's row and sows them in a counterclockwise fashion, one in each consecutive hole. If the last counter is deposited into a hole containing counter, those counters are picked up and the player continues sowing. The turn continues in this fashion until the last counter falls into an empty hole. If this empty hole is on the player's side, the counters in the opposite hole in the other team's row are captured. The counter also causing the capture is taken. Play continues until one team cannot move, and the remaining counters are captured by the other team. The team with the most seeds wins. Each row has 40 holes. END
What does the following global Ludii definition do? (define "IsInCheck" (is Threatened (id #1 #2) #3)) ###
Checks if a specific piece is threatened by any other enemy piece. END
Modify the Ludii game according to the following option changes: The game is played on a 3x13 board. -> The game is played on a 3x14 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 13) { (track "Track1" "0,E,N1,W,N1,E" P1 directed:True) (track "Track2" "38,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))}))) ###
(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 14) { (track "Track1" "0,E,N1,W,N1,E" P1 directed:True) (track "Track2" "41,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
What does the following global Ludii definition do? (define "LastHoleSowed" (sites {(last To afterConsequence:True)})) ###
Returns a region of one site corresponding to the last `to' position after applying the consequences. In the mancala games, this site is the last hole in which a seed was sowed. END
Construct a Ludii game based on the following description Three concentric squares, with lines connecting the corners and the midpoints of the sides. Twelve pieces per player. Players alternate turns placing a piece on the board. When a player makes a line of three of their pieces, they may remove one of the opponent's pieces. When all of the pieces have been placed, players alternate turns moving a piece to an empty adjacent spot along the lines of the board. A piece in the four outside corner spaces is allowed to move to any empty spot on the board. The player who captures all of the opponent's pieces wins. ###
(game "Mulabalaba" (players 2) (equipment { (board (concentric Square rings:3 joinCorners:True) use:Vertex) (hand Each) (piece "Marker" Each (if (is In (from) (sites Corners)) (move (from (from)) (to (sites Empty))) ("StepToEmpty") (then ("ReplayIfLine3"))))}) (rules (start (place "Marker" "Hand" count:12)) phases:{ (phase "Placement" (play (if "SameTurn" "RemoveAnyEnemyPiece" (move (from (handSite Mover)) (to (sites Empty)) (then ("ReplayIfLine3"))))) (nextPhase Mover ("HandEmpty" Mover) "Movement")) (phase "Movement" (play (if "SameTurn" "RemoveAnyEnemyPiece" (forEach Piece))))} (end (forEach NonMover if:(no Pieces Player) (result Player Loss))))) END
Construct a Ludii game based on the following description Played on a square Alquerque board with 9x9 intersecting lines with diagonals. Each player has 40 pieces. Pieces are placed on the intersections of the lines, and move forward along the lines to an adjacent unoccupied intersection. Once pieces reach the opposite side of the board from their starting position at the end of their turn, they are promoted and can move in any direction and over any distance. Opponent's pieces are captured by jumping them. Captures are obligatory if possible. If a player does not capture when they are supposed to, the opponent may remove that piece immediately and then play as normal. The player who captures all of their opponent's pieces or blocks them from being able to move wins. ###
(define "ShouldCapturedButMoved" (and (is In (last From) ("SitesWithPossibleCaptureInPreviousTurn")) (is In (last From) (sites Empty)))) (define "HuffOnePieceOf" (move Select (from #1 if:(is Occupied (from))) (then (and { (remove (last To)) (moveAgain) (set Value Prev 0)})))) (define "SitesWithPossibleCaptureInPreviousTurn" (sites Pending)) (define "RememberSiteWithPossibleCapture" (set Pending (sites From (or (forEach Piece "Disc" ("HopDisc")) (forEach Piece "DiscDouble" ("HopCaptureDistance")))))) (define "DidNotCaptured" (= (value Player Prev) 1)) (define "HasNotCaptured" (set Value Mover 1)) (define "HasCaptured" (set Value Mover 0)) (define "HopDiscDouble" ("HopCaptureDistance" ~ ~ ~ (then ("HasCaptured")))) (define "HopDisc" ("HopCapture" ~ ~ (then (and ("PromoteIfReach" (sites Next) "DiscDouble") ("HasCaptured"))))) (game "Zamma" ("TwoPlayersNorthSouth") (equipment { ("AlquerqueBoard" 9 9) (piece "Disc" Each (or ("HopDisc") ("StepToEmpty" Forwards (then ("HasNotCaptured"))) (then ("PromoteIfReach" (sites Next) "DiscDouble")))) (piece "DiscDouble" Each (or ("HopDiscDouble") (move Slide (then ("HasNotCaptured"))))) (regions P1 (sites Bottom)) (regions P2 (sites Top))}) (rules ("BeforeAfterCentreSetup" "Disc1" "Disc2") (play (or (if ("DidNotCaptured") (or (if ("ShouldCapturedButMoved") ("HuffOnePieceOf" (last To))) ("HuffOnePieceOf" ("SitesWithPossibleCaptureInPreviousTurn")))) (do ("RememberSiteWithPossibleCapture") next:(forEach Piece)))) (end (if (no Moves Mover) (result Next Win))))) END
Describe the mechanics of the following Ludii game (define "InitialPawnMove" (if (is In (from) (sites Start (piece (what at:(from))))) ("DoubleStepForwardToEmpty"))) (game "Chandaraki" ("TwoPlayersNorthSouth") (equipment { (board (square 8)) ("ChessPawn" "Pawn" "InitialPawnMove") ("ChessRook" "Rook") ("ChessKing" "King") ("ChessBishop" "Bishop") ("ChessKnight" "Knight") ("ChessQueen" "Queen") (regions "Promotion" P1 (sites Top)) (regions "Promotion" P2 (sites Bottom))}) (rules (start { (place "Pawn1" (sites Row 1)) (place "Pawn2" (sites Row 6)) (place "Rook1" {"A1" "H1"} state:1) (place "Knight1" {"B1" "G1"}) (place "Bishop1" {"C1" "F1"}) (place "Queen1" coord:"D1") (place "King1" coord:"E1" state:1) (place "Rook2" {"A8" "H8"} state:1) (place "Knight2" {"B8" "G8"}) (place "Bishop2" {"C8" "F8"}) (place "Queen2" coord:"D8") (place "King2" coord:"E8" state:1)}) (play (do (forEach Piece) ifAfterwards:(not ("IsInCheck" "King" Mover)))) (end { ("Checkmate" "King") (if (= 1 (count Pieces Next)) (result Mover Draw))}))) ###
Played on an 8x8 board with pieces with specialized moves: Pawns (8): can move one space orthogonally forward, or two steps orthogonally forward only if it is the first move of any of that player's pawns, capture one space diagonally forward; Rooks (2): can move any number of spaces orthogonally; Bishops (2): can move any number of spaces diagonally; Knight (2): moves in any direction, one space orthogonally with one space forward diagonally; Queens (1): can move any number of spaces orthogonally or diagonally; Kings (1): can move one space orthogonally or diagonally. 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. When a player is reduced to a King without any other pieces, the game is a draw. END
Construct a Ludii game based on the following description Two concentric circles, with four radii from the outer circle to in the center, dividing the circles into four equal parts. There are four arcs, each of which bisects a radius between where each radius intersects the circumference of each circle, the arc also intersecting with the outer circle's circumference. One player plays as a bear, which begins on the central point, the other as three hunters, which begin on any three points on the inner circle. The bear plays first. Players alternate turns moving a piece to an empty adjacent spot along the lines. When the bear is unable to move, the game ends and the players play again, switching sides. The player who lasts longest while playing as the bear wins. The game has two rounds. ###
(game "Gioco dell'Orso" (players 2) (equipment { (board (add (concentric {1 4 12}) edges:{{6 8} {9 11} {12 14} {5 15}}) use:Vertex) (piece "Human" Each ("StepToEmpty")) (piece "Bear" Each ("StepToEmpty")) (hand Each)}) (rules (start { (place "Human1" (handSite P1) count:3) (place "Bear2" (sites Centre))}) phases:{ (phase "PlacementP1" (play (move (from (handSite P1)) (to (intersection (sites Empty) (sites {1..4}))) (then (if ("HandOccupied" P1) (moveAgain))))) (nextPhase ("HandEmpty" P1) "HuntingP2")) (phase "HuntingP2" (play (forEach Piece (then (if (not (can Move ("StepToEmpty" (from (where "Bear" P2))))) (and { (addScore P2 (- (count Moves) 3)) (remove (sites Occupied by:All container:"Board")) (add (piece "Bear1") (to (sites Centre))) (add (piece "Human2") (to (handSite P2)) count:3)}))))) (nextPhase (= 1 (count Sites in:(sites Occupied by:All container:"Board"))) "PlacementP2")) (phase "PlacementP2" (play (move (from (handSite P2)) (to (intersection (sites Empty) (sites {1..4}))) (then (if ("HandOccupied" P2) (moveAgain))))) (nextPhase ("HandEmpty" P2) "HuntingP1")) (phase "HuntingP1" (play (forEach Piece (then (if (not (can Move ("StepToEmpty" (from (where "Bear" P1))))) (addScore P1 (- (count Moves) (+ (score P2) 6))))))) (end (if (!= 0 (score P1)) (byScore))))})) END
Modify the Ludii game according to the following option changes: Small board (48 nodes) -> Medium board (72 nodes) (define "Perf7" (board (dual (remove (hex "Jungle") cells:{12 25 34 41 50 57 66 75 82 91 98 107 116 123 131 144 150 161})) use:Vertex)) (define "Perf6" (board (dual (remove (hex 8) cells:{0 4 5 6 7 8 13 17 20 27 28 35 44 49 54 61 62 65 72 76 77 84 91 92 96 103 106 107 114 119 124 133 140 141 148 151 155 160 161 162 163 164 168})) use:Vertex)) (define "Perf5" (board (dual (remove (hex 7 8) cells:{0 1 2 3 4 5 6 7 8 9 10 11 12 16 17 18 19 26 27 34 38 43 50 53 60 63 64 71 76 77 82 89 92 99 108 116 123 130 131 132 136 137 138 139 140 141 142 143 144 145 146})) use:Vertex)) (define "Perf4" (board (dual (remove (hex 6) cells:{0 1 5 12 17 23 30 37 40 45 50 53 60 67 73 78 85 89 90})) use:Vertex)) (define "Perf3" (board (dual (remove (hex 5 6) cells:{0 1 2 3 4 5 6 7 11 12 13 14 21 25 30 37 42 53 63 64 65 69 70 71 72 73 74})) use:Vertex)) (define "Perf2" (board (dual (remove (hex 4 5) cells:{0 1 15 20 25 32 36 39 44})) use:Vertex)) (define "Jungle" (poly { { -3.5 -11.75} { -10.0 -5.25} { -6.75 12.0} { 1.25 14.75} { 15.25 3.25} { 14.0 -5.75}})) (define "BoardUsed" "Perf3") (define "LoSDirection" Orthogonal) (define "PassEnd" (if (and ("SameTurn") (no Moves Next)) (result Mover Win))) (define "ScoreTerritory" (and ("MPScoring" Mover Next) ("MPScoring" Next Mover))) (define "MPScoring" (set Score #1 (+ (size Array (array (sites From ("Movement" #1)))) (count Sites in:(difference ("SitesControlledBy" #1) ("SitesControlledBy" #2)))))) (define "Movement" (forEach Piece (do (and (set Var "LoSFrom" ("LoSAt" (from))) (set Var "QtyAroundFrom" ("QtyAround" (from)))) next:(move Slide "LoSDirection") ifAfterwards:(or (> ("QtyAround" (last To)) (var "QtyAroundFrom")) (and (= ("QtyAround" (last To)) (var "QtyAroundFrom")) (> ("LoSAt" (last To)) (var "LoSFrom"))))) #1)) (define "Placement" (move Add (piece (mover)) (to (difference (sites Empty) ("SitesControlledBy" Next))))) (define "SitesControlledBy" (sites (results from:(sites Occupied by:#1) to:(sites LineOfSight Empty at:(from) "LoSDirection") (to)))) (define "LoSAt" (count Pieces Next in:(sites LineOfSight Piece at:#1 "LoSDirection"))) (define "QtyAround" (count Pieces Next in:(sites Around #1 "LoSDirection"))) (game "Epoxy" (players 2) (equipment { "BoardUsed" (piece "Ball" Each (move Slide))}) (rules (start (set Score Each 0)) (play (or { ("Placement") ("Movement" Mover) (if (and (not (is Prev Next)) (< 0 (counter))) (move Pass))} (then (if (is Prev Next) (moveAgain) ("ScoreTerritory"))))) (end "PassEnd"))) ###
(define "Perf7" (board (dual (remove (hex "Jungle") cells:{12 25 34 41 50 57 66 75 82 91 98 107 116 123 131 144 150 161})) use:Vertex)) (define "Perf6" (board (dual (remove (hex 8) cells:{0 4 5 6 7 8 13 17 20 27 28 35 44 49 54 61 62 65 72 76 77 84 91 92 96 103 106 107 114 119 124 133 140 141 148 151 155 160 161 162 163 164 168})) use:Vertex)) (define "Perf5" (board (dual (remove (hex 7 8) cells:{0 1 2 3 4 5 6 7 8 9 10 11 12 16 17 18 19 26 27 34 38 43 50 53 60 63 64 71 76 77 82 89 92 99 108 116 123 130 131 132 136 137 138 139 140 141 142 143 144 145 146})) use:Vertex)) (define "Perf4" (board (dual (remove (hex 6) cells:{0 1 5 12 17 23 30 37 40 45 50 53 60 67 73 78 85 89 90})) use:Vertex)) (define "Perf3" (board (dual (remove (hex 5 6) cells:{0 1 2 3 4 5 6 7 11 12 13 14 21 25 30 37 42 53 63 64 65 69 70 71 72 73 74})) use:Vertex)) (define "Perf2" (board (dual (remove (hex 4 5) cells:{0 1 15 20 25 32 36 39 44})) use:Vertex)) (define "Jungle" (poly { { -3.5 -11.75} { -10.0 -5.25} { -6.75 12.0} { 1.25 14.75} { 15.25 3.25} { 14.0 -5.75}})) (define "BoardUsed" "Perf4") (define "LoSDirection" Orthogonal) (define "PassEnd" (if (and ("SameTurn") (no Moves Next)) (result Mover Win))) (define "ScoreTerritory" (and ("MPScoring" Mover Next) ("MPScoring" Next Mover))) (define "MPScoring" (set Score #1 (+ (size Array (array (sites From ("Movement" #1)))) (count Sites in:(difference ("SitesControlledBy" #1) ("SitesControlledBy" #2)))))) (define "Movement" (forEach Piece (do (and (set Var "LoSFrom" ("LoSAt" (from))) (set Var "QtyAroundFrom" ("QtyAround" (from)))) next:(move Slide "LoSDirection") ifAfterwards:(or (> ("QtyAround" (last To)) (var "QtyAroundFrom")) (and (= ("QtyAround" (last To)) (var "QtyAroundFrom")) (> ("LoSAt" (last To)) (var "LoSFrom"))))) #1)) (define "Placement" (move Add (piece (mover)) (to (difference (sites Empty) ("SitesControlledBy" Next))))) (define "SitesControlledBy" (sites (results from:(sites Occupied by:#1) to:(sites LineOfSight Empty at:(from) "LoSDirection") (to)))) (define "LoSAt" (count Pieces Next in:(sites LineOfSight Piece at:#1 "LoSDirection"))) (define "QtyAround" (count Pieces Next in:(sites Around #1 "LoSDirection"))) (game "Epoxy" (players 2) (equipment { "BoardUsed" (piece "Ball" Each (move Slide))}) (rules (start (set Score Each 0)) (play (or { ("Placement") ("Movement" Mover) (if (and (not (is Prev Next)) (< 0 (counter))) (move Pass))} (then (if (is Prev Next) (moveAgain) ("ScoreTerritory"))))) (end "PassEnd"))) END
Modify the Ludii game according to the following option changes: The game is played according to the rules of the source but the capture is allowed only horizontally and vertically. -> The game is played according to the rules described in Youtube. The two differences with the source is: Capture possible only horizontally and vertically and the pieces can slide. (game "Boseog Gonu" (players 2) (equipment { (board (remove (merge { (rectangle 3 3 diagonals:Alternating) (shift 0 -1 (rotate 180 (wedge 2))) (shift 0 2 (wedge 2)) (shift -1.5 0.5 (rotate 90 (wedge 2))) (shift 1.5 0.5 (rotate -90 (wedge 2)))}) edges:{ {{1 1} {0 0}} {{1 1} {2 2}} {{1 1} {2 0}} {{1 1} {0 2}}}) use:Vertex) (piece "Disc" Each ("StepToEmpty" ~ (then (custodial (from (last To)) Axial (between (max 1) if:("IsEnemyAt" (between)) (apply (remove (between)))) (to if:(= (what at:(to)) (what at:(last To))))))))}) (rules (start { (place "Disc1" {"A3" "B3" "B4" "B2"}) (place "Disc2" {"D2" "D3" "E3" "D4"})}) (play (forEach Piece)) (end ("HavingLessPiecesLoss" Next 1)))) ###
(game "Boseog Gonu" (players 2) (equipment { (board (remove (merge { (rectangle 3 3 diagonals:Alternating) (shift 0 -1 (rotate 180 (wedge 2))) (shift 0 2 (wedge 2)) (shift -1.5 0.5 (rotate 90 (wedge 2))) (shift 1.5 0.5 (rotate -90 (wedge 2)))}) edges:{ {{1 1} {0 0}} {{1 1} {2 2}} {{1 1} {2 0}} {{1 1} {0 2}}}) use:Vertex) (piece "Disc" Each (move Slide (then (custodial (from (last To)) Axial (between (max 1) if:("IsEnemyAt" (between)) (apply (remove (between)))) (to if:(= (what at:(to)) (what at:(last To))))))))}) (rules (start { (place "Disc1" {"A3" "B3" "B4" "B2"}) (place "Disc2" {"D2" "D3" "E3" "D4"})}) (play (forEach Piece)) (end ("HavingLessPiecesLoss" Next 1)))) END
Construct a Ludii game based on the following description 2x12 board. The board begins with the following pattern of counters in the holes, beginning from the bottom left row and proceeding in an anti-clockwise direction: 0-0-4-0-4-0-4-0-4-0-4-0-4-0-4-0-4-0-4-0-4-0-4-0. One player starts with an additional four counters in their left hand hole. The player with fewer counters on their first move places the counters from their seventh hole into the opponent's opposite hole. Sowing occurs in an anti-clockwise direction, and may only happen when the final counter lands either in an empty hole in the player's own row or in any hole in the opponent's row. When the final counter lands in an empty hole in the player's own row, the contents of the opposite hole in the opponent's row are captured. When the final counter lands in an occupied hole in the opponent's row, these counters are picked up and sowing continues. The final counter of this sowing is allowed to fall into an occupied hole in the player's own row, and these are picked up and sowing continues. Sowing ends when the final counter lands in an empty hole. The game ends when one player has no counters on their side of the board, and the opponent wins. ###
(define "NoPiecesInPlayerSide" (all Sites (sites #1) if:(= 0 (count at:(site))))) (define "NextHoleFrom" ("NextSiteOnTrack" #2 from:#1)) (define "Columns" 12) (game "Gamacha" (players 2) (equipment { (mancalaBoard 2 "Columns" store:None (track "Track" "0,E,N,W" loop:True)) (piece "Seed" Shared) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (hand Each)}) (rules (start (set Count 4 to:(sites {"C1" "E1" "G1" "I1" "K1" "L2" "J2" "H2" "F2" "D2" "B2"}))) phases:{ (phase "Opening" (play (move (from 6) (to 18) count:4)) (nextPhase "Sowing")) (phase "Sowing" (play (move Select (from (if ("SameTurn") "LastHoleSowed" (sites Mover)) if:(if ("SameTurn") True (and (> (count at:(from)) 0) (if (is In ("NextHoleFrom" (from) (count at:(from))) (sites Next)) True (is Empty ("NextHoleFrom" (from) (count at:(from)))))))) (then (sow apply:(if (and (is In (to) (sites Mover)) (<= (count at:(to)) 1)) (if (!= 0 (count at:("OppositePit" (to)))) (fromTo (from ("OppositePit" (to))) (to (handSite Mover)) count:(count at:("OppositePit" (to))))) (if (> (count at:(to)) 1) (moveAgain))))))))} (end (forEach Player if:("NoPiecesInPlayerSide" Player) (result Player Loss))))) END
Modify the Ludii game according to the following option changes: Hex 3,4 -> Hex 4,5 Capture, Forced placement, Double moves -> Self Removals, Forced placement (define "UpdateSurplusesToDisplayFor" (forEach Group Adjacent if:(is In (to) (sites Occupied by:#1)) (forEach Value (array (sites)) (set Value at:(value) ("SurplusGoodsChainAt" (value)))))) (define "SurplusGoodsChainAt" (- (size Array (array ("SuppliersAroundChainAt" #1))) (size Array (array ("WarehousesinChainAt" #1))))) (define "ScoreFor" (set Score #1 (size Array (array ("AllWarehousesOf" #1))))) (define "Score" (and ("ScoreFor" P1) ("ScoreFor" P2))) (define "AllWarehousesOf" (forEach (sites Occupied by:#1) if:("IsWarehouseAt" (site)))) (define "DoubleTurnProtocol" (set Var "MoveInTurn" (% (+ 3 (var "MoveInTurn")) 2) (then (if (= 1 (var "MoveInTurn")) (moveAgain))))) (define "DeficitWarehousesOf" (forEach (sites Occupied by:#1) if:(and ("IsWarehouseAt" (site)) ("IsDeficitInChainAt" (site))))) (define "Place" (do (move Add (to (sites Empty))) ifAfterwards:(not ("IsDeficitInChainAt" (last To))))) (define "WarehousesinChainAt" (forEach ("ChainAt" #1) if:("IsWarehouseAt" (site)))) (define "SuppliersAroundChainAt" (sites Around ("ChainAt" #1) Adjacent if:("IsSupplierAt" (to)))) (define "ChainAt" (sites Group at:#1 Adjacent)) (define "IsDeficitInChainAt" (< (size Array (array ("SuppliersAroundChainAt" #1))) (size Array (array ("WarehousesinChainAt" #1))))) (define "IsWarehouseAt" (< 2 (count Pieces of:(who at:#1) in:(sites Around #1 Adjacent)))) (define "IsSupplierAt" (and (not (is Empty #1)) (> 3 (count Pieces of:(who at:#1) in:(sites Around #1 Adjacent if:(not (is Empty (to)))))))) (game "SupplyChains" (players 2) (equipment { (board (hex 3 4) use:Cell) (piece "Disc" Each)}) (rules (play (priority { (move Remove ("DeficitWarehousesOf" Next)) (or { ("Place")})} (then (and { ("UpdateSurplusesToDisplayFor" Mover) ("UpdateSurplusesToDisplayFor" Next) ("Score") (if (can Move (move Remove ("DeficitWarehousesOf" Next))) (moveAgain) "DoubleTurnProtocol")})))) (end (if (or (all Passed) (no Moves Mover)) (byScore))))) ###
(define "UpdateSurplusesToDisplayFor" (forEach Group Adjacent if:(is In (to) (sites Occupied by:#1)) (forEach Value (array (sites)) (set Value at:(value) ("SurplusGoodsChainAt" (value)))))) (define "SurplusGoodsChainAt" (- (size Array (array ("SuppliersAroundChainAt" #1))) (size Array (array ("WarehousesinChainAt" #1))))) (define "ScoreFor" (set Score #1 (size Array (array ("AllWarehousesOf" #1))))) (define "Score" (and ("ScoreFor" P1) ("ScoreFor" P2))) (define "AllWarehousesOf" (forEach (sites Occupied by:#1) if:("IsWarehouseAt" (site)))) (define "DoubleTurnProtocol" (set Var "MoveInTurn" (% (+ 3 (var "MoveInTurn")) 2) (then (if (= 1 (var "MoveInTurn")) (moveAgain))))) (define "DeficitWarehousesOf" (forEach (sites Occupied by:#1) if:(and ("IsWarehouseAt" (site)) ("IsDeficitInChainAt" (site))))) (define "Place" (do (move Add (to (sites Empty))) ifAfterwards:(not ("IsDeficitInChainAt" (last To))))) (define "WarehousesinChainAt" (forEach ("ChainAt" #1) if:("IsWarehouseAt" (site)))) (define "SuppliersAroundChainAt" (sites Around ("ChainAt" #1) Adjacent if:("IsSupplierAt" (to)))) (define "ChainAt" (sites Group at:#1 Adjacent)) (define "IsDeficitInChainAt" (< (size Array (array ("SuppliersAroundChainAt" #1))) (size Array (array ("WarehousesinChainAt" #1))))) (define "IsWarehouseAt" (< 2 (count Pieces of:(who at:#1) in:(sites Around #1 Adjacent)))) (define "IsSupplierAt" (and (not (is Empty #1)) (> 3 (count Pieces of:(who at:#1) in:(sites Around #1 Adjacent if:(not (is Empty (to)))))))) (game "SupplyChains" (players 2) (equipment { (board (hex 4 5) use:Cell) (piece "Disc" Each)}) (rules (play (priority { (move Remove ("DeficitWarehousesOf" Mover)) (or { ("Place")})} (then (and { ("UpdateSurplusesToDisplayFor" Mover) ("UpdateSurplusesToDisplayFor" Next) ("Score") (if (can Move (move Remove ("DeficitWarehousesOf" Mover))) (moveAgain))})))) (end (if (or (all Passed) (no Moves Mover)) (byScore))))) END
Describe the mechanics of the following Ludii game (define "InitialPawnMove" (if (is In (from) (sites Start (piece (what at:(from))))) ("DoubleStepForwardToEmpty" "SetEnPassantLocation"))) (define "EnPassant" (move Step (directions {FR FL}) (to if:"InLocationEnPassant") (then (remove (ahead (last To) Backward))))) (define "InLocationEnPassant" (and (is Pending) (= (to) (value Pending)))) (define "SetEnPassantLocation" (then (set Pending (ahead (last To) Backward)))) (define "Castling" (if (and ("HasNeverMoved" "King") (not ("IsInCheck" "King" Mover))) (or (if (and ("HasNeverMoved" "RookLeft") (can Move ("CastleRook" "RookLeft" E 3 (is Empty (to))))) "BigCastling") (if (and ("HasNeverMoved" "RookRight") (can Move ("CastleRook" "RookRight" W 2 (is Empty (to))))) "SmallCastling")))) (define "BigCastling" ("DecideToCastle" "King" W 2 "KingNotCheckedAndToEmpty" (then ("CastleRook" "RookLeft" E 3 True)))) (define "SmallCastling" ("DecideToCastle" "King" E 2 "KingNotCheckedAndToEmpty" (then ("CastleRook" "RookRight" W 2 True)))) (define "CastleRook" (slide (from (mapEntry #1 (mover))) #2 (between (exact #3) if:#4) (to if:True (apply ("PieceHasMoved" (from)))))) (define "DecideToCastle" (move Slide (from (mapEntry #1 (mover))) #2 (between (exact #3) if:#4) (to if:True (apply ("PieceHasMoved" (from)))) #5)) (define "KingNotCheckedAndToEmpty" (and (is Empty (to)) (not ("IsInCheck" "King" Mover at:(to))))) (define "RememberPieceHasMoved" (then (if (= (state at:(last To)) 1) ("PieceHasMoved" (last To))))) (define "PieceHasMoved" (set State at:#1 0)) (define "HasNeverMoved" (= (state at:(mapEntry #1 (mover))) 1)) (game "Dragonchess" ("TwoPlayersNorthSouth") (equipment { (board (merge (square 10) (shift -3 3 (rectangle 4 16)))) ("ChessPawn" "Pawn" (or "InitialPawnMove" "EnPassant") (then (and ("ReplayInMovingOn" (sites Mover "Promotion")) (set Counter)))) ("ChessRook" "Rook" (then (set Counter)) ("RememberPieceHasMoved")) ("ChessKing" "King" (then (set Counter)) ("RememberPieceHasMoved")) ("ChessBishop" "Bishop" (then (set Counter))) ("ChessKnight" "Knight" (then (set Counter))) ("ChessQueen" "Queen" (then (set Counter))) (piece "Dragon" Each (move Slide (between (max 3) if:(is Empty (between))) (to if:("IsEnemyAt" (to)) (apply (remove (to) (then (set Counter))))))) (map "King" {(pair 1 "I1") (pair 2 "H10")}) (map "RookLeft" {(pair 1 "E1") (pair 2 "L10")}) (map "RookRight" {(pair 1 "L1") (pair 2 "E10")}) (regions "Promotion" P1 (sites Top)) (regions "Promotion" P2 (sites Bottom))}) (rules (start { (place "Pawn1" (sites Row 1)) (place "Pawn2" (sites Row 8)) (place "Dragon1" {"D1" "M1"}) (place "Rook1" {"E1" "L1"} state:1) (place "Knight1" {"F1" "K1"}) (place "Bishop1" {"G1" "J1"}) (place "Queen1" coord:"H1") (place "King1" coord:"I1" state:1) (place "Dragon2" {"D10" "M10"}) (place "Rook2" {"E10" "L10"} state:1) (place "Knight2" {"F10" "K10"}) (place "Bishop2" {"G10" "J10"}) (place "Queen2" coord:"I10") (place "King2" coord:"H10" state:1)}) (play (if "SameTurn" (move Promote (last To) (piece {"Queen" "Knight" "Bishop" "Rook" "Dragon"}) Mover) (do (or (forEach Piece) ("Castling")) ifAfterwards:(not ("IsInCheck" "King" Mover))))) (end { ("Checkmate" "King") (if (or (no Moves Mover) (= (counter) 99)) (result Mover Draw))}))) ###
Same rules as Chess. Dragons move like queens, but at most three squares. END
Construct a Ludii game based on the following description 4x8 board. Three counters in each hole. Players pick up counters from any of their holes and sow them in either direction. If the last counter falls into an occupied hole, they pick the counters in this hole up and continue sowing. Sowing ends when the last counter falls into an empty hole. If the empty hole is in the inner row, the player captures any of the counters in the opponent's two holes opposite it. Play ends when all of one player's seeds have been captured. ###
(define "PiecesOwnedBy" (+ (count Cell at:(handSite #1)) (count in:(sites #1 "Home")))) (define "Sow" (move Select (from (if ("SameTurn") (if #1 "LastHoleSowed") (sites Mover "Home")) if:(> (count at:(from)) 0)) (then (sow #2 owner:(mover) apply:(if (= (count at:(to)) 1) (if (is In (to) (sites Mover "Inner")) (and (if (> (count at:("OppositePit" (to))) 0) (fromTo (from ("OppositePit" (to))) (to (handSite Mover)) count:(count at:("OppositePit" (to))))) (if (> (count at:("OppositeOuterPit" (to))) 0) (fromTo (from ("OppositeOuterPit" (to))) (to (handSite Mover)) count:(count at:("OppositeOuterPit" (to))))))) #3))))) (define "Columns" 8) (game "Bao Ki Arabu (Zanzibar 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))) (piece "Seed" Shared) (hand Each)}) (rules (start (set Count 3 to:(sites Board))) (play (or ("Sow" (is Pending) "TrackCW" (and (moveAgain) (set Pending))) ("Sow" (not (is Pending)) "TrackCCW" (moveAgain)))) (end ("MancalaByScoreWhen" (no Moves Mover))))) END
Construct a Ludii game based on the following description The graph is initially coloured. The goal of the general version of the puzzle is to uncolour edges until the coloured graph is a regular graph. The goal of the parameter-k version of the puzzle is to uncolour edges until the coloured graph is a k-regular graph. The game is played on the Graph1. General version ###
(game "Nein Ari" (players 1) (equipment { (board (graph vertices:{ {0 0} {5 0} {10 0} {0 5} {5 5} {10 5}} edges:{ {0 1} {0 2} {0 3} {0 4} {0 5} {1 2} {1 3} {1 4} {1 5} {2 3} {2 4} {2 5} {3 4} {3 5} {4 5}}) use:Edge)}) (rules (start (set P1 Edge (sites Board Edge))) (play (move Remove (sites Occupied by:Mover on:Edge))) (end (if (is RegularGraph Mover) (result Mover Win))))) END
Construct a Ludii game based on the following description 3x3 grid. Three pieces per player. Players alternate turns placing a piece on the board. When all of the pieces are placed, players alternate turns moving a piece to any empty space on the board. The player who places three pieces in an orthogonal row wins. ###
(game "Dris at-Talata" (players 2) (equipment { (board (square 3)) (hand Each) (piece "Marker" Each)}) (rules (start (place "Marker" "Hand" count:3)) phases:{ (phase "Placement" (play (move (from (handSite Mover)) (to (sites Empty)))) (nextPhase ("HandEmpty" P2) "Movement")) (phase "Movement" (play (move (from (sites Occupied by:Mover)) (to (sites Empty)))))} (end ("Line3Win" Orthogonal)))) END
Modify the Ludii game according to the following option changes: Each player has 7 holes. -> Each player has 8 holes. (define "PiecesOwnedBy" (count Cell at:(handSite #1))) (game "Hoyito" (players 2) (equipment { (mancalaBoard 2 7 store:None (track "Track" "0,E,N,W" loop:True)) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (piece "Seed" Shared) (hand Each)}) (rules (start (set Count 4 to:(sites Track))) (play (move Select (from (if ("SameTurn") "LastHoleSowed" (sites Mover)) if:(> (count at:(from)) 0)) (then (sow apply:(if (= (count at:(to)) 4) (if (<= (count in:(sites Board)) 8) (forEach Site (sites Board) (if (> (count at:(site)) 0) (fromTo (from (site)) (to (handSite Mover)) count:(count at:(site))))) (fromTo (from (to)) (to (handSite Mover)) count:(count at:(to)))) (if (< (count at:(to)) 1) (moveAgain))))))) (end ("MancalaByScoreWhen" (no Moves Mover))))) ###
(define "PiecesOwnedBy" (count Cell at:(handSite #1))) (game "Hoyito" (players 2) (equipment { (mancalaBoard 2 8 store:None (track "Track" "0,E,N,W" loop:True)) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (piece "Seed" Shared) (hand Each)}) (rules (start (set Count 4 to:(sites Track))) (play (move Select (from (if ("SameTurn") "LastHoleSowed" (sites Mover)) if:(> (count at:(from)) 0)) (then (sow apply:(if (= (count at:(to)) 4) (if (<= (count in:(sites Board)) 8) (forEach Site (sites Board) (if (> (count at:(site)) 0) (fromTo (from (site)) (to (handSite Mover)) count:(count at:(site))))) (fromTo (from (to)) (to (handSite Mover)) count:(count at:(to)))) (if (< (count at:(to)) 1) (moveAgain))))))) (end ("MancalaByScoreWhen" (no Moves Mover))))) END
Modify the Ludii game according to the following option changes: The version of the game played with 3 players. -> The version of the game played with 4 players. (game "Ciri Amber" (players 3) (equipment { (board (complete (regular Star 7)) use:Edge) (piece "Marker" Neutral)}) (rules (start { (set Neutral Edge (sites Board Edge)) (set Cost 1 Edge at:0) (set Cost 2 Edge at:1) (set Cost 3 Edge at:2) (set Cost 1 Edge at:3) (set Cost 2 Edge at:4) (set Cost 3 Edge at:5) (set Cost 1 Edge at:6) (set Cost 2 Edge at:7) (set Cost 3 Edge at:8) (set Cost 3 Edge at:9) (set Cost 1 Edge at:10) (set Cost 2 Edge at:11) (set Cost 3 Edge at:12) (set Cost 1 Edge at:13) (set Cost 2 Edge at:14) (set Cost 3 Edge at:15) (set Cost 1 Edge at:16) (set Cost 2 Edge at:17) (set Cost 3 Edge at:18) (set Cost 3 Edge at:19) (set Cost 1 Edge at:20)}) (play (move Remove (sites Occupied by:Neutral) (then (addScore Mover (cost Edge at:(last To)))))) (end (if (is RegularGraph Neutral) (byScore))))) ###
(game "Ciri Amber" (players 4) (equipment { (board (complete (regular Star 7)) use:Edge) (piece "Marker" Neutral)}) (rules (start { (set Neutral Edge (sites Board Edge)) (set Cost 1 Edge at:0) (set Cost 2 Edge at:1) (set Cost 3 Edge at:2) (set Cost 1 Edge at:3) (set Cost 2 Edge at:4) (set Cost 3 Edge at:5) (set Cost 1 Edge at:6) (set Cost 2 Edge at:7) (set Cost 3 Edge at:8) (set Cost 3 Edge at:9) (set Cost 1 Edge at:10) (set Cost 2 Edge at:11) (set Cost 3 Edge at:12) (set Cost 1 Edge at:13) (set Cost 2 Edge at:14) (set Cost 3 Edge at:15) (set Cost 1 Edge at:16) (set Cost 2 Edge at:17) (set Cost 3 Edge at:18) (set Cost 3 Edge at:19) (set Cost 1 Edge at:20)}) (play (move Remove (sites Occupied by:Neutral) (then (addScore Mover (cost Edge at:(last To)))))) (end (if (is RegularGraph Neutral) (byScore))))) END
Construct a Ludii game based on the following description Player 1 marks a cell. Then Players take turns marking any unmarked cell with exactly one marked neighbour. Player who can't move loses. ###
(define "NumNeighbour" (count Sites in:(sites Around (to) Orthogonal if:(is In (to) (sites Occupied by:Neutral))))) (game "Snowpaque" (players 2) (equipment { (board (hex 5)) (piece "Marker" Neutral)}) (rules phases:{ (phase "start" P1 (play (move Add (piece (id "Marker0")) (to (sites Empty)))) (nextPhase "play")) (phase "play" (play (move Add (piece "Marker0") (to (sites Empty) if:(= "NumNeighbour" 1)))))} (end ("NoMoves" Loss)))) END
Construct a Ludii game based on the following description 2x6 board. Six counters in each hole. Players take the contents of one of their holes and sow in an anti-clockwise direction. When the final counter of a sowing lands in a hole, making it contain two, four, or six counters, these counters are taken. If the second to last hole also contains two, four, or six counters, these are also taken, continuing in an unbroken line until a hole with containing a number of counters other than two, four, or six. The game continues until all of the counters have been captured. The player who captured the most counters wins. ###
(define "PiecesOwnedBy" (count Cell at:(handSite #1))) (game "Mankala" (players 2) (equipment { (mancalaBoard 2 6 store:None (track "Track" "0,E,N,W" loop:True)) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (piece "Seed" Shared) (hand Each)}) (rules (start (set Count 6 to:(sites Track))) (play (move Select (from (sites Mover) if:(< 0 (count at:(from)))) (then (sow if:(or { (= (count at:(to)) 2) (= (count at:(to)) 4) (= (count at:(to)) 6)}) apply:(fromTo (from (to)) (to (handSite Mover)) count:(count at:(to))) backtracking:True)))) (end ("MancalaByScoreWhen" (and (no Moves Next) (no Moves Mover)))))) END
Construct a Ludii game based on the following description 2x6 board. Four counters in each hole. Players draw lots to see who goes first. There is a choice of stylised opening move. One player takes a counter from their rightmost hole, then another from the opposite hole in the opponent's row, then proceeding in this fashion in an anti-clockwise direction until the holes alternate with five and three counters, until reaching the hole from which sowing began, which will hold four. The original counter is sown into the next hole in the opponent's row, making four, thus creating a tuz, which behaves as explained below. Alternatively, the player may rearrange the counters in a similar manner, but creating an alternating pattern of holes with three and five counters, and not creating a tuz. After this, players pick up the counters in any of the holes in their row and sow them in an anti-clockwise direction. If the last counter falls into a hole that is occupied, the player picks up the contents of this hole and continues to sow. When the last counter falls into an empty hole, the play ends. Capturing occurs when the last counter falls into a hole on the opponent's side of the board containing three counters, increasing it to four. This hole, a tuz, then belongs to the player who captured it. A player cannot pick up counters from this hole, and the opponent can only do so if the last counter of their sowing falls in the tuz, in which case the opponent takes one counter from it, along with the final counter. The tuz remains in the ownership of the person who captured it. If it remains empty and the opponent drops their last counter into the tuz, the last counter is removed. Play then continues by picking up the contents of another hole and continuing to sow. If a player cannot move, they pass, but the opponent may continue to make moves. The player could then resume play if the opponent's moves create a possibility for a move. Play ends when there are no more counters available to move. Each player owns the counters in their tuz or which they have removed from the board. A second round is played, each player placing four counters into each hole starting from the rightmost hole in their row. The player with more counters gains a hole from their opponent for every four extra balls they've captured. If an opponent has three extra after counting in such a way, they also gain a hole, and if each player has two remaining counters ownership is determined by chance. Play continues in several rounds like this until one player takes all the counters. ###
(define "SitesMarkedBy" (forEach (sites Board) if:(= #1 (state at:(site))))) (define "RememberOwnedHolesRandom" (if (< 50 (value Random (range 1 100))) (remember Value "OwnedP1" #1) (remember Value "OwnedP2" #1))) (define "RightMostEmpty" (trackSite FirstSite "TrackCW" from:(mapEntry "RightMost" Mover) if:(is Empty (to)))) (define "OnlyPiecesInMarked" (all Sites (forEach (sites Board) if:(= 0 (state at:(site)))) if:(= 0 (count at:(site))))) (define "RemmemberOwnedHoles" (if (is Mover P1) (remember Value "OwnedP1" #1) (remember Value "OwnedP2" #1))) (define "OpponentOwnedHoles" (if (is Mover P1) (sites (values Remembered "OwnedP2")) (sites (values Remembered "OwnedP1")))) (define "OwnedHoles" (if (is Mover P1) (sites (values Remembered "OwnedP1")) (sites (values Remembered "OwnedP2")))) (define "NextHole" ("NextSiteOnTrack" #3 from:#1 #2)) (game "Tuz" (players 2) (equipment { (mancalaBoard 2 6 store:None { (track "TrackCCW" "0,E,N,W" loop:True) (track "TrackCW" "5,W,N,E" loop:True)}) (piece "Seed" Shared) (hand Each) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (map "RightMost" {(pair P1 5) (pair P2 6)})}) (rules (start { (set RememberValue "OwnedP1" (sites Bottom)) (set RememberValue "OwnedP2" (sites Top)) (set Count 4 to:(sites Track))}) phases:{ (phase "Opening" (play (move Select (from (if ("SameTurn") (sites {("NextHole" (last From) "TrackCCW" 2)}) (union (sites {10}) (intersection (sites Bottom) (sites Right))))) (then (sow count:1 "TrackCCW" apply:(if (not (is In ("NextHole" (from) "TrackCCW" 2) (intersection (sites Bottom) (sites Right)))) (moveAgain) (if (= 4 (count at:11)) (set State at:11 (mover)))))))) (nextPhase (is In ("NextHole" (last From) "TrackCCW" 2) (intersection (sites Bottom) (sites Right))) "Sowing")) (phase "Sowing" (play (or { (move Select (from (if ("SameTurn") (sites {(var "Replay")}) ("OwnedHoles")) if:(and (< 0 (count at:(from))) (= 0 (state at:(from))))) (then (sow "TrackCCW" apply:(if (and { (= 0 (state at:(to))) (= 4 (count at:(to))) (is In (to) ("OpponentOwnedHoles"))}) (set State at:(to) (mover)) (if (< 1 (count at:(to))) (if (= 0 (state at:(to))) (and (moveAgain) (set Var "Replay" (to))) (if (!= (mover) (state at:(to))) (and (fromTo (from (to)) (to (handSite Mover)) count:(min 2 (count at:(to)))) (set State at:(to) (state at:(to)))))))))))} (then (if ("OnlyPiecesInMarked") (and { (forEach Site ("SitesMarkedBy" 1) (fromTo (from (site)) (to (handSite P1)) count:(count at:(site)))) (forEach Site ("SitesMarkedBy" 2) (fromTo (from (site)) (to (handSite P2)) count:(count at:(site)))) (forget Value "OwnedP1" All) (forget Value "OwnedP2" All)}))))) (end (if ("NoPieceOnBoard") { (if (= 0 (count Cell at:(handSite P1))) (result P2 Win)) (if (= 0 (count Cell at:(handSite P2))) (result P1 Win))})) (nextPhase ("NoPieceOnBoard") "BetweenRounds")) (phase "BetweenRounds" (play (if (<= 4 (count Cell at:(handSite Mover))) (move (from (handSite Mover)) (to ("RightMostEmpty")) count:4 (then (and { ("RemmemberOwnedHoles" (last To)) (if (<= 4 (count Cell at:(handSite Mover))) (moveAgain) (if (= 3 (count Cell at:(handSite Mover))) (and { (fromTo (from (handSite Mover)) (to ("RightMostEmpty")) count:3) (fromTo (from (handSite Next)) (to ("RightMostEmpty")) count:1) ("RemmemberOwnedHoles" ("RightMostEmpty"))}) (if (= 2 (count Cell at:(handSite Mover))) (and { (fromTo (from (handSite Mover)) (to ("RightMostEmpty")) count:2) (fromTo (from (handSite Next)) (to ("RightMostEmpty")) count:2) ("RememberOwnedHolesRandom" ("RightMostEmpty"))}))))}))))) (nextPhase (and (is Empty (handSite P1)) (is Empty (handSite P2))) "Sowing"))})) END
Modify the Ludii game according to the following option changes: The game is played on a 13x13 board -> The game is played on a 15x15 board (define "MadeALegalMove" (do (add (to (last To)) (then (and { "CaptureSurroundedPiece" (set Hidden at:(last To) to:Next) (note player:Mover "has moved") (note player:Next "to play")}))) ifAfterwards:("HasFreedom" Orthogonal))) (define "NotEmpty" (not (is In (last To) (sites Empty)))) (define "IllegalMove" (and { (note player:Mover "made an illegal move") (note player:Mover "to play") (moveAgain)})) (define "CaptureSurroundedPiece" (enclose (from (last To)) Orthogonal (between if:("IsEnemyAt" (between)) (apply (and (addScore Mover 1) (remove (between))))))) (game "Phantom Go" (players 2) (equipment { (board (square 13) use:Vertex) (piece "Marker" Each)}) (rules (play (or (move Select (from (union (sites Empty) (sites Hidden to:Mover))) (then (priority { (if ("NotEmpty") ("IllegalMove")) ("MadeALegalMove") ("IllegalMove")}))) (move Pass))) (end (if (all Passed) (byScore { (score P1 (+ (score P1) (size Territory P1))) (score P2 (+ (score P2) (size Territory P2)))}))))) ###
(define "MadeALegalMove" (do (add (to (last To)) (then (and { "CaptureSurroundedPiece" (set Hidden at:(last To) to:Next) (note player:Mover "has moved") (note player:Next "to play")}))) ifAfterwards:("HasFreedom" Orthogonal))) (define "NotEmpty" (not (is In (last To) (sites Empty)))) (define "IllegalMove" (and { (note player:Mover "made an illegal move") (note player:Mover "to play") (moveAgain)})) (define "CaptureSurroundedPiece" (enclose (from (last To)) Orthogonal (between if:("IsEnemyAt" (between)) (apply (and (addScore Mover 1) (remove (between))))))) (game "Phantom Go" (players 2) (equipment { (board (square 15) use:Vertex) (piece "Marker" Each)}) (rules (play (or (move Select (from (union (sites Empty) (sites Hidden to:Mover))) (then (priority { (if ("NotEmpty") ("IllegalMove")) ("MadeALegalMove") ("IllegalMove")}))) (move Pass))) (end (if (all Passed) (byScore { (score P1 (+ (score P1) (size Territory P1))) (score P2 (+ (score P2) (size Territory P2)))}))))) END
Construct a global Ludii definition which fulfills the following requirements. Checks if a site is phase 1. ###
(define "IsPhaseOne" (= 1 (phase of:#1))) END
Construct a Ludii game based on the following description King's Valley is a very simple and easy game to play. This is because all the pieces move the same. Any piece can move straight horizontal, vertical or diagonal, but always as far as possible. Pieces always stop their movement either at the sides of the board or before another piece in the same row, column, or diagonal. The winner is the first player that manages to move his king piece to the central square of the board, which represents the King's Valley. ###
(define "Move" (move (from) (to (sites LineOfSight Farthest at:(from))))) (game "King's Valley" (players 2) (equipment { (board (square 5)) (piece "Disc" Each "Move") (piece "King" Each "Move")}) (rules (start { (place "King1" (intersection (sites Bottom) (sites Column 2))) (place "King2" (intersection (sites Top) (sites Column 2))) (place "Disc1" (difference (sites Bottom) (sites Column 2))) (place "Disc2" (difference (sites Top) (sites Column 2)))}) (play (forEach Piece)) (end (if (is In (where "King" Mover) (sites Centre)) (result Mover Win))))) END
Modify the Ludii game according to the following option changes: The game is played on a 6x6 board -> The game is played on a 10x10 board (define "IsUnpromoted" ("IsPieceAt" "Counter" Mover (last To))) (define "HopCounter" (move Hop (from #1) All (between if:(and (not (is In (between) (sites ToClear))) ("IsEnemyAt" (between))) (apply (remove (between) at:EndOfTurn))) (to if:(is Empty (to))) #2)) (game "Omnidirectional Draughts" (players 2) ("DraughtsEquipment" (square 6)) (rules (start { (place "Counter1" (expand (sites Bottom) steps: (- (/ 6 2) 2))) (place "Counter2" (expand (sites Top) steps: (- (/ 6 2) 2)))}) (play (if "SameTurn" (if "IsUnpromoted" (max Moves ("HopCounter" (last To) (then ("ReplayIfCanMove" ("HopCounter" (last To)) ("PromoteIfReach" (sites Next) "DoubleCounter"))))) (max Moves ("HopSequenceCaptureAgain" before:(count Rows) after:(count Rows) at:EndOfTurn))) (priority { (max Moves (or (forEach Piece "Counter" ("HopCounter" (from) (then ("ReplayIfCanMove" ("HopCounter" (last To)) ("PromoteIfReach" (sites Next) "DoubleCounter"))))) (forEach Piece "DoubleCounter" ("HopSequenceCapture" before:(count Rows) after:(count Rows) at:EndOfTurn)))) (or (forEach Piece "Counter" ("StepToEmpty" (directions Forwards)) (then ("PromoteIfReach" (sites Next) "DoubleCounter"))) (forEach Piece "DoubleCounter" (move Slide)))}))) (end ("BlockWin")))) ###
(define "IsUnpromoted" ("IsPieceAt" "Counter" Mover (last To))) (define "HopCounter" (move Hop (from #1) All (between if:(and (not (is In (between) (sites ToClear))) ("IsEnemyAt" (between))) (apply (remove (between) at:EndOfTurn))) (to if:(is Empty (to))) #2)) (game "Omnidirectional Draughts" (players 2) ("DraughtsEquipment" (square 10)) (rules (start { (place "Counter1" (expand (sites Bottom) steps: (- (/ 10 2) 2))) (place "Counter2" (expand (sites Top) steps: (- (/ 10 2) 2)))}) (play (if "SameTurn" (if "IsUnpromoted" (max Moves ("HopCounter" (last To) (then ("ReplayIfCanMove" ("HopCounter" (last To)) ("PromoteIfReach" (sites Next) "DoubleCounter"))))) (max Moves ("HopSequenceCaptureAgain" before:(count Rows) after:(count Rows) at:EndOfTurn))) (priority { (max Moves (or (forEach Piece "Counter" ("HopCounter" (from) (then ("ReplayIfCanMove" ("HopCounter" (last To)) ("PromoteIfReach" (sites Next) "DoubleCounter"))))) (forEach Piece "DoubleCounter" ("HopSequenceCapture" before:(count Rows) after:(count Rows) at:EndOfTurn)))) (or (forEach Piece "Counter" ("StepToEmpty" (directions Forwards)) (then ("PromoteIfReach" (sites Next) "DoubleCounter"))) (forEach Piece "DoubleCounter" (move Slide)))}))) (end ("BlockWin")))) END
Describe the mechanics of the following Ludii game (game "Shatranj at-Tamma" ("TwoPlayersNorthSouth") (equipment { ("ChessPawn" "Pawn" ~ (then (if (is In (last To) (sites Mover "Promotion")) (if ("IsOffBoard" (where "Queen" Mover)) (promote (last To) (piece "Queen") Mover) (remove (last To)))))) ("ChessKing" "King_noCross") (piece "Queen" Each ("StepToNotFriend" Diagonal)) ("ChessKnight" "Knight") ("ChessKing" "Wazir") ("ChessRook" "Rook") (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)))))) (regions "Promotion" P1 (sites Top)) (regions "Promotion" P2 (sites Bottom)) (board (square 10))}) (rules (start { (place "Pawn1" (sites Row 2)) (place "Pawn2" (sites Row 7)) (place "Rook1" (sites {"A1" "J1"})) (place "Rook2" (sites {"A10" "J10"})) (place "Knight1" (sites {"B1" "I1"})) (place "Knight2" (sites {"B10" "I10"})) (place "Elephant1" (sites {"C1" "H1"})) (place "Elephant2" (sites {"C10" "H10"})) (place "Wazir1" (sites {"D1" "G1"})) (place "Wazir2" (sites {"D10" "G10"})) (place "Queen1" coord:"E1") (place "Queen2" coord:"F10") (place "King_noCross1" coord:"F1") (place "King_noCross2" coord:"E10")}) (play (do (forEach Piece) ifAfterwards:(not ("IsInCheck" "King_noCross" Mover)))) (end { ("Checkmate" "King_noCross") ("BlockWin")}))) ###
10x10 board. The pieces move as follows, with the number per player: 1 x Shah (king): one space orthogonally or diagonally; 1 x Fers (counselor): one square diagonally; 2 x Rukh (rook): any number of spaces orthogonally; 2x Dabbaba: one space orthogonally or diagonally; 2 x Pil (elephant): two squares diagonally, jumping over the first. Cannot capture another Pil; 2 x Asb (horse): one square orthogonally, and then one square diagonally, jumping over any intervening pieces; 10 x Sarbaz (soldier): one space forward orthogonally or one space forward diagonally to capture. No en passant. Sarbaz begins in the third rank, and is promoted to Fers when reaching the tenth rank, only if the Fers has been captured. Otherwise, the other player captures it. No castling. Stalemate results in win for player causing it. The player who checkmates the king wins. END
Construct a Ludii game based on the following description Played on a Backgammon board. Three pieces per player. Two dice. Only the lower value of the dice is used. One player plays from their let toward their right, and the other player from their right to their left. Pieces begin on the outer edge of the board. Pieces move according to the throw of the dice toward the point on the opposite side of their side of the board. No more than one piece can be on a point (except the final point) at any time. Pieces cannot pass each other. When a piece lands on an empty point that is opposite an opponent's point with a piece on it, the opponent's piece is sent back to start. The first player to place all three of their pieces on the final point wins. ###
(define "ThreePiecesOnFinalPoint" (= 3 (count Pieces Mover in:(sites {(mapEntry "FinalPoint" Mover)})))) (define "NextSiteFrom" ("NextSiteOnTrack" #2 from:#1)) (define "ThrowValue" (min (face 26) (face 27))) (game "Tourne-Case" (players 2) (equipment { ("BackgammonBoard" { (track "Track1" {6 0..5 7..12 25..20 18..13} P1 directed:True) (track "Track2" {19 13..18 20..25 12..7 5..0} P2 directed:True)}) (dice d:6 num:2) (piece "Disc" Each (move (from (from)) (to ("NextSiteFrom" (from) ("ThrowValue")) if:(and (or (is Empty (to)) (and (= (to) (mapEntry "FinalPoint" Mover)) (no Pieces Next in:(sites {(mapEntry "FinalPoint" Mover)})))) (if (< 1 ("ThrowValue")) (no Pieces Mover in:(sites Track Mover from:("NextSiteFrom" (from) 1) to:("NextSiteFrom" (from) (- ("ThrowValue") 1)))) True)) (apply (if (and ("IsEnemyAt" (mapEntry "Opposite" (to))) ("IsSingletonStack" (mapEntry "Opposite" (to)))) (fromTo (from (mapEntry "Opposite" (to))) (to (mapEntry "Bar" Next)))))))) (map "FinalPoint" {(pair P1 13) (pair P2 0)}) (map "Bar" {(pair P1 6) (pair P2 19)}) (map "Opposite" { (pair 0 13) (pair 1 14) (pair 2 15) (pair 3 16) (pair 4 17) (pair 5 18) (pair 7 20) (pair 8 21) (pair 9 22) (pair 10 23) (pair 11 24) (pair 12 25) (pair 13 0) (pair 14 1) (pair 15 2) (pair 16 3) (pair 17 4) (pair 18 5) (pair 20 7) (pair 21 8) (pair 22 9) (pair 23 10) (pair 24 11) (pair 25 12)})}) (rules (start { (place Stack "Disc1" 6 count:3) (place Stack "Disc2" 19 count:3)}) (play ("RollMove" (forEach Piece top:True))) (end (if ("ThreePiecesOnFinalPoint") (result Mover Win))))) END
Construct a Ludii game based on the following description 2x7 board, with three store holes. Three players. One player, the Raja, owns the three central holes in each row, one player owns the holes to the left and the other player the holes to the right. Seven counters in each hole. Players alternate turns sowing the counters in an anti-clockwise direction. When the final counter lands in a hole, the contents of the following hole are picked up, and sowing continues. If the following hole is empty, the contents of the next hole after that one are captured. Also, if at any point during the sowing a hole contains four counters, they are immediately captured. Play continues until all of the counters have been captured. If a player cannot play, they pass their turn, until captures are no longer possible, at which point the last person who played captures the remaining counters. A new round begins. The Raja gives each of the other players one counter. Players fill their holes with their captured counters, seven per hole. Any holes which can not be filled with seven counters are out of play. Play continues as before. A player plays as the Raja for three turns in a row, after which point it rotates to the next player. Play continues until only one player can fill holes on the board, this player becoming the winner. ###
(define "FourOrLessPieceOnBoard" (> 4 (count in:(difference (sites Board) (sites Row 1))))) (define "HomeMover" (if (is Mover P1) ("HomeP1") (if (is Mover P2) ("HomeP2") ("HomeP3")))) (define "HomeP3" (if (> 3 (% (+ 1 (var "Round")) 9)) (sites {5 6 12 13}) (if (> 6 (% (+ 1 (var "Round")) 9)) (sites {0 1 7 8}) (sites {2 3 4 9 10 11})))) (define "HomeP2" (if (> 3 (% (+ 1 (var "Round")) 9)) (sites {2 3 4 9 10 11}) (if (> 6 (% (+ 1 (var "Round")) 9)) (sites {5 6 12 13}) (sites {0 1 7 8})))) (define "HomeP1" (if (> 3 (% (+ 1 (var "Round")) 9)) (sites {0 1 7 8}) (if (> 6 (% (+ 1 (var "Round")) 9)) (sites {2 3 4 9 10 11}) (sites {5 6 12 13})))) (define "NextHole" ("NextSiteOnTrack" 1 from:#1 "Track")) (define "PlayableSites" (sites (values Remembered "Playable"))) (game "Raja Pasu Mandiri" (players 3) (equipment { (board (merge { (rectangle 1 7) (shift 0 2 (rectangle 1 7)) (shift 3 1 (square 1)) (shift 1 1 (square 1)) (shift 5 1 (square 1))}) { (track "Track" "6,W,7,E" loop:True)} use:Vertex) (piece "Seed" Shared) (map {(pair P1 15) (pair P2 14) (pair P3 16)})}) (rules (start { (set Count 7 to:(difference (sites Board) (sites Row 1))) (set RememberValue "Playable" (difference (sites Board) (sites Row 1)))}) phases:{ (phase "Sowing" (play (or { (move Select (from (if ("SameTurn") (sites {(var "Replay")}) ("HomeMover")) if:(and (is Occupied (from)) (is In (from) ("PlayableSites")))) (then (do (set Var "NumSowed" (count at:(last To))) next:(sow apply:(if (< 1 (count at:(to))) (and (moveAgain) (set Var "Replay" (to))) (if (is Occupied ("NextHole" (to))) (fromTo (from (to)) (to (mapEntry Mover)) count:(count at:(to))))) skipIf:(not (is In (to) ("PlayableSites")))) (then (and (forEach Site (sites Track from:(last From) to:("NextSiteOnTrack" (var "NumSowed") from:(last From) "Track")) (if (= 4 (count at:(site))) (fromTo (from (site)) (to (mapEntry Mover)) count:4))) (set Var "NumSowed" 0))))))} (then (if ("FourOrLessPieceOnBoard") (and { (forEach Site (difference (sites Board) (sites Row 1)) (if (is Occupied (site)) (fromTo (from (site)) (to (mapEntry Mover)) count:(count at:(site))))) (if (and (= 6 (count Sites in:("HomeP1"))) (< 2 (count at:(mapEntry P1)))) (and (fromTo (from (mapEntry P1)) (to (mapEntry P2)) count:1) (fromTo (from (mapEntry P1)) (to (mapEntry P3)) count:1)) (if (and (= 6 (count Sites in:("HomeP2"))) (< 2 (count at:(mapEntry P2)))) (and (fromTo (from (mapEntry P2)) (to (mapEntry P1)) count:1) (fromTo (from (mapEntry P2)) (to (mapEntry P3)) count:1)) (if (and (= 6 (count Sites in:("HomeP3"))) (< 2 (count at:(mapEntry P3)))) (and (fromTo (from (mapEntry P3)) (to (mapEntry P1)) count:1) (fromTo (from (mapEntry P3)) (to (mapEntry P2)) count:1))))) (set Var "Round" (+ 1 (var "Round"))) (forget Value "Playable" All)}))))) (end { (if ("FourOrLessPieceOnBoard") { (if (> 7 (count at:(mapEntry P1))) (result P1 Loss)) (if (> 7 (count at:(mapEntry P2))) (result P2 Loss)) (if (> 7 (count at:(mapEntry P3))) (result P3 Loss))})}) (nextPhase ("FourOrLessPieceOnBoard") "BetweenRounds")) (phase "BetweenRounds" (play (if (not (all Sites ("HomeMover") if:(is Occupied (site)))) (if (<= 7 (count at:(mapEntry Mover))) (move (from (mapEntry Mover)) (to ("HomeMover")) count:7 (then (remember Value "Playable" (last To))))))) (nextPhase (all Passed) "Sowing"))})) END
Describe the mechanics of the following Ludii game (define "NextHoleFrom" ("NextSiteOnTrack" 1 from:#1)) (define "HaveHolesWithMoreThanOneCounter" (not (all Sites (forEach (sites Mover "Home") if:(< 1 (count at:(site)))) if:(= 0 (count at:(site)))))) (define "NoPiece" (all Sites (sites Player "Home") if:(= 0 (count at:(site))))) (define "Columns" 10) (game "Msuwa wa Kunja" (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 Top) (sites Bottom)))) (play (if (and ("SameTurn") (< 0 (var))) (move Remove (forEach (sites Next "Home") if:(< 0 (count at:(site)))) (then (and (if (> (var) 1) (moveAgain)) (set Var (- (var) 1))))) (if ("HaveHolesWithMoreThanOneCounter") (move Select (from (if ("SameTurn") "LastHoleSowed" (sites Mover "Home")) if:(< 1 (count at:(from)))) (then (sow "Track" owner:(mover) apply:(if (< 1 (count at:(to))) (moveAgain) (if (is In (to) (sites Mover "Inner")) (if (< 0 (count at:("OppositePit" (to)))) (and (remove ("OppositePit" (to))) (if (< 0 (count at:("OppositeOuterPit" (to)))) (and { (remove ("OppositeOuterPit" (to))) (set Var 2) (moveAgain)}))))))))) (move Select (from (sites Mover "Home") if:(and (= 1 (count at:(from))) (= 0 (count at:("NextHoleFrom" (from)))))) (then (sow "Track" owner:(mover) apply: (if (is In (to) (sites Mover "Inner")) (if (< 0 (count at:("OppositePit" (to)))) (and (remove ("OppositePit" (to))) (if (< 0 (count at:("OppositeOuterPit" (to)))) (and { (remove ("OppositeOuterPit" (to))) (set Var 2) (moveAgain)}))))))))))) (end (forEach NonMover if:("NoPiece") (result Player Loss))))) ###
4x10-20 holes, with even numbers. Two counters in each hole in the outer row. Sowing occurs in an anti-clockwise direction. When the final counter lands in an occupied hole, these are picked up and sowing continues. When the final counter lands in an empty hole in the inner row, the counters in the opposite hole in the opponent's inner row are captured. If counters are captured from the inner row, and there are also counters in the outer row, the counters in the outer row are also captured. If counters in the inner and outer row are captured, the player may also capture counters from two other holes on the opponent's side of the board. Single counters cannot be sown until there are no holes with multiple counters on the player's side of the board, and then single counters may only be sown into empty holes. Play continues until one player captures all of their opponent's counters, thus winning the game. Each row has 10 holes. END
Construct a global Ludii definition which fulfills the following requirements. Defines a sequence of hop move in all the orthogonal directions over an enemy to an empty site. ###
(define "HopOrthogonalSequenceCapture" (move Hop Orthogonal (between #1 #2 if:("IsEnemyAt" (between)) (apply (remove (between) #3))) (to if:(is Empty (to))) (then (if (can Move (hop (from (last To)) Orthogonal (between #1 #2 if:(and (not (is In (between) (sites ToClear))) ("IsEnemyAt" (between)))) (to if:(is Empty (to))))) (moveAgain))))) END
Construct a Ludii game based on the following description DROP - A player, on his turn, can drop a stone on an empty cell. SHIFT - Instead of dropping a stone, the player may decide to shift one row or column, one cell left/right (for rows) or up/down (for columns). All stones are shifted on the chosen direction. If a stone is shifted off-board, it is placed on the other end of the shifted row/column (so, for shift purposes, the board is a Torus). KO rule- If a player has just shifted, the next player cannot shift that row/column. GOAL - A player wins when he makes a 5 in-a-row (orthogonal or diagonal). If a shift give both players a 5 in-a-row, wins the player that made that shift. ###
(define "IsLine" (not (all Sites (sites Occupied by:#1) if:(not (is Line 5 through:(site)))))) (define "ShiftDown" (move Select (from (forEach (sites Row (- (count Rows) 1)) if:(not (all Sites (sites Column (column of:(site))) if:(is Empty (site)))))) (to (ahead (from) S) if:(not (is In (+ (from) (to)) (sites Pending)))) (then (and { (forEach Site (sites Column (column of:(last From))) (remove (site))) (forEach Site (sites Column (column of:(last From))) (if (!= (ahead (site) S) (site)) (add (piece (what at:(site))) (to (ahead (site) S))) (add (piece (what at:(site))) (to (coord row:(- (count Rows) 1) column:(column of:(last From))))))) (set Pending (+ (last From) (last To))) (set Pending (+ (coord row:(- (count Rows) 1) column:0) (ahead (coord row:(- (count Rows) 1) column:0) N)))})))) (define "ShiftUp" (move Select (from (forEach (sites Row 0) if:(not (all Sites (sites Column (column of:(site))) if:(is Empty (site)))))) (to (ahead (from) N) if:(not (is In (+ (from) (to)) (sites Pending)))) (then (and { (forEach Site (sites Column (column of:(last From))) (remove (site))) (forEach Site (sites Column (column of:(last From))) (if (!= (ahead (site) N) (site)) (add (piece (what at:(site))) (to (ahead (site) N))) (add (piece (what at:(site))) (to (coord row:0 column:(column of:(last From))))))) (set Pending (+ (last From) (last To))) (set Pending (+ (coord row:(- (count Rows) 1) column:(column of:(last To))) (ahead (coord row:(- (count Rows) 1) column:(column of:(last To))) S)))})))) (define "ShiftRight" (move Select (from (forEach (sites Column 0) if:(not (all Sites (sites Row (row of:(site))) if:(is Empty (site)))))) (to (ahead (from) E) if:(not (is In (+ (from) (to)) (sites Pending)))) (then (and { (forEach Site (sites Row (row of:(last From))) (remove (site))) (forEach Site (sites Row (row of:(last From))) (if (!= (ahead (site) E) (site)) (add (piece (what at:(site))) (to (ahead (site) E))) (add (piece (what at:(site))) (to (coord row:(row of:(last From)) column:0))))) (set Pending (+ (last From) (last To))) (set Pending (+ (coord row:(row of:(last From)) column:(- (count Columns) 1)) (ahead (coord row:(row of:(last From)) column:(- (count Columns) 1)) W)))})))) (define "ShiftLeft" (move Select (from (forEach (sites Column (- (count Columns) 1)) if:(not (all Sites (sites Row (row of:(site))) if:(is Empty (site)))))) (to (ahead (from) W) if:(not (is In (+ (from) (to)) (sites Pending)))) (then (and { (forEach Site (sites Row (row of:(last From))) (remove (site))) (forEach Site (sites Row (row of:(last From))) (if (!= (ahead (site) W) (site)) (add (piece (what at:(site))) (to (ahead (site) W))) (add (piece (what at:(site))) (to (coord row:(row of:(last From)) column:(- (count Columns) 1)))))) (set Pending (+ (last From) (last To))) (set Pending (+ (coord row:(row of:(last From)) column:0) (ahead (coord row:(row of:(last From)) column:0) E)))})))) (game "Kassle" (players 2) (equipment { (board (square 5)) (piece "Square" Each)}) (rules (play (or { (move Add (to (sites Empty))) ("ShiftLeft") ("ShiftRight") ("ShiftUp") ("ShiftDown")})) (end { (if (and ("IsLine" P1) ("IsLine" P2)) (result Mover Win)) (if ("IsLine" P1) (result P1 Win)) (if ("IsLine" P2) (result P2 Win))}))) END
Construct a Ludii game based on the following description Definitions Group: Either a single stone (a group of one) or any number of stones of the same color connected through a continuous series of orthogonal adjacencies. Rules Scaffold is a drawless connection game played on the intersections of a square grid using stones (as in Go). Black is trying to connect N-S edges of the board, White E-W with an orthogonally connected group. First player places a single black stone on any grid intersection, after which the second player decides which color they will play (pie rule). Players then alternate taking turns. On your turn, place a stone of your color on an empty point. Then, if possible, place a stone of your color on an empty point that is orthogonally adjacent to two groups of your color, and keep making such placements until no more are possible. A 12x12 board is currently selected ###
(define "Connect" (do (move Add (to (sites Around (sites Occupied by:Mover) Empty) (apply (set Var "NumberOfFriendlyGroupsBeforePlacement" (count Groups Orthogonal if:(is Mover (who at:(to)))))))) ifAfterwards:(< (count Groups Orthogonal if:(is Mover (who at:(to)))) (var "NumberOfFriendlyGroupsBeforePlacement")))) (game "Scaffold" (players 2) (equipment { (board (square 12) use:Vertex) (piece "Marker" Each) (regions P1 {(sites Side N) (sites Side S)}) (regions P2 {(sites Side W) (sites Side E)})}) (rules (meta (swap)) (play (if (< 0 (count MovesThisTurn)) ("Connect") (move Add (to (sites Empty))) (then (if (can Move ("Connect")) (moveAgain))))) (end (if (is Connected Orthogonal Mover) (result Mover Win))))) END
Construct a Ludii game based on the following description 9x9 board played on the intersections, with diagonals for each 3x3 square. Forty pieces per player, one playing as white, the other as red, arranged on opposite sides of the board, each player's pieces taking up the first through fourth ranks of spaces, plus their right half of the fifth rank. The central spot remains empty. Players alternate turns by moving a piece to an adjacent empty spot along the lines on the board. A player may capture an opponent's piece by hopping over one adjacent piece if there is an empty spot behind it along a line on the board. The player who captures all of the opponent's pieces wins. ###
(game "Ratti-Chitti-Bakri" (players 2) (equipment { ("AlquerqueBoard" 9 9) (piece "Marker" Each (or ("HopCapture") ("StepToEmpty")))}) (rules ("BeforeAfterCentreSetup" "Marker1" "Marker2") (play (forEach Piece)) (end ("ForEachPlayerNoPiecesLoss")))) END
Modify the Ludii game according to the following option changes: Order 3 board -> Order 5 board Hex N+1 / N-1 Grid -> Square Grid 2N-2: Capture-compare all 8 adjacent directions. Scoring - groups connect only in the 4 edge-edge directions. 3 players -> 4 players (define "ColourBackground" (colour 136 175 96)) (define "SquareDiagonal" (board (square (- (* 2 3) 2)) use:Vertex)) (define "SquareGrid" (board (square 3) use:Cell)) (define "TriSquare" (board (tiling T33434 (- 3 2)) use:Vertex)) (define "HexCell" (board (hex Hexagon 3) use:Cell)) (define "Hex2Limp" (board (hex (- 3 1) (+ 3 1)) use:Cell)) (define "HexLimp" (board (hex Limping (- 3 1)) use:Cell)) (define "BoardUsed" "Hex2Limp") (define "ConnectionDirection" Orthogonal) (define "ScoreConnection" Orthogonal) (define "Anemone" (or { (move Pass) (move Claim (to (sites Empty))) (forEach Site (difference (difference (sites Board) (sites Empty)) (sites Occupied by:Mover)) (if ("LessQtyAroundSiteThanAnother" (who at:(site))) (move Remove (site) (then (claim (to (last To)))))))} (then ("Scoring" ("StoneCount" (player)))))) (define "LessQtyAroundSiteThanAnother" (> (max 0 (count Pieces of:#1 in:(sites Around (site) "ConnectionDirection"))) (max 0 (count Pieces of:(mover) in:(sites Around (site) "ConnectionDirection"))))) (define "StoneCount" (count Sites in:(sites Occupied by:Player))) (define "GroupCount" (max 0 (max (sizes Group "ScoreConnection" of:#1)))) (define "Tied4FirstPlace" (= (#1) (max (difference (values Remembered "Scores") #1)))) (define "LargerGroup" (max 0 (max (difference (sizes Group "ScoreConnection" of:#1) (sizes Group "ScoreConnection" of:#2))))) (define "CascadeLoses" (max 0 (- ("LargerGroup" (value) (player)) ("LargerGroup" (player) (value))))) (define "CascadeWins" (max 0 (- ("LargerGroup" (player) (value)) ("LargerGroup" (value) (player))))) (define "Scoring" (if (all Passed) (do (forEach Player (remember Value "Scores" #1)) next:(do (forEach Player (if ("Tied4FirstPlace" #1) (and (remember Value "Tied" (player)) (set Score Player #1)) (set Score Player #1))) next:(do (forEach Value (values Remembered "Tied") (forEach (players All if:(is In (player) (values Remembered "Tied"))) (addScore (player (player)) ("CascadeLoses")))) next:(forget Value "Scores" All (then (forget Value "Tied" All)))))) (forEach Player (set Score Player #1)))) (game "Windflowers" (players 3) (equipment { "BoardUsed" (piece "Ball" Each)}) (rules (start (set Score Each 0)) (play "Anemone") (end (if (all Passed) (byScore))))) ###
(define "ColourBackground" (colour 136 175 96)) (define "SquareDiagonal" (board (square (- (* 2 5) 2)) use:Vertex)) (define "SquareGrid" (board (square 5) use:Cell)) (define "TriSquare" (board (tiling T33434 (- 5 2)) use:Vertex)) (define "HexCell" (board (hex Hexagon 5) use:Cell)) (define "Hex2Limp" (board (hex (- 5 1) (+ 5 1)) use:Cell)) (define "HexLimp" (board (hex Limping (- 5 1)) use:Cell)) (define "BoardUsed" "SquareDiagonal") (define "ConnectionDirection" All) (define "ScoreConnection" Orthogonal) (define "Anemone" (or { (move Pass) (move Claim (to (sites Empty))) (forEach Site (difference (difference (sites Board) (sites Empty)) (sites Occupied by:Mover)) (if ("LessQtyAroundSiteThanAnother" (who at:(site))) (move Remove (site) (then (claim (to (last To)))))))} (then ("Scoring" ("StoneCount" (player)))))) (define "LessQtyAroundSiteThanAnother" (> (max 0 (count Pieces of:#1 in:(sites Around (site) "ConnectionDirection"))) (max 0 (count Pieces of:(mover) in:(sites Around (site) "ConnectionDirection"))))) (define "StoneCount" (count Sites in:(sites Occupied by:Player))) (define "GroupCount" (max 0 (max (sizes Group "ScoreConnection" of:#1)))) (define "Tied4FirstPlace" (= (#1) (max (difference (values Remembered "Scores") #1)))) (define "LargerGroup" (max 0 (max (difference (sizes Group "ScoreConnection" of:#1) (sizes Group "ScoreConnection" of:#2))))) (define "CascadeLoses" (max 0 (- ("LargerGroup" (value) (player)) ("LargerGroup" (player) (value))))) (define "CascadeWins" (max 0 (- ("LargerGroup" (player) (value)) ("LargerGroup" (value) (player))))) (define "Scoring" (if (all Passed) (do (forEach Player (remember Value "Scores" #1)) next:(do (forEach Player (if ("Tied4FirstPlace" #1) (and (remember Value "Tied" (player)) (set Score Player #1)) (set Score Player #1))) next:(do (forEach Value (values Remembered "Tied") (forEach (players All if:(is In (player) (values Remembered "Tied"))) (addScore (player (player)) ("CascadeLoses")))) next:(forget Value "Scores" All (then (forget Value "Tied" All)))))) (forEach Player (set Score Player #1)))) (game "Windflowers" (players 4) (equipment { "BoardUsed" (piece "Ball" Each)}) (rules (start (set Score Each 0)) (play "Anemone") (end (if (all Passed) (byScore))))) END
Construct a Ludii game based on the following description One player plays with one piece \ The coyote can jump to capture. ###
(game "Coyote" (players 2) (equipment { (board (rectangle 5 5 diagonals:Radiating) use:Vertex) (piece "Sheep" P1 ("StepToEmpty")) (piece "Coyote" P2 (or ("HopCapture") (if ("SameTurn") (move Pass) ("StepToEmpty"))))}) (rules (start { (place "Sheep1" (union (expand (sites Bottom)) (sites {"A3" "E3"}))) (place "Coyote2" (centrePoint))}) (play (forEach Piece)) (end ("NoMovesLossAndLessNumPiecesPlayerLoss" P1 9)))) END
Construct a Ludii game based on the following description 4x12-20 board. Play begins with a number of counters that is three times the number of holes in a row minus two for a game with an even number of holes in a row; three times the number of holes minus one for odd. Counters are distributed beginning in the leftmost hole in the outer row, placing two counters in each hole in an anti-clockwise direction. Play begins from any of the player's holes, sowing anti-clockwise. When the final counter lands in an occupied hole, these are picked up and sowing continues, unless a capture can be made. Captures are made when the final counter falls into an occupied hole in the inner row, and the opponent's hole opposite contains counters. If it is, they are captured, and if the hole in to outer row opposite also contains counters, these are also captured. These are then sown from the hole following the one from which the capture occurred. If the final counter falls into an empty hole, the turn is over. Single counters cannot be sown. Play ends when one player cannot move. Each player has 12 holes. ###
(define "PiecesOwnedBy" (+ (count Cell at:(handSite #1)) (count in:(sites #1)))) (define "MoveAgainAfterCapture" (is Pending)) (define "PlayFromNextHole" (sites {(value Pending)})) (define "NextHole" (if (is Mover P1) ("NextSiteOnTrack" 1 from:(to) "Track1") ("NextSiteOnTrack" 1 from:(to) "Track2"))) (define "Columns" 12) (game "Owela (Benguela)" (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)) (regions "InnerInit" P1 (sites {19..23})) (regions "InnerInit" P2 (sites {24..28})) (piece "Seed" Shared) (hand Each)}) (rules (start (set Count 2 to:(union {(sites P1 "Outer") (sites P1 "InnerInit") (sites P2 "Outer") (sites P2 "InnerInit")}))) (play (move Select (from (if ("SameTurn") (if "MoveAgainAfterCapture" "PlayFromNextHole" "LastHoleSowed") (sites Mover "Home")) if:(> (count at:(from)) 1)) (then (sow "Track" owner:(mover) apply:(if (> (count at:(to)) 1) (if (and (is In (to) (sites Mover "Inner")) (> (count at:("OppositePit" (to))) 0)) (and { (fromTo (from (to)) (to (handSite Mover)) count:(count at:(to))) (fromTo (from ("OppositePit" (to))) (to (handSite Mover)) count:(count at:("OppositePit" (to)))) (if (> (count at:("OppositeOuterPit" (to))) 0) (fromTo (from ("OppositeOuterPit" (to))) (to (handSite Mover)) count:(count at:("OppositeOuterPit" (to))))) (if (> (count at:"NextHole") 1) (and (set Pending "NextHole") (moveAgain)))}) (moveAgain))))))) (end ("MancalaByScoreWhen" (no Moves Mover))))) END
Construct a global Ludii definition which fulfills the following requirements. Defines a sequence of hop move in all the rotational directions over an enemy to an empty site. ###
(define "HopRotationalSequenceCapture" (move Hop Rotational (between #1 #2 if:("IsEnemyAt" (between)) (apply (remove (between) #3))) (to if:(is Empty (to))) (then (if (can Move (hop (from (last To)) Rotational (between #1 #2 if:(and (not (is In (between) (sites ToClear))) ("IsEnemyAt" (between)))) (to if:(is Empty (to))))) (moveAgain))))) END