prompt
stringlengths
71
4.65k
completion
stringlengths
34
5.1k
Construct a Ludii game based on the following description 5x5 board, played on intersections of the lines, with diagonals for each quadrant of the board. One player plays with a tiger piece, placed anywhere on the board. The other player plays with 21 goats, placed on the central point of the board. The goats move first. Goats may move one at a time to any adjacent vacant spot along the lines of the board. The tiger moves in the same manner, but also may capture a piece by hopping over it to an empty space immediate on the opposite side of a goat. The tiger may hop the stack of goats, but may only capture one. The goal of the goats is to surround the tiger so it cannot move. The goal of the tiger is to capture all the goats. ###
(game "Bagha Guti" (players 2) (equipment { ("AlquerqueBoard" 5 5) (piece "Goat" P2 "StepToEmpty") (piece "Tiger" P1 (or ("StepToEmpty") ("HopCapture"))) (hand P1)}) (rules (start { (place Stack "Goat2" 12 count:21) (place "Tiger1" (handSite P1))}) phases:{ (phase "Opening" P1 (play (move (from (handSite Mover)) (to (sites Empty)))) (nextPhase "Movement")) (phase "Movement" (play (forEach Piece top:True)))} (end ("NoMovesP1NoPiecesP2")))) END
Construct a Ludii game based on the following description The game is played on a triangle board divided in half on its height and then in thirds with lines crossing the height perpendicularly. One player plays as the tiger, and the other plays as seven leopards. The tiger plays their piece on a point where lines intersect first, and then on subsequent turns the leopards are placed one-by-one. Moves occur along the lines to an adjacent intersection. The tiger captures may capture a leopard by hopping over it. The tiger's goal is to capture four of the leopards; the leopards' goal is to block the tiger so it cannot move. Played on the board described in Ludovici and Parker. ###
(game "Hat Diviyan Keliya" (players 2) (equipment { (board (scale 1 2 (wedge 4)) use:Vertex) (hand Each) (piece "Tiger" P1 (or "HopCapture" "StepToEmpty")) (piece "Leopard" P2 "StepToEmpty")}) (rules (start { (place "Tiger1" (handSite P1) count:1) (place "Leopard2" (handSite P2) count:7)}) phases:{ (phase "Placement" (play (move (from (handSite Mover)) (to (sites Empty)))) (nextPhase Mover ("HandEmpty" Mover) "Movement")) ("PhaseMovePiece" "Movement" (end ("NoMovesLossAndLessNumPiecesPlayerLoss" P2 3)))})) END
Construct a Ludii game based on the following description 8x8 Draughts board. One player plays with a single fox, the other with twelve hens, played on the white squares. The hens begin on the first three rows; the fox may begin on whatever spot the player chooses. Hens move one space forward diagonally, the fox moves one space diagonally forward or backward. The fox may capture a hen by hopping over it to an empty space diagonally on the other side of it. The hens win by blocking the fox from being able to move; the fox wins by capturing all the hens. ###
(game "Jeu de Renard" (players 2) (equipment { (board (square 8)) (piece "Fox" P1 (or "StepDiagonalToEmpty" "HopDiagonalCapture")) (piece "Hen" P2 N ("StepToEmpty" (directions {FR FL}))) (hand P1)}) (rules (start { (place "Fox1" (handSite P1)) (place "Hen2" (difference (expand (sites Bottom) steps:2) (sites Phase 0)))}) phases:{ (phase "Placement" P1 (play (move (from (handSite Mover)) (to (difference (sites Empty) (sites Phase 0))))) (nextPhase "Movement")) ("PhaseMovePiece" "Movement")} (end ("NoMovesP1NoPiecesP2")))) END
Construct a Ludii game based on the following description 2x6 board. Four counters in each hole. Sowing occurs in an anti-clockwise direction, beginning from any hole in the player's row. When the final counter lands in a hole in the opponent's row containing three (four counting the last counter dropped into it), these are taken. In addition, the contents of any hole in the opponent's row which a player causes to contain four counters are captured. When the final counter lands in an empty hole, the turn ends. When the final counter lands in an occupied hole containing a number of counters other than three, the counters are picked up and sowing continues. If sowing reaches the original hole from which the sowing began, this hole is skipped over. A player must play so that the opponent has counters with which to play, if possible. ###
(define "PiecesOwnedBy" (+ (count Cell at:(handSite #1)) (count in:(sites #1)))) (game "Wouri" (players 2) (equipment { (mancalaBoard 2 6 store:None (track "Track" "0,E,N,W" loop:True)) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (piece "Seed" Shared) (hand Each)}) (rules (start (set Count 4 to:(sites Track))) (play (do (move Select (from (if ("SameTurn") "LastHoleSowed" (sites Mover)) if:(< 0 (count at:(from)))) (then (sow apply:(if (and (is In (to) (sites Next)) (= (count at:(to)) 4)) (fromTo (from (to)) (to (handSite Mover)) count:(count at:(to)) (then (forEach Site (if (is Mover P1) (sites P2) (sites P1)) (if (= (count at:(site)) 4) (fromTo (from (site)) (to (handSite Mover)) count:(count at:(site))))))) (if (< 1 (count at:(to))) (moveAgain))) includeSelf:False))) ifAfterwards:(< 0 (count in:(if (is Mover P1) (sites P2) (sites P1)))))) (end ("MancalaByScoreWhen" (no Moves Mover))))) END
Construct a Ludii game based on the following description 9x9 board. Nine horse-shaped pieces per player. Pieces begin in the spaces along opposite sides of the board. Pieces move orthogonally one space and then diagonally another, jumping over any intervening pieces. A player may capture one of the opponent's pieces by moving onto a space occupied by the opponent's piece. The goal is to move to the central space on the board. To win a knight as to reach the central square. ###
(define "CaptureToPieceAndCheckVictory" (apply (if ("IsEnemyAt" (to)) (remove (to))))) (game "Jeson Mor" (players 2) (equipment { (board (square 9)) (piece "Knight" Each (move Leap "KnightWalk" (to if:(not ("IsFriendAt" (to))) "CaptureToPieceAndCheckVictory")))}) (rules (start { (place "Knight1" (sites Bottom)) (place "Knight2" (sites Top))}) (play (forEach Piece)) (end { (if (no Pieces Next) (result Mover Win)) (if (is In (last To) (sites Centre)) (result Mover Win))}))) END
Construct a Ludii game based on the following description Played on a standard Backgammon board. Each player starts with fifteen pieces on the starting point of their track. Two six-sided dice. The pieces move around the board in opposite directions in a horseshoe-shaped track. Each player rolls one die. The player who rolls highest goes first. The player then rolls two die to begin play. The numbers on the two dice constitute separate moves; i.e. a piece must move the full value of an individual die. One piece may move the combined total of the two die. Doubles are played twice. A player must use both numbers of a roll if possible, or all four numbers in the case of doubles. If a player lands on a point occupied by a single opposing piece, the opponent’s piece is trapped until the trapping player removes their piece. A piece may not be moved to a point occupied by two or more of the opponent's pieces. The player cannot move a piece to a point where the opponent has trapped another of the player's pieces. Once a player has moved all fifteen of their pieces into the their home section of the board (that is, the six points at the end of the player's track), the player may begin bearing off. A player cannot bear off when the player has one or more pieces trapped inside the their home section. A player bears off by rolling a number equal to the number of points left in the track of a piece, plus one. If there is no piece on the point indicated by the roll, then the player must make a legal move using a piece that will not remove it from the board. If there are no pieces available to fulfill this condition, the player must remove a piece that is furthest from the goal. The first player to bear off all fifteen pieces wins the game. If the last piece belonging to player remains in the starting position is trapped by the opponent before it has left the starting position, the player loses. The only exception is if the opponent still has pieces on their starting position. A game in which both players' respective pieces in the starting position are trapped is a draw. In Tavli, in subsequent rounds, the winner of the previous round plays first. The game is also typically played with a point system, where points are lost based on the winning conditions. Players lose two points by losing if they haven't yet borne off any of their pieces, or one point if they have borne off at least one piece. A player who loses because their final piece in the starting position was trapped loses two points. ###
(define "MotherCheckerP2Pinned" (and ("IsPieceAt" "Disc2" P2 25 level:0) ("IsPieceAt" "Disc1" P1 25 level:1))) (define "MotherCheckerP1Pinned" (and ("IsPieceAt" "Disc1" P1 12 level:0) ("IsPieceAt" "Disc2" P2 12 level:1))) (define "HaveAPieceAndCanEscape" (and ("IsFriendAt" (site)) (< (trackSite Move from:(site) steps:(pips)) 0))) (define "SetScoreOf" (score #1 (if (is Mover #1) (if (= ("NumPiece" #2) 15) 2 1) 0))) (define "NotEmptyAndNotOffTheBoard" (and (is Occupied (site)) ("IsNotOffBoard" ("NextSiteFrom" (site))))) (define "CanEscape" ("IsEndTrack" ("NextSiteFrom" (site)))) (define "NumPiece" (size Stack in:(sites Occupied by:#1))) (define "AllPieceEscaped" (no Pieces Mover)) (define "MoveAPieceIf" (forEach Die replayDouble:True if:#1 ("MoveAPiece" #2))) (define "MoveAPiece" (move (from #1) (to ("NextSiteFrom" #1) if:("NoEnemyOrOnlyOne" (to))))) (define "DieNotUsedAndNoEscapeAndNotOffTheTrack" (and { ("DieNotUsed") ("IsNotOffBoard" ("NextSiteFrom" (from))) ("IsNotEndTrack" ("NextSiteFrom" (from)))})) (define "RemoveAPiece" (move Remove (from))) (define "AllPieceInHome" ("AllOwnedPiecesIn" (sites Mover))) (define "NextSiteFrom" ("NextSiteOnTrack" (pips) from:#1)) (game "Plakoto" (players 2) (equipment { ("BackgammonBoard" "BackgammonTracks") (dice num:2) (regions P1 { 20..25}) (regions P2 { 7..12}) (piece "Disc" Each ("MoveAPieceIf" "DieNotUsedAndNoEscapeAndNotOffTheTrack" (from)))}) (rules (start { (place Stack "Disc1" 12 count:15) (place Stack "Disc2" 25 count:15)}) (play ("RollEachNewTurnMove" (if "AllPieceInHome" (forEach Die replayDouble:True if:("DieNotUsed") (forEach Site (sites Occupied by:Mover) (if ("NotEmptyAndNotOffTheBoard") (if ("CanEscape") ("RemoveAPiece") ("MoveAPiece" (site)))) noMoveYet:(firstMoveOnTrack "Track" Mover (if "HaveAPieceAndCanEscape" "RemoveAPiece")) (then ("ReplayNotAllDiceUsed")))) (max Distance "Track" Mover (forEach Piece top:True (then ("ReplayNotAllDiceUsed"))))))) (end { (if ("AllPieceEscaped") (byScore { ("SetScoreOf" P1 P2) ("SetScoreOf" P2 P1)})) (if ("MotherCheckerP1Pinned") (byScore { (score P1 0) (score P2 2)})) (if ("MotherCheckerP2Pinned") (byScore { (score P1 2) (score P2 0)}))}))) END
Construct a Ludii game based on the following description The main track of the board is a row of eleven squares, with both end squares and the central square marked with an X. On the left side, a row of four squares runs under and adjacent to the first four squares of the central row. Perpendicular to the left end square of the central row, there is a square and then three triangles. On the opposite end, below and perpendicular to the right end of the central track is a row of four squares, curving slightly to the right. Above the end square of the central row, a triangular space, adjacent to an oval divided into three. Two teams with two players on each team. Players each start from a different point: one from the right square in the bottom left row, one from one of the triangle spaces on the left, one from the end of the curving track on the right, and the other from one of the spaces in the oval. Three pieces per player. Five sticks, with a flat side and a curved sides, used as dice. The value of a throw is equal to the number of flat sides that land face up; five curved sides up = 5. Players move their pieces from their entry points onto the central track of the board and progressing to the opposite end of the board from where they started. Pieces must move backward when they reach the end of the central track. When a player's piece lands on a space occupied by an opponent's piece, the opponent's piece is taken. A piece resting on a space marked with an X is safe from capture. The team to successfully capture all of their opponent's pieces wins. ###
(define "UpdateState" (if (and (= (state at:(last To)) 0) (is In (last To) (sites "CentralTrack"))) (if (or (is Mover P1) (is Mover P2)) (set State at:(last To) 2) (set State at:(last To) 1)))) (define "SiteToMoveOnTrack" (if (= (state at:(from)) 0) ("NextSiteOnTrack" ("ThrowValue") "Track") (if (= (state at:(from)) 1) ("NextSiteOnTrack" ("ThrowValue") "TrackLeft") ("NextSiteOnTrack" ("ThrowValue") "TrackRight")))) (define "ThrowValue" (mapEntry "Throw" (count Pips))) (game "Los Palos" (players 4) (equipment { (board (merge { (shift 11.3 -3.7 (graph vertices:{ {0 0} {1.3 -1} {2 0} {1.1 0.6}} edges:{{0 1} {1 2} {2 3} {3 0}})) (shift 10.4 -2.4 (graph vertices:{ {0 0} {0.9 -1.3} {2 -0.7} {1 0.4}} edges:{{0 1} {1 2} {2 3} {3 0}})) (shift 10.1 -1.1 (graph vertices:{ {0 0} {0.3 -1.3} {1.3 -0.9} {1 0.2}} edges:{{0 1} {1 2} {2 3} {3 0}})) (shift 10 0 (graph vertices:{ {0 0} {0.1 -1.1} {1.1 -0.9} {1 0}} edges:{{0 1} {1 2} {2 3} {3 0}})) (shift 11 1.87 (graph vertices:{ {0 0} {0.5 0.5} {0 1}} edges:{{0 1} {1 2} {2 0}})) (shift 10 1.87 (graph vertices:{ {0 0} {-0.5 0.5} {0 1}} edges:{{0 1} {1 2} {2 0}})) (shift 10 1.87 (square 1)) (shift 10 1 (tri 1)) (shift 1 2 (graph vertices:{ {1 0} {-0.5 0.87} {0 0}} edges:{{0 1} {1 2} {2 0}})) (shift 0 2 (graph vertices:{ {-1 0} {0.5 0.87} {0 0}} edges:{{0 1} {1 2} {2 0}})) (shift 0 2 (tri 1)) (shift 0 1 (square 1)) (rectangle 1 11) (shift 0 -1 (rectangle 1 4))}) { (track "Track1" "20,W,N1,E" P1 directed:True) (track "Track2" "11,12,S2,E" P2 directed:True) (track "Track3" "6,E1,9,S1,W" P3 directed:True) (track "Track4" "0,1,2,3,4,W" P4 directed:True) (track "TrackRight" "14,E,W" directed:True) (track "TrackLeft" "4,W,E" directed:True)}) ("StickDice" 5) (piece "Marker" Each (move (from (from)) (to ("SiteToMoveOnTrack") if:(or (and (not (is In (to) (sites "SafeSites"))) ("IsEnemyAt" (to))) (is Empty (to))) (apply (if ("IsEnemyAt" (to)) (remove (to))))) (then ("UpdateState")))) (map "Throw" {(pair 0 5) (pair 1 1) (pair 2 2) (pair 3 3) (pair 4 4) (pair 5 5)}) (map "EntryPoint" {(pair 1 20) (pair 2 11) (pair 3 6) (pair 4 0)}) (regions "SafeSites" (sites {4 14 23})) (regions "CentralTrack" (sites {4 5 14 15 19 21..26}))}) (rules (start { (place "Marker1" (mapEntry "EntryPoint" P1) count:3) (place "Marker2" (mapEntry "EntryPoint" P2) count:3) (place "Marker3" (mapEntry "EntryPoint" P3) count:3) (place "Marker4" (mapEntry "EntryPoint" P4) count:3) (set Team 1 {P1 P3}) (set Team 2 {P2 P4})}) (play ("RollMove" (forEach Piece))) (end ("CaptureAllTeam")))) END
Construct a Ludii game based on the following description The game is played in turns. White starts by placing the breadcrumb on any empty space on the board. Now, any and every duck in the six lines radiating out from the breadcrumb move straight toward the breadcrumb as far as they can. There will never be more than one duck in a space, and the ducks stop just before they reach the breadcrumb (a fish gets it first). Then the turn passes to the next player. From now on, on your turn, you must take the breadcrumb and place it on an empty space of the board that is not on any of the six lines radiating from the breadcrumb's previous location and then move the ducks toward the breadcrumb as usual. The game ends when all the ducks of one colour have gathered into a single connected group. In case of both groups (White and Black) are created simultaneously, the player who placed the game-ending breadcrumb wins. ###
(game "Feed the Ducks" (players 2) (equipment { (board (hex 5)) (piece "Marker" Each) (piece "Disc" Neutral)}) (rules (start { (place "Marker1" {"A5" "C7" "D8" "F9" "H9" "I9" "I7" "I5" "F2" "C1" "A1" "A2"}) (place "Marker2" {"A4" "A3" "B1" "D1" "E1" "G3" "H4" "I6" "I8" "G9" "E9" "B6"})}) phases:{ (phase "Throw Bread" (play (move Add (piece "Disc0") (to (sites Empty)) (then (attract (from (last To)))))) (nextPhase "Move Bread")) (phase "Move Bread" (play (move (from (sites Occupied by:Neutral)) (to (difference (sites Empty) (sites Direction from:(last To)))) (then (attract (from (last To)))))))} (end { ("SingleGroupWin" P1) ("SingleGroupWin" P2)}))) END
Construct a Ludii game based on the following description Lava is a territorial stacking game for two players, Red and Black. Play using a Hexhex board size 4 or 5, and a sufficient supply of Red/Black stacking checkers. To setup, place one Red and one Black checker in opposite corners of the hex hex board. Definitions: Stack: One or more checkers occupying the same cell. Control: You control a stack if your color is on top of it. Players take turns, with Black moving first. Each turn, take N checkers (where N is any number from 1 to stack size) from the top of a stack you control and move them N spaces in a straight line to a destination containing N or less checkers. Then, add a new checker of your color to the destination. Stacks may not jump over enemies, but may land on enemy or friendly stacks, thereby burying them. If you at any point cannot make a move, you must pass. This does not end the game, only your turn. When the board is full, the player controlling more stacks wins the game. A size 4 board is currently selected The number of pieces in a stack is currently not shown on the top piece. ###
(define "Move" (and (fromTo (from (last From)) (to (last To)) count:(count Steps (last From) (last To)) stack:True) (add (to (last To)) stack:True))) (define "Select" (move Select (from (sites Occupied by:Mover top:True)) (to (sites Direction from:(from) Orthogonal stop:(= (next) (who at:(to))) stopIncluded:True distance:(size Stack at:(from))) if:(>= (count Steps (from) (to)) (size Stack at:(to)))) #1)) (game "Lava" (players 2) (equipment { (board (rotate 30 (hex 4))) (piece "Disc" Each)}) (rules (start { (place "Disc1" (min (array (sites Board)))) (place "Disc2" (max (array (sites Board))))}) (play ("Select" (then ("Move")))) (end (if (is Full) (byScore { (score P1 (count Sites in:(sites Occupied by:P1 top:True))) (score P2 (count Sites in:(sites Occupied by:P2 top:True)))}))))) END
Construct a Ludii game based on the following description 12x12 board. Pieces move as follows: Raja (King, x1): moves one space in any direction; Mantri (Minister, placed to the left of the Raja, x1): moves any distance orthogonally or diagonally; Ushtra (Camel, x2): moves diagonally any distance; Chariot (x2), moves orthogonally any distance; Flagcar (x2), moves diagonally any distance; Vaha (Horse, x2): move orthogonally one space and then diagonally another, jumping over any intervening pieces; Danti (Elephant, x2): moves orthogonally any distance. Padati (Pawn, x12): move forward orthogonally one space or one space diagonally forward to capture. When a Padati reaches the opposite edge of the board, it is promoted to a Mantri and is moved immediately to the space it last moved from. An opponent's piece is captured by moving one of the player's own pieces onto the space occupied by the opponent's piece. If the Raja can be captured on the opponent's next turn, it is in check. The Raja cannot be in check at the end of the player's turn. If this is impossible, the opponent wins. When a player is reduced to only their Raja and Padati, the opponent wins. In the case of a stalemate, the player in stalemate may remove any of the opponent's pieces (except their Raja). ###
(game "Chaturanga (12x12)" ("TwoPlayersNorthSouth") (equipment { (board (square 12)) ("ChessPawn" "Pawn" ~ (then (if (is In (last To) (sites Mover "Promotion")) (and (promote (last To) (piece "Ferz_noCross") Mover) (fromTo (from (last To)) (to (last From))))))) ("ChessRook" "Rook") ("ChessBishop" "Camel") ("ChessKing" "King_noCross") ("ChessBishop" "Bishop_noCross") ("ChessRook" "Elephant") ("ChessKnight" "Knight") ("ChessQueen" "Ferz_noCross") (regions "Promotion" P1 (sites Top)) (regions "Promotion" P2 (sites Bottom))}) (rules (start { (place "Pawn1" (sites Row 1)) (place "Pawn2" (sites Row 10)) (place "Elephant1" {"A1" "L1"}) (place "Knight1" {"B1" "K1"}) (place "Bishop_noCross1" {"C1" "J1"}) (place "Rook1" {"D1" "I1"}) (place "Camel1" {"E1" "H1"}) (place "Ferz_noCross1" coord:"F1") (place "King_noCross1" coord:"G1") (place "Elephant2" {"A12" "L12"}) (place "Knight2" {"B12" "K12"}) (place "Bishop_noCross2" {"C12" "J12"}) (place "Rook2" {"D12" "I12"}) (place "Camel2" {"E12" "H12"}) (place "Ferz_noCross2" coord:"G12") (place "King_noCross2" coord:"F12")}) (play (if (no Moves Mover) (move Remove (difference (sites Occupied by:Next) (where "King_noCross" Next))) (do (forEach Piece) ifAfterwards:(not ("IsInCheck" "King_noCross" Mover))))) (end { ("Checkmate" "King_noCross") (if (and { (no Pieces Next "Ferz_noCross") (no Pieces Next "Knight") (no Pieces Next "Bishop_noCross") (no Pieces Next "Elephant") (no Pieces Next "Rook") (no Pieces Next "Camel")}) (result Mover Win))}))) END
Construct a Ludii game based on the following description 3x12 board, with the outer rows of holes slightly curved to form the appearance of an arc. Twelve pieces per player, which start on the board in each of the holes in the outer row belonging to a player. Two four-sided dice, marked 2-4 and \ ###
(define "MoveAPiece" (if (or (= (state at:(from)) 1) (and (= (state at:(from)) 0) (= 1 (pips)))) (move Slide #1 (between (exact (pips)) if:(is Empty (between))) (to if:("IsEnemyAt" (to)) (apply if:(not ("IsFriendAt" (to))) (remove (to)))) (then (if (= (state at:(last To)) 0) (set State at:(last To) 1)))))) (game "Daldosa" (players 2) (equipment { (board (add (merge { (rectangle 1 8) (shift -4 1.5 (rectangle 1 12)) (shift 0 3 (rectangle 1 8))}) vertices:{{-1 0.1} {-2 0.3} {-2.9 0.5} {-3.6 0.8} {-1 2.9} {-2 2.7} {-2.9 2.5} {-3.6 2.2}}) { (track "Track1" {31..28 0..7 19..8 35..32 20..27 19..8} loop:True P1) (track "Track2" {35..32 20..27 19..8 31..28 0..7 19..8} loop:True P2)} use:Vertex) (regions "AllSites" (sites Board)) (dice d:4 num:2) (piece "Minus" P1 ("MoveAPiece" "Track1")) (piece "Minus" P2 ("MoveAPiece" "Track2"))}) (rules (start { (place "Minus1" (sites {0..7 28..31})) (place "Minus2" (sites {20..27 32..35}))}) (play ("RollEachNewTurnMove" (forEach Die replayDouble:(and (= (face 36) 1) (= (face 37) 1)) (forEach Piece (then (if (not (all DiceUsed)) ("ReplayIfCanMove" (forEach Die (forEach Piece))))))))) (end ("CaptureAll" Next)))) END
Modify the Ludii game according to the following option changes: A 4x4 board is currently selected -> A 5x5 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 4) 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))))) ###
(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 5) 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 Played on an 8x8 board with pieces with specialized moves: Pawns (8): can move one space forward, or one space diagonally forward to capture; Players agree at the beginning of the game whether pawns may move two spaces on their first turn. Two pawns may be moved by a player in their first turn of the game. Pawns may only be promoted to a piece that has already been captured. If none have been captured, the pawn must remain in place until a piece has been captured. 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, jumping over any intervening pieces; Queens (1): can move any number of spaces orthogonally or diagonally; Kings (1): can move one space orthogonally or diagonally. A King cannot castle if it has ever been checked. Players capture pieces by moving onto a space occupied by an opponent's piece. A player must say 'Gardez la reine' (Guard the Queen) when the queen is threatened. 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. A player who causes a stalemate loses. The pawns can double step from the starting positions. ###
(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 "CaptureForwardDiagonal" (move Step (directions {FR FL}) (to if:("IsEnemyAt" (to)) (apply (and (remember Value "CapturedPieces" (what at:(to))) (remove (to))))))) (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 "AtLeastAStrongPieceWasCapture" (or { ("WasCaptured" (id "Queen" Mover)) ("WasCaptured" (id "Knight" Mover)) ("WasCaptured" (id "Rook" Mover)) ("WasCaptured" (id "Bishop" Mover))})) (define "WasCaptured" (is In #1 (values Remembered "CapturedPieces"))) (define "CaptureToPiece" (apply (if ("IsEnemyAt" (to)) (and (remember Value "CapturedPieces" (what at:(to))) (remove (to)))))) (define "RememberPieceHasMoved" (then (if (= (state at:(last To)) 1) ("PieceHasMoved" (last To))))) (define "PieceHasMoved" (set State at:#1 0)) (define "HasNeverMoved" (= (state at:(mapEntry #1 (mover))) 1)) (game "Korkserschach" ("TwoPlayersNorthSouth") (equipment { (board (square 8)) (piece "Pawn" Each (if (!= (last To) (from)) (or { (if (and ("AtLeastAStrongPieceWasCapture") (is In (from) (sites Mover "Promotion"))) ("PromoteMove" (from) (then (set Pending)))) (if (is In (from) (sites Start (piece (what at:(from))))) ("DoubleStepForwardToEmpty")) "StepForwardToEmpty" "CaptureForwardDiagonal"} (then (and (if (and (is In (last To) (sites Mover "Promotion")) ("AtLeastAStrongPieceWasCapture")) (moveAgain)) (if (and ("NewTurn") (<= (count Turns) 2)) (and (set Pending) (moveAgain)))))))) (piece "Rook" Each (move Slide Orthogonal (to if:("IsEnemyAt" (to)) "CaptureToPiece") "RememberPieceHasMoved")) (piece "King" Each (move Step (to if:(not ("IsFriendAt" (to))) "CaptureToPiece") "RememberPieceHasMoved")) (piece "Bishop" Each (move Slide Diagonal (to if:("IsEnemyAt" (to)) "CaptureToPiece"))) (piece "Knight" Each (move Leap "KnightWalk" (to if:(not ("IsFriendAt" (to))) "CaptureToPiece"))) (piece "Queen" Each (move Slide (to if:("IsEnemyAt" (to)) "CaptureToPiece"))) (map "King" {(pair 1 "E1") (pair 2 "E8")}) (map "RookLeft" {(pair 1 "A1") (pair 2 "A8")}) (map "RookRight" {(pair 1 "H1") (pair 2 "H8")}) (regions "Promotion" P1 (sites Top)) (regions "Promotion" P2 (sites Bottom))}) (rules (start { (place "Pawn1" (sites Row 1)) (place "Pawn2" (sites Row 6)) (place "Rook1" {"A1" "H1"} state:1) (place "Knight1" {"B1" "G1"}) (place "Bishop1" {"C1" "F1"}) (place "Queen1" coord:"D1") (place "King1" coord:"E1" state:1) (place "Rook2" {"A8" "H8"} state:1) (place "Knight2" {"B8" "G8"}) (place "Bishop2" {"C8" "F8"}) (place "Queen2" coord:"D8") (place "King2" coord:"E8" state:1)}) (play (if (and (not (is Pending)) "SameTurn") ("PromoteMove" (last To)) (do (if (is Pending) (or (move Pass) (forEach Piece "Pawn" Mover)) (or (forEach Piece) (if (and ("HasNeverMoved" "King") (not ("IsInCheck" "King" Mover))) (or (if (and ("HasNeverMoved" "RookLeft") (can Move ("CastleRook" "RookLeft" E 3 (is Empty (to))))) "BigCastling") (if (and ("HasNeverMoved" "RookRight") (can Move ("CastleRook" "RookRight" W 2 (is Empty (to))))) "SmallCastling"))))) ifAfterwards:(not ("IsInCheck" "King" Mover))) (then (and (if (or ("IsInCheck" "Queen" P1) ("IsInCheck" "Queen" P2)) (note "Gardez la reine")) (if (and (= (state at:(where "King" Next)) 1) ("IsInCheck" "King" Next)) ("PieceHasMoved" (where "King" Next))))))) (end ("Checkmate" "King")))) END
Construct a Ludii game based on the following description Each player has a pawn, that can move to any neighboring cell. After moving, the player places a block on the board to try to block the opponent's pawn. First player who cannot move loses. The game is played on a 7x7 board. ###
(game "Isolation" (players 2) (equipment { (board (rectangle 7 7)) (piece "Pawn" Each (move Step (to if:(is Empty (to))) (then (moveAgain)))) (piece "Square" Neutral)}) (rules (start { (place "Pawn1" {"A4"}) (place "Pawn2" {"G4"})}) (play (if (is Even (count Moves)) (forEach Piece) (move Add (piece "Square0") (to (sites Empty))))) (end ("BlockWin")))) END
Construct a global Ludii definition which fulfills the following requirements. Checks if the previous mover is the same player than the current mover, consequently this is the same turn. ###
(define "SameTurn" (is Prev Mover)) END
Modify the Ludii game according to the following option changes: A size 7 board is currently selected -> A size 9 board is currently selected A group penalty of 0 points is currently selected -> A group penalty of 2 points is currently selected (define "UpdateScore" (set Score Mover (- (count Sites in:(sites Occupied by:Mover)) (* 0 (count Groups Orthogonal if:(is Mover (who at:(to)))))))) (define "Grow" ("PlaceGrey" (then (if (can Move ("PlaceGrey" ~)) (moveAgain) (do ("ReplaceAllGrey") next:("UpdateScore")))))) (define "ReplaceAllGrey" (add (to (sites Occupied by:Neutral) (apply (remove (to)))) (then (if (!= 1 (var "HasGrown")) (and (set Var "HasGrown" 1) (if (= (id P2) (mover)) (and (set Var "MoveThatMustBePlant" (count Moves)) (moveAgain)))))))) (define "PlaceGrey" (do (move Add (piece "Marker0") (to (sites Empty) if:(< 0 (count Sites in:(sites Around (to) Own Orthogonal))))) ifAfterwards:(all Groups Orthogonal of:(is Mover (who at:(to))) if:(> 2 (count Sites in:(intersection (sites Around (sites) NotEmpty Orthogonal) (sites Occupied by:Neutral))))) #1)) (define "Plant" (move Add (to (sites Empty) if:(= 0 (count Sites in:(sites Around (to) Own Orthogonal)))) (then ("UpdateScore")))) (game "Symple" (players 2) (equipment { (board (square 7) use:Vertex) (piece "Marker" Each) (piece "Marker" Neutral)}) (rules (play (if (= (count Moves) (var "MoveThatMustBePlant")) ("Plant") (if (= 0 (count MovesThisTurn)) (or ("Plant") ("Grow")) ("Grow")))) (end (if (is Full) (byScore))))) ###
(define "UpdateScore" (set Score Mover (- (count Sites in:(sites Occupied by:Mover)) (* 2 (count Groups Orthogonal if:(is Mover (who at:(to)))))))) (define "Grow" ("PlaceGrey" (then (if (can Move ("PlaceGrey" ~)) (moveAgain) (do ("ReplaceAllGrey") next:("UpdateScore")))))) (define "ReplaceAllGrey" (add (to (sites Occupied by:Neutral) (apply (remove (to)))) (then (if (!= 1 (var "HasGrown")) (and (set Var "HasGrown" 1) (if (= (id P2) (mover)) (and (set Var "MoveThatMustBePlant" (count Moves)) (moveAgain)))))))) (define "PlaceGrey" (do (move Add (piece "Marker0") (to (sites Empty) if:(< 0 (count Sites in:(sites Around (to) Own Orthogonal))))) ifAfterwards:(all Groups Orthogonal of:(is Mover (who at:(to))) if:(> 2 (count Sites in:(intersection (sites Around (sites) NotEmpty Orthogonal) (sites Occupied by:Neutral))))) #1)) (define "Plant" (move Add (to (sites Empty) if:(= 0 (count Sites in:(sites Around (to) Own Orthogonal)))) (then ("UpdateScore")))) (game "Symple" (players 2) (equipment { (board (square 9) use:Vertex) (piece "Marker" Each) (piece "Marker" Neutral)}) (rules (play (if (= (count Moves) (var "MoveThatMustBePlant")) ("Plant") (if (= 0 (count MovesThisTurn)) (or ("Plant") ("Grow")) ("Grow")))) (end (if (is Full) (byScore))))) END
Construct a Ludii game based on the following description Each player uses twelve pieces. Play begins with each player placing pieces on empty points. If they make three in a row along the lines, they can remove one of the opponent's pieces. They cannot remove an opponent's piece that is in a three in a row formation unless there are no other options. Once all pieces are place, players take turns moving pieces one spot to an adjacent point along the lines. If a player makes three in a row, an opponent's piece is removed as in the first phase of the game. Once a player is reduced to three pieces, that player may move to any open space on the board. The game is won when the opponent is reduced to two pieces. The board has some diagonals. ###
(define "RemoveEnemyPiece" (if (can Move ("RemoveAnyEnemyPieceNotInLine3" Orthogonal)) ("RemoveAnyEnemyPieceNotInLine3" Orthogonal) ("RemoveAnyEnemyPiece"))) (game "Twelve Men's Morris" (players 2) (equipment { (board (concentric Square rings:3 joinCorners:True) use:Vertex) (hand Each) (piece "Marker" Each ("StepToEmpty" ~ (then ("ReplayIfLine3" Orthogonal exact:True))))}) (rules (start (place "Marker" "Hand" count:12)) phases:{ (phase "Placement" (play (if "SameTurn" "RemoveEnemyPiece" (move (from (handSite Mover)) (to (sites Empty)) (then ("ReplayIfLine3" Orthogonal exact:True))))) (nextPhase Mover ("HandEmpty" Mover) "Movement")) (phase "Movement" (play (if "SameTurn" "RemoveEnemyPiece" (if (> (count Pieces Mover) 3) (forEach Piece) (move (from (sites Occupied by:Mover)) (to (sites Empty)))))))} (end ("HavingLessPiecesLoss" Next 2)))) END
Modify the Ludii game according to the following option changes: Each row has 20 holes. -> Each row has 25 holes. (define "SiteToMove" (if (= (from) (handSite Mover)) ("SiteToMoveOnTrack" from:0 (- ("ThrowValue") 1)) ("SiteToMoveOnTrack" from:(from) ("ThrowValue")))) (define "SiteToMoveOnTrack" ("NextSiteOnTrack" #2 #1)) (define "ThrowValue" (mapEntry (count Pips))) (game "Uturu Uturu Kaida" (players 7) (equipment { (board (rectangle 2 20) (track "Track" {0..19 39..20} directed:True) use:Vertex) (hand Each) (piece "Horse" Each (if ("IsOffBoard" ("SiteToMove")) (move Remove (from) level:(level)) (move (from (from) level:(level)) (to ("SiteToMove")) stack:True))) ("StickDice" 2) (map {(pair 0 10) (pair 1 0) (pair 2 20)})}) (rules (start (place "Horse" "Hand")) (play ("RollMove" (if (< 0 ("ThrowValue")) (or (forEach Piece) (forEach Piece container:(mover)))))) (end ("EscapeWin")))) ###
(define "SiteToMove" (if (= (from) (handSite Mover)) ("SiteToMoveOnTrack" from:0 (- ("ThrowValue") 1)) ("SiteToMoveOnTrack" from:(from) ("ThrowValue")))) (define "SiteToMoveOnTrack" ("NextSiteOnTrack" #2 #1)) (define "ThrowValue" (mapEntry (count Pips))) (game "Uturu Uturu Kaida" (players 7) (equipment { (board (rectangle 2 25) (track "Track" {0..24 49..25} directed:True) use:Vertex) (hand Each) (piece "Horse" Each (if ("IsOffBoard" ("SiteToMove")) (move Remove (from) level:(level)) (move (from (from) level:(level)) (to ("SiteToMove")) stack:True))) ("StickDice" 2) (map {(pair 0 10) (pair 1 0) (pair 2 20)})}) (rules (start (place "Horse" "Hand")) (play ("RollMove" (if (< 0 ("ThrowValue")) (or (forEach Piece) (forEach Piece container:(mover)))))) (end ("EscapeWin")))) END
Construct a Ludii game based on the following description Three concentric squares, the corners and midpoints of the squares connected with lines. Nine pieces per player. Players alternate turns placing a piece on an empty spot on the board. When all of the pieces are placed, the players alternate turns moving a piece to an empty adjacent spot along the lines. During either phase, when a player places three of their pieces in a row along the lines, the player removes any one of the opponent's pieces. The player who reduces the opponent to two pieces wins. ###
(game "Triodi (Diagonal)" (players 2) (equipment { (board (concentric Square rings:3 joinCorners:True) use:Vertex) (hand Each) (piece "Marker" Each ("StepToEmpty" ~ (then ("ReplayIfLine3" Orthogonal exact:True))))}) (rules (start (place "Marker" "Hand" count:9)) 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 ("HavingLessPiecesLoss" Next 2)))) END
Construct a Ludii game based on the following description 3x6 board, three counters per hole. Each player owns the row of holes closest to them, as well as the right half of the central row, with respect to their perspective. Sowing occurs from left to right in the player's complete row, right to left in the player's half of the central row, then continuing from right to left in the opponent's outer row, left to right in the opponent's holes in the central row, and then continuing as before into the player's outer row. Players sow from any of their holes, and when the final counter lands in an occupied hole, they pick up the contents and continue sowing. When the final counter falls into an empty hole, the turn ends. After the first turn, players may capture a hole when the final counter of a sowing falls into a hole containing three counters, increasing it to four. The counters in a captured hole cannot be sown. When a player drops their final counter into an occupied captured hole, two counters are captured from it. If the player captured counters from one of the holes that they had created, they begin sowing again from another of their holes, but if the capture was from a hole captured by the opponent, the turn ends. The leftmost holes in each player's row are special: a player may under no circumstance capture counters from this hole in their row, but may do so from the opponent's, gaining another turn when they do so. Play continues until all of the counters are captured or all of the counters are accumulated in captured holes. A new round begins. Players then collect the counters in their captured holes. They count their takings by filling their holes with three counters each as in the beginning, and the player would own every hole they could fill with three counters. If the player has two counters remaining, they also gain another hole and the opponent surrenders their extra counter. Play continues until one player cannot fill any holes. ###
(define "NoEmptyHoleRow" (all Sites (sites Mover) if:(is Occupied (site)))) (define "SitesMarkedBy" (forEach (sites Board) if:(= #1 (state at:(site))))) (define "OnlyPiecesInMarked" (all Sites (forEach (sites Board) if:(= 0 (state at:(site)))) if:(= 0 (count at:(site))))) (define "RemmemberOwnedHoles" (if (is Mover P1) (remember Value "OwnedP1" #1) (remember Value "OwnedP2" #1))) (define "OwnedHoles" (if (is Mover P1) (sites (values Remembered "OwnedP1")) (sites (values Remembered "OwnedP2")))) (define "Columns" 6) (game "Selus (Massawa)" (players 2) (equipment { (mancalaBoard 3 "Columns" store:None (track "Track" "0,E,N1,W2,17,W,S1,E2" loop:True)) (piece "Seed" Shared) (hand Each) (regions P1 (union (sites Bottom) (difference (expand (sites Right) steps:2) (sites Top)))) (regions P2 (union (sites Top) (difference (expand (sites Left) steps:2) (sites Bottom)))) (map "LeftMostHole" {(pair P1 0) (pair P2 17)})}) (rules (start { (set RememberValue "OwnedP1" (sites P1)) (set RememberValue "OwnedP2" (sites P2)) (set Count 3 to:(sites Track))}) phases:{ (phase "Sowing" (play (or { (move Select (from (if (and (not (is Pending)) ("SameTurn")) ("LastHoleSowed") ("OwnedHoles")) if:(and (< 0 (count at:(from))) (= 0 (state at:(from))))) (then (sow apply:(if (< 1 (count at:(to))) (if (and (!= (mapEntry "LeftMostHole" Mover) (to)) (!= 0 (state at:(to)))) (and { (if (or (= (mover) (state at:(to))) (= (mapEntry "LeftMostHole" Next) (to))) (and (moveAgain) (set Pending))) (fromTo (from (to)) (to (handSite Mover)) count:2) (set State at:(to) (state at:(to)))}) (if (and {(< 2 (count Turns)) (= 0 (state at:(to))) (= 4 (count at:(to)))}) (set State at:(to) (mover)) (moveAgain)))))))} (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 (> 3 (count Cell at:(handSite P1))) (result P2 Win)) (if (> 3 (count Cell at:(handSite P2))) (result P1 Win))})) (nextPhase ("NoPieceOnBoard") "BetweenRounds")) (phase "BetweenRounds" (play (if (<= 3 (count Cell at:(handSite Mover))) (move (from (handSite Mover)) (to (if ("NoEmptyHoleRow") (sites Board) (sites Mover)) if:(is Empty (to))) count:3 (then ("RemmemberOwnedHoles" (last To)))) (if (= 2 (count Cell at:(handSite Mover))) (move (from (handSite Mover)) (to (if ("NoEmptyHoleRow") (sites Board) (sites Mover)) if:(is Empty (to))) count:2 (then (and (fromTo (from (handSite Next)) (to (last To)) count:1) ("RemmemberOwnedHoles" (last To)))))))) (nextPhase (and (is Empty (handSite P1)) (is Empty (handSite P2))) "Sowing"))})) END
Describe the mechanics of the following Ludii game (define "RemoveEnemyPieceInMillOnlyIfNoOtherChoice" (if (can Move ("RemoveAnyEnemyPieceNotInLine3" Orthogonal)) ("RemoveAnyEnemyPieceNotInLine3" Orthogonal) ("RemoveAnyEnemyPiece"))) (game "Six Men's Morris" (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 ("HavingLessPiecesLoss" Next 2)))) ###
Same rules as Murray, except a player cannot remove an opponent's piece that is in a three in a row formation unless there are no other options. The game starts with 6 pieces by player. Any Enemy piece can be captured. END
Construct a Ludii game based on the following description Three vertical lines, and two horizontal lines intersecting them along their top end points and their midpoints. Three pieces per player, arranged on the intersections of opposite vertical lines. Players alternate turns moving one of their pieces to an adjacent spot. The object of the game is to block the opponent's pieces from moving. ###
(game "Tugul Shodra" (players 2) (equipment { (board (remove (square 3) edges:{{0 1} {1 2}}) use:Vertex) (piece "Disc" Each "StepToEmpty")}) (rules (start { (place "Disc1" {2 5 8}) (place "Disc2" {0 3 6})}) (play (forEach Piece)) (end ("NoMoves" Loss)))) END
Construct a Ludii game based on the following description Play on an equilateral triangular hexagon-tessellated grid. Use a neutral pawn and black/white checkers. Players take turns moving a neutral pawn around on the board (passing is not allowed). The neutral pawn can move any number of empty points, in any direction in a straight line, but cannot move onto, or jump over occupied points. When a player moves the pawn, first they place a checker of their own color, onto the destination point. Then they move the pawn on top of it. When the pawn is trapped, the game is over. At the end of the game, each player gets a point for each checker of their own color adjacent to, or underneath, the pawn. The person with the highest score wins. Played on a size 13 board. ###
(define "Nbors" (count Sites in:(intersection (sites Around #1) (sites Occupied by:#2)))) (game "Trike" (players 2) (equipment { (board (hex Triangle 13)) (piece "Marker" Each)}) (rules (meta (swap)) phases:{ (phase "Opening" P1 (play (move Add (to (sites Empty)) (then (set Var (last To))))) (nextPhase)) (phase "Play" (play (move Add (to (sites LineOfSight Empty at:(var))) (then (set Var (last To))))))} (end (if (no Moves Next) (byScore { (score P1 (+ (if (is Mover P1) 1 0) ("Nbors" (last To) P1))) (score P2 (+ (if (is Mover P2) 1 0) ("Nbors" (last To) P2)))}))))) END
Construct a global Ludii definition which fulfills the following requirements. Defines backgammon tracks following the same direction for each player but starting from opposite corners in using the bar of the board. ###
(define "BackgammonTracksSameDirectionOppositeCornersWithBars" { (track "Track1" {6 13..18 20..25 12..7 5..0} P1 directed:True) (track "Track2" {19 12..7 5..0 13..18 20..25} P2 directed:True)}) END
Describe the mechanics of the following Ludii game (define "RemoveGroups" (forEach Site (sites Around (sites Group at:(last To)) Enemy) (remove (sites Group at:(site))))) (define "Captures" (and (all Sites (sites Around (sites Group at:(last To)) Enemy) if:(> (size Group at:(last To)) (size Group at:(site)))) (< 0 (count Sites in:(sites Around (sites Group at:(last To)) Enemy))))) (define "FriendlyAdjacent" (< 0 (count Sites in:(sites Around (to) Own)))) (define "NoFriendlyAdjacent" (= 0 (count Sites in:(sites Around (to) Own)))) (game "Oust" (players 2) (equipment { (board (hex 7)) (piece "Disc" Each)}) (rules (play (or (move Add (to (sites Empty) if:"NoFriendlyAdjacent")) (do (move Add (to (sites Empty) if:"FriendlyAdjacent")) ifAfterwards:"Captures" (then (and ("RemoveGroups") (moveAgain)))))) (end (if (and (< 2 (count Moves)) (= 0 (count Sites in:(sites Occupied by:Enemy)))) (result Mover Win))))) ###
Oust is a game for two players, played on a hexagonally patterned board which is initially empty. The two players, Black and White, take turns placing stones of their color onto unoccupied cells on the board. A group is a set of interconnected, like-colored stones. A group can be a singleton, a single stone which is not connected to any other stones of its color. A group includes all the stones of its own color connected to it. There are two types of moves - non-capturing placements and capturing placements. Non-capturing placements either forms no connections (adjacencies) with any stones, or forms one or more connections with only enemy stones. A non-capturing placement does not form any connection with stones of its own color. Making a non-capturing placement concludes your turn. When you place a stone which forms one or more connections with your own groups, you will create a new, larger group of your own stones. You can only make such a placement if said new group will have one or more connections with enemy groups upon its creation and if all said enemy groups are smaller than said new group. Upon making such a placement, all said enemy groups are removed from the board. After capturing one or more enemy groups and while it is still your turn, you must continue to add stones until you make a non-capturing placement, at which time your turn is concluded. If you have a placement available on your turn you must make one. If you don't have any placements available, you must pass your turn. There will always be a placement available for at least one player. You win by making a placement which captures all of the enemy stones on the board. The game is played on a size 7 board END
Construct a Ludii game based on the following description 5x9 intersecting lines; with a triangle formed by lines drawn from the second and fourth line of one of the short sides of the rectangle, with the base and a line bisecting the base of the triangle. One player plays as the General, placed on the central space of the rectangle, and the other player plays as 26 Rebels, places on the intersections of the second, third, and fourth of the long lines. Pieces move one space orthogonally. The General may capture one of the Rebels by hopping over it to an empty space. The General wins by capturing all the Rebels. The Rebels win by blocking the General from moving. P1 wins in blocking P2 to move. P2 wins in capturing by hopping all the pieces of P1. ###
(game "Yeung Luk Sz' Kon Tseung Kwan" (players 2) (equipment { (board (merge (rectangle 9 5) (shift 1 8 (scale 0.5 (wedge 3)))) use:Vertex) (piece "Marker" P1 "StepToEmpty") (piece "Marker" P2 (or ("HopCapture") ("StepToEmpty")))}) (rules (start { (place "Marker1" (union {(sites Column 1) (difference (sites Column 3) (union (sites Centre) (expand (sites Top)))) (sites Column 5)})) (place "Marker2" (centrePoint))}) (play (forEach Piece)) (end { (if (no Pieces P1) (result P2 Win)) (if (no Moves P2) (result P1 Win))}))) END
Construct a Ludii game based on the following description 2x6 board. Six counters in each hole. A player picks up all of the counters in one of the holes in their row and sows them one-by-one in a clockwise direction in consecutive holes from the hole the pieces originated. The starting hole is always left empty, even if a player sows in a complete circuit of the board, the original house is skipped and sowing continues in the next hole after it. Players capture counters when the final counter is sown in the opponent's row and the hole containing it has two or three counters (counting the counter just dropped into it). If the hole before it also has two or three counters, these are also captured and so on until reaching a hole without two or three counters or one not belonging to the opponent. A move which would capture all of the opponent's counters is not allowed. If an opponent's holes are all empty, the other player must make a move placing counters in the opponent's row. If not possible, the player captures all the counters in their row. The player who has captured the most counters wins. If the game continues in a repeating loop, the players can agree to end the game and capture the counters remaining in their row. ###
(define "PiecesOwnedBy" (+ (count Cell at:(handSite #1)) (count in:(sites #1)))) (game "Woli" (players 2) (equipment { (mancalaBoard 2 6 store:None (track "Track" "5,W,N,E" loop:True)) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (piece "Seed" Shared) (hand Each)}) (rules (start (set Count 6 to:(sites Track))) (play (if (is Proposed "End") (or (move Vote "End") (move Vote "No")) (or (if (is Cycle) (move Propose "End")) (do (move Select (from (sites Mover) if:(< 0 (count at:(from)))) (then (sow if:(and (is In (to) (sites Next)) (or (= (count at:(to)) 2) (= (count at:(to)) 3))) apply:(fromTo (from (to)) (to (handSite Mover)) count:(count at:(to))) includeSelf:False backtracking:True))) ifAfterwards:(< 0 (count in:(sites Next))))))) (end ("MancalaByScoreWhen" (or (no Moves Mover) (is Decided "End")))))) END
Construct a Ludii game based on the following description Goal: Connect your opposite sides with a continuous chain of stones on edge-to-edge ('orthogonally adjacent') cells. Achieving the goal ends the game. Players take turns. There is no passing. -- On a turn the mover either places a stone from their supply on an empty space, or uses it to replace an opponent's stone on a space that the mover controls. Edge spaces are controlled by two orthogonally adjacent mover stones that are also orthogonally adjacent to each other. All other spaces are controlled by having at least 3 orthogonally adjacent mover stones, one of which that is both orthogonally adjacent to the second, and diagonally adjacent to the third. Using an order 1 board with 48 cells A mutually adjacent pair of your pieces to an edge location gives control there. To control a site with your adjacent stones, one stone must connect to a second orthogonally, and to a third diagonally. ###
(define "ColourP2" (colour 252 255 234 #1)) (define "ColourP1" (colour 229 92 0 #1)) (define "Check4Win" (if (is Mover P1) (if (is Connected Orthogonal { (sites {43 44 45 46 47}) (sites {0 1 2 3 4})}) (trigger "Win" Mover)) (if (is Connected Orthogonal { (sites {6 13 21 27 37}) (sites {10 20 26 34 41})}) (trigger "Win" Mover)))) (define "AdjacentPair" (<= 1 (+ (results from:(to) to:(intersection (sites Around (from) Orthogonal) (sites Occupied by:Mover)) (if (< 0 (count Sites in:(intersection { (sites Around (to) Orthogonal) (sites Around (from) Orthogonal) (sites Occupied by:Mover)}))) 1 0))))) (define "LobsidedVEmbrace" (<= 1 (+ (results from:(to) to:(intersection (sites Around (from) Orthogonal) (sites Occupied by:Mover)) (if (and (< 0 (count Sites in:(intersection { (sites Around (to) Orthogonal) (sites Around (from) Orthogonal) (sites Occupied by:Mover)}))) (< 0 (count Sites in:(intersection { ("DiagonallyAdjacent2" (to)) (sites Around (from) Orthogonal) (sites Occupied by:Mover)})))) 1 0))))) (define "Majority" (<= 3 (count Pieces Mover in:(sites Around (to) Orthogonal)))) (define "EdgeMajority" (<= 2 (count Pieces Mover in:(sites Around (to) Orthogonal)))) (define "DiagonallyAdjacent2" (sites Direction from:#1 (difference (difference (difference (difference Diagonal N) S) E) W) distance:1)) (define "SitesEdge" (union { (sites {43 44 45 46 47}) (sites {0 1 2 3 4}) (sites {6 13 21 27 37}) (sites {10 20 26 34 41})})) (game "Morpharaoh" (players 2) (equipment { (board (trim (remove (dual (tiling T33434 5)) cells: {0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 20 21 24 27 28 29 35 36 39 40 44 45 46 47 53 54 55 59 60 64 65 71 72 76 79 85 90 93 94 95 96 97 98 99})) use:Cell) (piece "Disc" Each) (piece "Disc" Neutral)}) (rules (play (or { (move Add (to (sites Empty))) (move Add (to (intersection (sites Occupied by:Next) ("SitesEdge")) if:("AdjacentPair") (apply (remove (to))))) (move Add (to (difference (sites Occupied by:Next) ("SitesEdge")) if:("LobsidedVEmbrace") (apply (remove (to)))))} (then "Check4Win"))) (end (if (is Triggered "Win" Mover) (result Mover Win))))) END
Construct a global Ludii definition which fulfills the following requirements. Checks if a player has no legal moves and the game ends in a draw. ###
(define "DrawIfNoMoves" (if (no Moves #1) (result Mover Draw))) END
Construct a Ludii game based on the following description 2x6 board, with a storage hole on either end. The game starts with four counters in each hole. A player picks up all of the counters in one of the holes in their row and sows them one-by-one in a counterclockwise direction in consecutive holes from the hole the pieces originated. The starting hole is always left empty, even if a player sows in a complete circuit of the board, the original house is skipped and sowing continues in the next hole after it. Players capture counters when the final counter is sown in the opponent's row and the hole containing it has two or three counters (counting the counter just dropped into it). If the hole before it also has two or three counters, these are also captured and so on until reaching a hole without two or three counters or one not belonging to the opponent. A move which would capture all of the opponent's counters is not allowed. If an opponent's holes are all empty, the other player must make a move placing counters in the opponent's row. If not possible, the player captures all the counters in their row. Play continues until all of the counters are captured. The player who has captured the most counters wins. If the game continues in a repeating loop, the players can agree to end the game and capture the counters remaining in their row. The game ended when a player has no piece on his side or if the two players are agree on the end of the game in case a cycle. ###
(define "PiecesOwnedBy" (+ (count at:(mapEntry #1)) (count in:(sites #1)))) (game "Oware" (players 2) (equipment { (mancalaBoard 2 6 (track "Track" "1,E,N,W" loop:True)) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (map {(pair P1 FirstSite) (pair P2 LastSite)}) (piece "Seed" Shared)}) (rules (start (set Count 4 to:(sites Track))) (play (if (is Proposed "End") (or (move Vote "End") (move Vote "No")) (or (if (is Cycle) (move Propose "End")) (do (move Select (from (sites Mover) if:(< 0 (count at:(from)))) (then (sow if:(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))) includeSelf:False backtracking:True))) ifAfterwards:(< 0 (count in:(sites Next))))))) (end (if (or (no Moves Mover) (is Decided "End")) (byScore { (score P1 ("PiecesOwnedBy" P1)) (score P2 ("PiecesOwnedBy" P2))}))))) END
Construct a Ludii game based on the following description Initially, the graph contains only uncoloured vertices. At each turn, a player chooses a vertex to colour with his own colour, or pass. If there is no other adjacent vertex with the same colour, the player receives the weight of the vertex as score. When all vertices are coloured, or all players pass, the player who with the maximum score wins. The version of the game played with 2 players. ###
(game "Onek Rong" (players 2) (equipment { (board (subdivide (hex 2)) use:Vertex) (piece "Marker" Each)}) (rules (start { (set Cost 1 Vertex at:0) (set Cost 2 Vertex at:1) (set Cost 3 Vertex at:2) (set Cost 1 Vertex at:3) (set Cost 2 Vertex at:4) (set Cost 3 Vertex at:5) (set Cost 1 Vertex at:6) (set Cost 2 Vertex at:7) (set Cost 3 Vertex at:8) (set Cost 3 Vertex at:9) (set Cost 1 Vertex at:10) (set Cost 2 Vertex at:11) (set Cost 3 Vertex at:12) (set Cost 1 Vertex at:13) (set Cost 2 Vertex at:14) (set Cost 3 Vertex at:15) (set Cost 1 Vertex at:16) (set Cost 2 Vertex at:17) (set Cost 3 Vertex at:18) (set Cost 3 Vertex at:19) (set Cost 1 Vertex at:20) (set Cost 2 Vertex at:21) (set Cost 3 Vertex at:22) (set Cost 1 Vertex at:23)}) (play (or (move Claim (to (sites Empty)) (then (if (= 1 (size Group at:(last To))) (addScore Mover (cost Vertex at:(last To)))))) (move Pass))) (end (if (or (= (count Sites in:(sites Empty)) 0) (all Passed)) (byScore))))) END
Construct a Ludii game based on the following description 8x8 board. Pieces move as follows: Raja (x1): moves one space in any direction; Mantri (x1): moves any distance orthogonally or diagonally; Ushtra (x2): moves diagonally any distance; Vaha (x2): move orthogonally one space and then diagonally another, jumping over any intervening pieces; Danti (x2): moves orthogonally any distance. Padati (x8): move forward orthogonally one space or one space diagonally forward to capture. When a Padati reaches the opposite edge of the board, it is promoted to a Mantri and is moved immediately to the space it last moved from. An opponent's piece is captured by moving one of the player's own pieces onto the space occupied by the opponent's piece. If the Raja can be captured on the opponent's next turn, it is in check. The Raja cannot be in check at the end of the player's turn. If this is impossible, the opponent wins. When a player is reduced to only their Raja and Padati, the opponent wins. In the case of a stalemate, the player in stalemate may remove any of the opponent's pieces (except their Raja). ###
(define "Move" (do (forEach Piece) ifAfterwards:(not ("IsInCheck" "King_noCross" Mover)))) (define "OnlyRajaAndPadati" (and { (no Pieces #1 "Ferz_noCross") (no Pieces #1 "Knight") (no Pieces #1 "Elephant") (no Pieces #1 "Rook")})) (game "Chaturanga (Kridakausalya)" ("TwoPlayersNorthSouth") (equipment { (board (square 8)) ("ChessKing" "King_noCross") ("ChessQueen" "Ferz_noCross") ("ChessKnight" "Knight") ("ChessBishop" "Elephant") ("ChessRook" "Rook") ("ChessPawn" "Pawn" ~ (then (if (is In (last To) (sites Mover "Promotion")) (and (promote (last To) (piece "Ferz_noCross") Mover) (fromTo (from (last To)) (to (last From))))))) (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 (if (can Move ("Move")) ("Move") (move Remove (difference (sites Occupied by:Next) (sites Occupied by:Next component:"King_noCross"))))) (end { ("Checkmate" "King_noCross") (if ("OnlyRajaAndPadati" Next) (result Mover Win))}))) END
Modify the Ludii game according to the following option changes: The towers can move forwards (including diagonal and orthogonal forward). -> The towers can move only forward. The game is played according to the rules of Martin Gardner. The army can be placed anywhere. -> The game is played according to the rules of Martin Gardner with a slightly difference. The army can be placed anywhere except in the middle of the towers. (game "Jeu Militaire" (players 2) (equipment { (board (rotate 90 ("ThreeMensMorrisGraphWithLeftAndRightTriangles")) use:Vertex) (hand P1) (piece "Pawn" P1 ("StepToEmpty")) (piece "Pawn" P2 N ("StepToEmpty" Forwards)) (regions "Home" P2 (sites {"B1" "C2" "A2"})) (regions "Home" P1 (sites {"B2"}))}) (rules (start { (place "Pawn1" "Hand1") (place "Pawn2" (sites P2))}) phases:{ (phase "Placement" P1 (play (move (from (handSite P1)) (to (sites Empty)))) (nextPhase "Movement")) ("PhaseMovePiece" "Movement")} (end { (if (no Moves P1) (result P2 Win)) (if (is In (where "Pawn" P1) (sites P2)) (result P1 Win))}))) ###
(game "Jeu Militaire" (players 2) (equipment { (board (rotate 90 ("ThreeMensMorrisGraphWithLeftAndRightTriangles")) use:Vertex) (hand P1) (piece "Pawn" P1 ("StepToEmpty")) (piece "Pawn" P2 N ("StepToEmpty" Forward)) (regions "Home" P2 (sites {"B1" "C2" "A2"})) (regions "Home" P1 (sites {"B2"}))}) (rules (start { (place "Pawn1" "Hand1") (place "Pawn2" (sites P2))}) phases:{ (phase "Placement" P1 (play (move (from (handSite P1)) (to (difference (sites Empty) (sites {"B2"}))))) (nextPhase "Movement")) ("PhaseMovePiece" "Movement")} (end { (if (no Moves P1) (result P2 Win)) (if (is In (where "Pawn" P1) (sites P2)) (result P1 Win))}))) END
Modify the Ludii game according to the following option changes: Each row has 12 holes. -> Each row has 14 holes. (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" 12) (game "Msuwa wa Kunja" (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 (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))))) ###
(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" 14) (game "Msuwa wa Kunja" (players 2) (equipment { (mancalaBoard 4 "Columns" store:None { (track "Track1" "0,E,N1,W" loop:True P1) (track "Track2" "28,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))))) 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. 2 x Rukh (rook): Any number of spaces orthogonally. 2 x Pil (elephant): Two squares diagonally, jumping over the first. Cannot capture another Pil. 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. No castling. Stalemate results in win for player causing it. The player who checkmates the king wins. ###
(game "Shatranj" ("TwoPlayersNorthSouth") (equipment { (board (square 8)) ("ChessPawn" "Pawn" ~ (then ("ReplayInMovingOn" (sites Mover "Promotion")))) ("ChessRook" "Rook") ("ChessKing" "King_noCross") (piece "Bishop_noCross" Each (move Hop Diagonal (between if:True) (to if:(or (is Empty (to)) ("IsEnemyAt" (to))) (apply (remove (to)))))) ("ChessKnight" "Knight") (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 "Bishop_noCross1" {"C1" "F1"}) (place "Ferz_noCross1" coord:"D1") (place "King_noCross1" coord:"E1") (place "Rook2" {"A8" "H8"}) (place "Knight2" {"B8" "G8"}) (place "Bishop_noCross2" {"C8" "F8"}) (place "Ferz_noCross2" coord:"D8") (place "King_noCross2" coord:"E8")}) (play (if "SameTurn" (move Promote (last To) (piece "Ferz_noCross") Mover) (do (forEach Piece) ifAfterwards:(not ("IsInCheck" "King_noCross" Mover))))) (end { ("Checkmate" "King_noCross") (if (= (count Pieces Next) 1) (result Mover Win)) ("BlockWin")}))) END
Modify the Ludii game according to the following option changes: Each row has 9 holes. -> Each row has 10 holes. (define "AllSitesNoMoreThanOne" (all Sites (sites Mover "Home") if:(>= 1 (count at:(site))))) (define "NoSiteWith2Seeds" (all Sites (sites Mover "Home") if:(!= 2 (count at:(site))))) (define "NextHole" ("NextSiteOnTrack" #2 from:#1 "Track")) (define "NoPiece" (all Sites (sites Player) if:(= 0 (count at:(site))))) (define "Columns" 9) (game "Njombwa" (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 29 to:(sites {0 (- (* 4 9) 1)})) (set Count 2 to:(sites {1 (- (* 4 9) 2)})) (set Count 1 to:(sites {2 (- (* 4 9) 3)}))}) phases:{ (phase "Opening1" (play (move Select (from (forEach (sites Mover "Home") if:(= 2 (count at:(site))))) (then (sow "Track" owner:(mover) apply:(if (and (is In (to) (sites Mover "Inner")) (is Occupied ("OppositePit" (to)))) (remove ("OppositePit" (to)))))))) (nextPhase ("NoSiteWith2Seeds") "Opening2")) (phase "Opening2" (play (move Select (from (if ("SameTurn") "LastHoleSowed" (forEach (sites Mover "Home") if:(= 29 (count at:(site))))) if:(> (count at:(from)) 0)) (then (sow "Track" owner:(mover) apply:(if (< 1 (count at:(to))) (moveAgain)))))) (nextPhase (not (is Next Mover)) "Sowing")) (phase "Sowing" (play (if ("AllSitesNoMoreThanOne") (move Select (from (sites Mover "Home") if:(and (is Occupied (from)) (is Empty ("NextHole" (from) 1)))) (then (sow "Track" owner:(mover)))) (move Select (from (if ("SameTurn") "LastHoleSowed" (sites Mover "Home")) if:(> (count at:(from)) 1)) (then (sow "Track" owner:(mover) apply:(if (< 1 (count at:(to))) (moveAgain) (if (and (is In (to) (sites Mover "Inner")) (is Occupied ("OppositePit" (to)))) (and (remove ("OppositePit" (to))) (if (is Occupied ("OppositeOuterPit" (to))) (remove ("OppositeOuterPit" (to)))))))))))))} (end (forEach NonMover if:("NoPiece") (result Player Loss))))) ###
(define "AllSitesNoMoreThanOne" (all Sites (sites Mover "Home") if:(>= 1 (count at:(site))))) (define "NoSiteWith2Seeds" (all Sites (sites Mover "Home") if:(!= 2 (count at:(site))))) (define "NextHole" ("NextSiteOnTrack" #2 from:#1 "Track")) (define "NoPiece" (all Sites (sites Player) if:(= 0 (count at:(site))))) (define "Columns" 10) (game "Njombwa" (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 29 to:(sites {0 (- (* 4 10) 1)})) (set Count 2 to:(sites {1 (- (* 4 10) 2)})) (set Count 1 to:(sites {2 (- (* 4 10) 3)}))}) phases:{ (phase "Opening1" (play (move Select (from (forEach (sites Mover "Home") if:(= 2 (count at:(site))))) (then (sow "Track" owner:(mover) apply:(if (and (is In (to) (sites Mover "Inner")) (is Occupied ("OppositePit" (to)))) (remove ("OppositePit" (to)))))))) (nextPhase ("NoSiteWith2Seeds") "Opening2")) (phase "Opening2" (play (move Select (from (if ("SameTurn") "LastHoleSowed" (forEach (sites Mover "Home") if:(= 29 (count at:(site))))) if:(> (count at:(from)) 0)) (then (sow "Track" owner:(mover) apply:(if (< 1 (count at:(to))) (moveAgain)))))) (nextPhase (not (is Next Mover)) "Sowing")) (phase "Sowing" (play (if ("AllSitesNoMoreThanOne") (move Select (from (sites Mover "Home") if:(and (is Occupied (from)) (is Empty ("NextHole" (from) 1)))) (then (sow "Track" owner:(mover)))) (move Select (from (if ("SameTurn") "LastHoleSowed" (sites Mover "Home")) if:(> (count at:(from)) 1)) (then (sow "Track" owner:(mover) apply:(if (< 1 (count at:(to))) (moveAgain) (if (and (is In (to) (sites Mover "Inner")) (is Occupied ("OppositePit" (to)))) (and (remove ("OppositePit" (to))) (if (is Occupied ("OppositeOuterPit" (to))) (remove ("OppositeOuterPit" (to)))))))))))))} (end (forEach NonMover if:("NoPiece") (result Player Loss))))) END
Construct a Ludii game based on the following description Played on a 8x8 board. Each player has two stones, who can jump over any other stone. Enemy stones jumped over are captured. First player unable to move loses. ###
(game "Leap Frog" (players 2) (equipment { (board (square 8)) (piece "Marker" Each (move Hop (between if:(is Occupied (between)) (apply (if ("IsEnemyAt" (between)) (remove (between))))) (to if:(is Empty (to)))))}) (rules (start { (place "Marker1" {"B4" "C5" "C6" "D2" "D4" "D6" "E3" "E5" "E7" "F3" "F4" "G5"}) (place "Marker2" {"B5" "C3" "C4" "D3" "D5" "D7" "E2" "E4" "E6" "F5" "F6" "G4"})}) (play (forEach Piece)) (end ("BlockWin")))) END
Describe the mechanics of the following Ludii game (define "BigHop" (move Hop (between (range 1 9) if:#1 (apply (remove (between)))) (to if:(and (is Empty (to)) ("NumCapturedPiecesIsOdd"))))) (define "NumCapturedPiecesIsOdd" (is Even (count Steps (from) (to)))) (game "Rimau-Rimau (One Tiger)" (players 2) (equipment { ("AlquerqueBoardWithBottomAndTopTriangles") (hand Each) (piece "Tiger" P1 (or { ("StepToEmpty") ("BigHop" ("IsEnemyAt" (between)))})) (piece "human" P2 "StepToEmpty")}) (rules (start { (place "human2" (expand (sites Centre))) (place "human2" (handSite P2) count:15) (place "Tiger1" (handSite P1))}) phases:{ (phase "PlacementTiger" P1 (play (move (from (handSite P1)) (to (sites {"C3" "C7"})) (then (moveAgain)))) (nextPhase Mover "MoveHuman")) (phase "MoveHuman" P1 (play (move (from (intersection (expand (sites Centre)) (sites Occupied by:Next))) (to (difference (sites Empty) (expand (sites Centre)))) (then (if (< 6 (count Sites in:(intersection (expand (sites Centre)) (sites Occupied by:Next)))) (moveAgain))))) (nextPhase Mover (= 6 (count Sites in:(intersection (expand (sites Centre)) (sites Occupied by:Next)))) "Movement")) (phase "PlacementHuman" P2 (play (move (from (handSite Mover)) (to (sites Empty)))) (nextPhase ("HandEmpty" P2) "Movement")) ("PhaseMovePiece" "Movement" (end ("NoMovesP1NoPiecesP2")))})) ###
5x5 intersecting lines, with diagonals in each quadrant. Two triangles, the apexes of which intersect with the square at the midpoint of opposite sides. One line bisecting the base of the triangle, and another bisecting this line. One player plays as the tiger, which is placed on the apex of either triangle. The other player plays as 24 people, nine of which begin on the nine central points of the board. To begin, the person playing as the tiger removes three of the people from their starting position and places them on any points on the board. The person playing as the people then places one of the remaining people on an empty spot on the board. The tiger then moves to an empty adjacent spot along the lines of the board. Play continues like this until all of the people are placed, at which point the people move to an adjacent empty spot on the board as well. On its turn, the tiger may hop over a line of people to an empty spot on the other side of the line, following the lines of the board and only if the number of people in the line is odd. The tiger wins if it captures all the people; the people win when they block the tiger from being able to move. END
Construct a Ludii game based on the following description 2x12 board, with the spaces rendered as points, divided into half. Fifteen pieces per player. Two six-sided dice. Players move according to the number on each die by moving one piece the value on one die then another piece the value on the other die, or by moving one piece the value of one die and then the value of the other. A throw of doubles forces the player to play the throw twice. Each player's pieces begin in three stacks of five, on the leftmost point (with respect to the opponent) on the opponent's side of the board. Play proceeds (with respect to the player) from right to left on the opponent's side of the board, and then from left to right on the player's side of the board. A player cannot place two pieces on a single point on any of the first twelve points of the board, except for those pieces in the starting position. A player cannot move a piece onto a point containing two or more pieces belonging to the opponent. When a piece lands on a point occupied by a single piece belonging to the opponent, it is removed from the board and must be entered again, and can only do so using the value of one die, not both, with the starting point considered to be point 1, the next point 2, etc. Opponent's pieces can be removed from the board in this way when reentering the board. If a player cannot reenter pieces on the board they lose their turn. When all of a player's pieces are on their final 6 points, they may start removing pieces from the board. They can do so by rolling a 6 to move from the 6th point, and so on down to 1. Players must use all available moves presented by the dice. The first player to remove all of their pieces wins. ###
(define "AllPiecesInFinalQuadrant" ("AllOwnedPiecesIn" (sites Mover "FinalQuadrant"))) (define "NextSiteFrom" ("NextSiteOnTrack" #2 from:#1)) (game "Verquere" (players 2) (equipment { ("BackgammonBoard" ("BackgammonTracksSameDirectionOppositeCornersWithBars2" End)) (dice d:6 num:2) (piece "Disc" Each (forEach Die replayDouble:True if:("DieNotUsed") (if ("IsEndTrack" ("NextSiteFrom" (from) (pips))) (if ("AllPiecesInFinalQuadrant") (move Remove (from))) (move (from (from)) (to ("NextSiteFrom" (from) (pips)) if:(and ("NoEnemyOrOnlyOne" (to)) (if (not (is In (to) (sites Mover "StartingSide"))) True (is Empty (to)))) ("HittingCapture" (mapEntry "Bar" Next))))) (then ("ReplayNotAllDiceUsed")))) (regions "FinalQuadrant" P1 (sites {7..12})) (regions "FinalQuadrant" P2 (sites {13..18})) (regions "StartingSide" P1 (sites {25..20 18..13})) (regions "StartingSide" P2 (sites {0..5 7..12})) (map "Bar" {(pair P1 6) (pair P2 19)})}) (rules (start { (place Stack "Disc1" 25 count:15) (place Stack "Disc2" 0 count:15)}) (play ("RollEachNewTurnMove" (forEach Piece top:True))) (end ("EscapeWin")))) END
Construct a Ludii game based on the following description Played on a board with 9x10 intersecting lines. Pieces are placed on the intersections of the lines. Centered on opposite sides of the boards are two areas, known as the gong (\ ###
(define "StepMoveOnThePalace" (move Step #1 (to if:(and (is In (to) (sites Mover "Palace")) (not ("IsFriendAt" (to)))) (apply (remove (to)))))) (define "JiangSameColumnWithNoPieceBetween" (if (= (column of:(where "Jiang" P1)) (column of:(where "Jiang" P2))) (not ("NoSites" (forEach (sites Direction from:(where "Jiang" P1) N stop:(= (to) (where "Jiang" P2))) if:(is Occupied (site))))) True)) (game "Xiangqi" ("TwoPlayersNorthSouth") (equipment { (board (rectangle 10 9) use:Vertex) (piece "Jiang" Each ("StepMoveOnThePalace" Orthogonal)) (piece "Shi" Each ("StepMoveOnThePalace" Diagonal)) (piece "Xiang" Each (move Slide Diagonal (between (exact 2) if:(and { (is In (between) (sites Mover "Home")) (is Empty (between))})) (to if:("IsEnemyAt" (to)) (apply (remove (to)))))) (piece "Ma" Each (forEach Direction Orthogonal (to if:(is Empty (to)) (apply (forEach Direction (from (to)) (directions {FR FL} of:All) (if (not ("IsFriendAt" (to))) (move (from) (to (apply if:("IsEnemyAt" (to)) (remove (to))))))))))) (piece "Ju" Each ("SlideCapture" Orthogonal)) (piece "Pao" Each (or (move Slide Orthogonal) (move Hop Orthogonal (between before:(count Rows) after:(count Rows) if:(is Occupied (between))) (to if:(is Empty (to)) (apply if:("IsEnemyAt" (to)) (remove (to))))))) (piece "Zu" Each ("StepToNotFriend" (if (is In (from) (sites Mover "Home")) Forward (directions {Forward Rightward Leftward})))) (regions "PalaceP1" P1 { 3..5 12..14 21..23}) (regions "PalaceP2" P2 { 66..68 75..77 84..86}) (regions "Home" P1 (expand (sites Bottom) steps:4)) (regions "Home" P2 (expand (sites Top) steps:4))}) (rules (start { (place "Jiang1" coord:"E1") (place "Shi1" {"D1" "F1"}) (place "Xiang1" {"C1" "G1"}) (place "Ma1" {"B1" "H1"}) (place "Ju1" {"A1" "I1"}) (place "Pao1" {"B3" "H3"}) (place "Zu1" {"A4" "C4" "E4" "G4" "I4"}) (place "Jiang2" coord:"E10") (place "Shi2" {"D10" "F10"}) (place "Xiang2" {"C10" "G10"}) (place "Ma2" {"B10" "H10"}) (place "Ju2" {"A10" "I10"}) (place "Pao2" {"B8" "H8"}) (place "Zu2" {"A7" "C7" "E7" "G7" "I7"})}) (play (do (forEach Piece) ifAfterwards:(and ("JiangSameColumnWithNoPieceBetween") (not ("IsInCheck" "Jiang" Mover))))) (end { ("Checkmate" "Jiang") ("BlockWin")}))) END
Construct a Ludii game based on the following description Played on a Hex board. Players may play a piece of any color piece. The goal is to form a line connecting the player's two sides with either color. The game is played on a 11x11 board The first player to connect his two sides wins. ###
(game "Chameleon" (players 2) (equipment { (board (hex Diamond 11)) (piece "Marker" Each) (hand Shared size:2) (regions P1 {(sites Side NE) (sites Side SW)}) (regions P2 {(sites Side NW) (sites Side SE)})}) (rules (meta (swap)) (start { (place "Marker1" (handSite Shared)) (place "Marker2" (handSite Shared 1))}) (play (move (from (sites Hand Shared)) (to (sites Empty)) copy:True)) (end { (if (is Connected Mover) (result Mover Win)) (if (is Connected Next) (result Next Win))}))) END
Construct a Ludii game based on the following description TURNS - At each turn, each player must move one of his stones - A stone moves (orthogonal and diagonal) forward to an empty cell. GOAL - A player wins by making a (orthogonal or diagonal) 4 in-a-row. ###
(game "Roll-Ing to Four" ("TwoPlayersNorthSouth") (equipment { (board (rectangle 10 4) use:Vertex) (piece "Ball" Each ("StepToEmpty" (directions Forwards of:All)))}) (rules (start { (place "Ball1" (sites {"A1" "B1" "C1" "B6" "C6" "D6"})) (place "Ball2" (sites {"A5" "B5" "C5" "B10" "C10" "D10"}))}) (play (forEach Piece)) (end (if (is Line 4 All) (result Mover Win))))) END
Construct a Ludii game based on the following description 8x8 Draughts board. One player plays with two foxes, the other with twelve or more hens, played on the white squares. The hens begin on the rows closest to the player; the foxes begin, one each on the left and right end of the row farthest from the hens. Hens move one space forward diagonally, the foxes move one space diagonally forward or backward. Foxes must alternate turns, i.e., when one fox moves, the other fox must move on the next turn. The foxes may capture a hen by hopping over it to an empty space diagonally on the other side of it. The hens win by blocking the foxes from being able to move; the foxes win by capturing all the hens. ###
(game "Jeu de Renard (Two Foxes)" (players 2) (equipment { (board (square 8)) (piece "Fox" P1 (if (= (state at:(from)) 1) (or "StepDiagonalToEmpty" "HopDiagonalCapture") (then (and (forEach Site (sites Occupied by:Mover) (if (= (state at:(site)) 0) (set State at:(site) 1))) (set State at:(last To) 0))))) (piece "Hen" P2 N ("StepToEmpty" (directions {FR FL})))}) (rules (start { (place "Fox1" (intersection (sites Top) (union (sites Left) (difference (expand (sites Right)) (sites Right)))) state:1) (place "Hen2" (difference (expand (sites Bottom) steps:2) (sites Phase 0)))}) phases:{ (phase "Opening" P1 (play (forEach Piece (or "StepDiagonalToEmpty" "HopDiagonalCapture" (then (set State at:(last To) 0))))) (nextPhase "Movement")) ("PhaseMovePiece" "Movement")} (end ("NoMovesP1NoPiecesP2")))) END
Describe the mechanics of the following Ludii game (define "PiecesOwnedBy" (+ (count Cell at:(handSite #1)) (count in:(sites #1)))) (game "Azigo" (players 2) (equipment { (mancalaBoard 2 20 store:None { (track "Track" "0,E,N,W" loop:True) (track "TrackSpecialHome1" "0,E" loop:True P1) (track "TrackSpecialHome2" "39,W" loop:True P2)}) (piece "Seed" Shared) (hand Each) (map "LeftMost" {(pair P1 0) (pair P2 39)}) (regions "OpeningRegion" P1 (sites {8..11})) (regions "OpeningRegion" P2 (sites {28..31})) (regions P1 (sites Bottom)) (regions P2 (sites Top))}) (rules (start { (set Count 5 to:(sites {0 1 2 3 4 5 6 9 39 38 37 36 35 34 33 30})) (set Count 1 to:(sites {7 8 11 32 31 28})) (set Count 2 to:(sites {10 29}))}) phases: { (phase "Opening" (play (move (from (sites Mover "OpeningRegion") if:(is Occupied (from))) (to (handSite Mover)) count:(count at:(from)))) (nextPhase Mover (all Sites (sites Mover "OpeningRegion") if:(is Empty (site))) "Sowing")) (phase "Sowing" (play (or (move Select (from (sites Mover) if:(is Occupied (from))) (then (sow "Track" apply:(if (and (is In (to) (sites Next)) (or (= 2 (count at:(to))) (= 4 (count at:(to))))) (fromTo (from (to)) (to (handSite Mover)) count:(count at:(to)))) origin:(< 1 (count at:(from))) backtracking:True))) (if (is Occupied Cell (handSite Mover)) (or (do (set Var "NumToSow" (count Cell at:(handSite Mover))) next:(move (from (handSite Mover)) (to (mapEntry "LeftMost" Mover)) count:(count Cell at:(handSite Mover)) (then (and (sow count:(var "NumToSow") "Track" if:(and (is In (to) (sites Next)) (or (= 2 (count at:(to))) (= 4 (count at:(to))))) apply:(if (and (is In (to) (sites Next)) (or (= 2 (count at:(to))) (= 4 (count at:(to))))) (fromTo (from (to)) (to (handSite Mover)) count:(count at:(to)))) origin:True forward:True) (set Var "NumToSow" 0))))) (do (set Var "NumToSow" (count Cell at:(handSite Mover))) next:(move (from (handSite Mover)) (to (mapEntry "LeftMost" Mover)) count:(count Cell at:(handSite Mover)) (then (and (sow count:(var "NumToSow") "TrackSpecialHome" owner:(mover) origin:True) (set Var "NumToSow" 0))))))))))} (end ("MancalaByScoreWhen" (no Moves Mover))))) ###
2x20 board. Opening arrangement: Each player has this opening arrangement (number of counters in each hole, starting from the leftmost hole): 5-5-5-5-5-5-5-1-1-5-2-1-0-0-0-0-0-0-0-0. Opening phase: Players remove the counters in their final four holes with counters and conceals them from the opponent. Players take the counters from any of their holes and sow them in an anti-clockwise direction. When sowing, the first counter is dropped into the hole from which it just came, unless it is a single counter. If the last counter lands in the opponent's row and this hole contains one or three, counters, these are taken and added to the concealed store. Also, if the hole from which a capture was made is preceded by an unbroken sequence of holes with one or three counters, these are also taken. In place of a move, a player may add all of the counters from the concealed store, sowing from the leftmost hole in their row. If the sowing reaches the rightmost hole in this row, sowing may continue from the leftmost hole or may continue into the opponent's row. If the player continues into the opponent's row, subsequent holes after the one in which the final counter was dropped are captured if they contain one or three counters, in an unbroken sequence. END
Construct a Ludii game based on the following description 2x5 board, the right-most hole is the store. Four counters in each hole. Sowing in an anti-clockwise direction, including the store. Play begins by each player placing the counters in their fourth hole into their store. Moves may begin from any of a player's holes except the store. If the last counter of a sowing drops into a hole making it contain two or three counters, these are taken and placed in the store. As soon as a player has at least thirteen counters in their store, they are picked up and sown, omitting each player's store and takes any counters in the opponent's holes which now contain two or three counters. Each player performs this move only once. The player who captures the most counters wins. ###
(define "PiecesOwnedBy" (count at:(mapEntry #1))) (game "I Pere" (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)) (map {(pair P1 4) (pair P2 5)}) (map "Fourth" {(pair P1 3) (pair P2 6)})}) (rules (start (set Count 4 to:(sites Track))) phases:{ (phase "Opening" (play (move (from (mapEntry "Fourth" Mover)) (to (mapEntry Mover)) count:4)) (nextPhase Mover "Sowing")) (phase "Sowing" (play (if (and (<= 13 (count at:(mapEntry Mover))) (!= 1 (value Player Mover))) (or { (move Select (from (mapEntry Mover)) (then (and (sow skipIf:(or (= (to) (mapEntry P1)) (= (to) (mapEntry P2)))) (set Value Mover 1))))} (then (forEach Site (difference (sites Next) (mapEntry Next)) (if (or (= 2 (count at:(site))) (= 3 (count at:(site)))) (fromTo (from (site)) (to (mapEntry Mover)) count:(count at:(site))))))) (move Select (from (difference (sites Mover) (mapEntry Mover)) if:(is Occupied (from))) (then (sow apply:(if (or (= 2 (count at:(to))) (= 3 (count at:(to)))) (fromTo (from (to)) (to (mapEntry Mover)) count:(count at:(to))))))))))} (end ("MancalaByScoreWhen" (no Moves Next))))) END
Describe the mechanics of the following Ludii game (game "Buudal" (players 2) (equipment { (board (square 3 diagonals:Solid) use:Vertex) (hand Each) (piece "Marker" Each (move Hop (between if:True (apply (if ("IsEnemyAt" (between)) (remove (between))))) (to if:(is Empty (to)))))}) (rules (start (place "Marker" "Hand" count:6)) phases:{ (phase "Placement" (play (move (from (handSite Mover)) (to (sites Empty)))) (nextPhase Mover ("HandEmpty" Mover) "Movement")) ("PhaseMovePiece" "Movement")} (end ("CaptureAll" Next)))) ###
3x3 intersecting lines, with diagonals in the four squares formed. Six pieces per player. Players alternate turns placing one of their pieces on the board. when all of the pieces have been placed, players alternate turns moving a piece by jumping over an adjacent spot to the next spot, along the lines of the board, which must be empty. If an opponent's piece is in the spot which was jumped, that piece is captured. The player who captures all of the opponent's pieces wins. END
Modify the Ludii game according to the following option changes: Played on a size 5 board. -> Played on a size 6 board. (define "TerritoryP2" (+ (count Sites in:(sites Occupied by:P2)) (count Sites in:(forEach (sites Empty) if:(> (count Sites in:(intersection (sites Occupied by:P2) (sites LineOfSight at:(site)))) (count Sites in:(intersection (sites Occupied by:P1) (sites LineOfSight at:(site))))))))) (define "TerritoryP1" (+ (count Sites in:(sites Occupied by:P1)) (count Sites in:(forEach (sites Empty) if:(> (count Sites in:(intersection (sites Occupied by:P1) (sites LineOfSight at:(site)))) (count Sites in:(intersection (sites Occupied by:P2) (sites LineOfSight at:(site))))))))) (define "PlayableSites" (forEach (sites Board) if:(> (count Sites in:(intersection (sites Occupied by:Mover) (sites LineOfSight at:(site)))) (size Stack at:(site))))) (define "FriendlyInSight" (count Sites in:(intersection (sites Occupied by:Mover) (sites LineOfSight at:(last From))))) (game "Tumbleweed" (players 2) (equipment { (board (hex 5)) (piece "Disc" Each) (piece "Disc" Neutral)}) (rules (start (place Stack "Disc0" (centrePoint) count:2)) phases:{ (phase "Opening" (play (if (= 0 (count Moves)) (move Add (piece "Disc1") (to (sites Empty)) (then (moveAgain))) (if (= 1 (count Moves)) (move Add (piece "Disc2") (to (sites Empty))) (move Select (from (union (sites Occupied by:P1) (sites Occupied by:P2))) (then (if (= 1 (who at:(last From))) (do (swap Players 1 2) next:(set NextPlayer (player 1))) (pass))))))) (nextPhase (= 3 (count Moves)) "Play")) (phase "Play" (play (or (move Select (from "PlayableSites") (then (add (to (last From)) count:(- "FriendlyInSight" ((size Stack at:(last From)))) stack:True))) (move Pass))))} (end (if (all Passed) (byScore { (score P1 "TerritoryP1") (score P2 "TerritoryP2")}))))) ###
(define "TerritoryP2" (+ (count Sites in:(sites Occupied by:P2)) (count Sites in:(forEach (sites Empty) if:(> (count Sites in:(intersection (sites Occupied by:P2) (sites LineOfSight at:(site)))) (count Sites in:(intersection (sites Occupied by:P1) (sites LineOfSight at:(site))))))))) (define "TerritoryP1" (+ (count Sites in:(sites Occupied by:P1)) (count Sites in:(forEach (sites Empty) if:(> (count Sites in:(intersection (sites Occupied by:P1) (sites LineOfSight at:(site)))) (count Sites in:(intersection (sites Occupied by:P2) (sites LineOfSight at:(site))))))))) (define "PlayableSites" (forEach (sites Board) if:(> (count Sites in:(intersection (sites Occupied by:Mover) (sites LineOfSight at:(site)))) (size Stack at:(site))))) (define "FriendlyInSight" (count Sites in:(intersection (sites Occupied by:Mover) (sites LineOfSight at:(last From))))) (game "Tumbleweed" (players 2) (equipment { (board (hex 6)) (piece "Disc" Each) (piece "Disc" Neutral)}) (rules (start (place Stack "Disc0" (centrePoint) count:2)) phases:{ (phase "Opening" (play (if (= 0 (count Moves)) (move Add (piece "Disc1") (to (sites Empty)) (then (moveAgain))) (if (= 1 (count Moves)) (move Add (piece "Disc2") (to (sites Empty))) (move Select (from (union (sites Occupied by:P1) (sites Occupied by:P2))) (then (if (= 1 (who at:(last From))) (do (swap Players 1 2) next:(set NextPlayer (player 1))) (pass))))))) (nextPhase (= 3 (count Moves)) "Play")) (phase "Play" (play (or (move Select (from "PlayableSites") (then (add (to (last From)) count:(- "FriendlyInSight" ((size Stack at:(last From)))) stack:True))) (move Pass))))} (end (if (all Passed) (byScore { (score P1 "TerritoryP1") (score P2 "TerritoryP2")}))))) END
What does the following global Ludii definition do? (define "ForEachPlayerNoPiecesLoss" (forEach Player if:(no Pieces Player) (result Player Loss))) ###
Makes a player losing when this player has no pieces. This ludemeplex can be used only in an ending condition. 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 from the last ``to'' location of the previous move. ###
(define "HopRotationalSequenceCaptureAgain" (move Hop (from (last To)) Rotational (between #1 #2 if:(and (not (is In (between) (sites ToClear))) ("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
Construct a Ludii game based on the following description One horizontal row of eleven squares, the central square marked with an X. From this central square, extending vertically, eleven more squares, making a row of twelve in total. The fifth square and the final square in this row are marked with an X. An arc of five squares extend left and down from the final square of the vertical row. From the fifth row of the vertical row, a square with twelve squares per side. The corner squares are marked with an X, the central two squares of the left, right, and top side are marked with one X across both squares. Two or four players; when there are four players they play on two teams of two. Three cowrie shells per player, used as pieces. Six cowrie shells used as dice; the throws = the number of mouths that land face up. Players move their pieces onto the board and around the circuit according to the throws of the cowries. Teams start on opposite ends of the bottom row of squares, up the vertical line to the square, in opposite directions around the square, then up the remaining part of the vertical row and down the arc, and off the board. When a piece lands on a space occupied by an opponent's piece, the opponent's piece is sent back and must enter the board again. Pieces are safe from being sent back if they rest on a marked square. The first team to remove all of their pieces from the board wins. The game involves 4 players. ###
(define "CaptureEnemyPiece" ("HittingCapture" (handSite (who at:(to))))) (define "RemoveAPiece" (move Remove (from))) (define "SiteToMoveOnTrack" ("NextSiteOnTrack" (count Pips))) (game "Kawade Kelia" (players 4) (equipment { (board (merge { (rectangle 1 12) (shift 3.5 3.25 (scale 1 1.5 (rotate 90 (rectangle 1 4)))) (shift 0 7 (rectangle 1 12)) (shift -5.5 12.5 (rotate 90 (rectangle 1 12))) (shift 2.5 10.5 (rotate 90 (rectangle 1 6))) (shift 5.5 12.5 (rotate 90 (rectangle 1 12))) (shift 0 18 (rectangle 1 11)) (shift 1 11 (rotate 45 (rectangle 1 4))) (shift 5 13 (graph vertices:{ { 0 0} {0 1} {-0.94 0.26} {-0.23 -0.44}} edges:{ {0 1} {1 2} {2 3} {3 0}}))}) { (track "Track1" "71,0,E5,N5,E,N,W,S,E5,N,WSW,SW,End" P1 directed:True) (track "Track2" "72,11,W6,N5,W,N,E,S,W6,N,WSW,SW,End" P2 directed:True) (track "Track3" "73,0,E5,N5,E,N,W,S,E5,N,WSW,SW,End" P3 directed:True) (track "Track4" "74,11,W6,N5,W,N,E,S,W6,N,WSW,SW,End" P4 directed:True)}) (piece "Paddle" Each (if ("IsEndTrack" "SiteToMoveOnTrack") "RemoveAPiece" (if ("IsNotOffBoard" "SiteToMoveOnTrack") (if (or { (is Empty "SiteToMoveOnTrack") ("IsFriendAt" "SiteToMoveOnTrack") (and ("IsEnemyAt" "SiteToMoveOnTrack") (not (is In "SiteToMoveOnTrack" (sites "Protect"))))}) (move (from (from) level:(level)) (to "SiteToMoveOnTrack" "CaptureEnemyPiece")))))) ("StickDice" 6) (hand Each) (regions "Protect" (sites {5 17 19 27 41 57 46 62 63 34 35 51 52}))}) (rules (start { (place Stack "Paddle1" (handSite P1) count:3) (place Stack "Paddle2" (handSite P2) count:3) (place Stack "Paddle3" (handSite P3) count:3) (place Stack "Paddle4" (handSite P4) count:3) (set Team 1 {P1 P3}) (set Team 2 {P2 P4})}) (play ("RollMove" (or (forEach Piece) (forEach Piece container:(mover) top:True)))) (end { ("EscapeTeamWin")}))) END
Construct a global Ludii definition which fulfills the following requirements. Defines starting rules placing one counter on each black cell of a square board (e.g. Starting rules of Draughts). ###
(define "BlackCellsSetup" (start { (place "Counter1" (difference (expand (sites Bottom) steps:(- #1 1)) (sites Phase 1))) (place "Counter2" (difference (expand (sites Top) steps:(- #1 1)) (sites Phase 1)))})) END
Construct a Ludii game based on the following description King piece. Four defenders with the king. King starts in the central space, with one defender on each side. The rules are describing with the Nielsen ruleset. ###
(define "JarlButNotTheExpandedCentre" (and ("IsPieceAt" "Jarl" P2 (between)) (not (is In (between) (expand origin:(centrePoint) Orthogonal))))) (define "JarlAndExpandedCentre" (and ("IsPieceAt" "Jarl" P2 (between)) (is In (between) (expand origin:(centrePoint) Orthogonal)))) (define "EmptyCentre" (and (is In (to) (sites Centre)) (is Empty (to)))) (define "FriendOrCentre" (or ("IsFriendAt" (to)) (is In (to) (sites Centre)))) (define "FriendOrFortress" (or ("IsFriendAt" (to)) (is In (to) (sites "Fortresses")))) (define "CentreOrFortress" (is In (to) (union (sites Centre) (sites "Fortresses")))) (define "JarlWasCaptured" (is Triggered "Surrounded" P2)) (define "JarlIsCaptured" (apply (trigger "Surrounded" P2))) (define "Custodial" (custodial (from (last To)) Orthogonal (between (max 1) if:(= (what at:(between)) (id #1)) (apply (remove (between)))) (to if:(or { ("IsFriendAt" (to)) (is In (to) (sites "Fortresses")) "EmptyCentre"})))) (game "Brandub" (players 2) (equipment { (board (square 7)) (regions "Fortresses" (sites Corners)) (piece "Thrall" P1 (move Slide Orthogonal (to (apply if:(not "CentreOrFortress"))) (then (or { ("Custodial" "Thrall2") (surround (from (last To)) Orthogonal (between if:"JarlAndExpandedCentre" "JarlIsCaptured") (to if:"FriendOrCentre")) (custodial (from (last To)) Orthogonal (between (max 1) if:"JarlButNotTheExpandedCentre" "JarlIsCaptured") (to if:"FriendOrFortress"))})))) (piece "Thrall" P2 (move Slide Orthogonal (to (apply if:(not "CentreOrFortress"))) (then ("Custodial" "Thrall1")))) (piece "Jarl" P2 (move Slide Orthogonal (to (apply if:(not (= (to) (centrePoint))))) (then ("Custodial" "Thrall1"))))}) (rules (start { (place "Thrall1" {"D1" "D2" "A4" "B4" "F4" "G4" "D6" "D7"}) (place "Thrall2" {"D3" "C4" "E4" "D5"}) (place "Jarl2" (centrePoint))}) (play (forEach Piece)) (end { ("PieceTypeReachWin" "Jarl2" (sites "Fortresses") P2) (if "JarlWasCaptured" (result P1 Win))}))) END
Construct a Ludii game based on the following description 4x6, 8, or 10 holes. Eight is most common. Two counters in each hole. Sowing begins from any hole on the player's side, in either direction, but the direction chosen on the first turn must be maintained throughout the game. If the final counter lands in an empty hole, the turn ends. If the final counter lands in the outer row in an occupied hole, these are picked up and sowing continues. If the final counter lands in an occupied hole in the inner row, and the opponent's inner row hole opposite contains more than one counter, these are captured and the sowing continues from the hole from which the capture was made using the captured counters and the final counter from the sowing that caused the capture. If the opponent has no counters in any of their inner row holes, the counters in their outer row holes can be captured, in the same manner. Evidence Map Each player has 8 holes on each row. ###
(define "Columns" 8) (game "Katra" (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 "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
Construct a Ludii game based on the following description Played on a hexagonal board with five spaces per side. Players take turns placing stones on an empty space. The stone must be adjacent to the last stone played but cannot be adjacent to any other. The last player to be able to make a legal move wins. ###
(define "AdjacentNotEmptySites" (sites Around (to) if:(not (is In (to) (sites Empty))))) (game "Blue Nile" (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 Around (last To) if:(and (is Empty (to)) ("NoSites" (difference ("AdjacentNotEmptySites") (last To)))))))))} (end ("NoMoves" Loss)))) END
Construct a Ludii game based on the following description 13x13 intersecting lines. Two players. Each player has 26 pieces. Pieces begin on the two lines closest to each player, opposite sides of the board. Pieces move along the lines of the board to an adjacent spot. A piece can be captured by hopping over an opponent's adjacent piece to an empty spot immediately on the opposite side of it. Multiple captures are allowed. The player who captures all of the opponent's pieces wins. ###
(game "Tavelspel" (players 2) (equipment { (board (square 13) use:Vertex) (piece "Marker" Each)}) (rules (start { (place "Marker1" (expand (sites Bottom))) (place "Marker2" (expand (sites Top)))}) (play (if "SameTurn" (or ("HopSequenceCaptureAgain") (move Pass)) (forEach Piece "Marker" (or ("HopSequenceCapture") ("StepToEmpty"))))) (end ("CaptureAll" Next)))) END
Construct a Ludii game based on the following description Each player begins with nine pieces. Pieces moves along the lines to the next intersection point. Players may hop an opponent's piece to capture it. Captures can be made in sequence if another capture is available after the previous one is made. The player who captures all of their opponent's pieces wins. The player loses when he has no piece. ###
(game "Pretwa" (players 2) (equipment { (board (concentric {1 6 6 6}) use:Vertex) (piece "Counter" Each (or ("HopRotationalSequenceCapture") ("StepRotationalToEmpty")))}) (rules (start { (place "Counter1" (sites {2..4 8..10 14..16})) (place "Counter2" (sites {1 6 5 7 12 11 13 18 17}))}) (play (if "SameTurn" (or ("HopRotationalSequenceCaptureAgain") (move Pass)) (forEach Piece))) (end ("CaptureAll" Next)))) END
Construct a Ludii game based on the following description This game is played on a square grid board of any size, though 13x13 or 19x19 are recommended. Then the players take it in turns to place 1-3 White stones each turn until one decides to pass; that player then becomes White, and the other becomes Black. After that, Black places two stones per turn on any empty point, while White places just one White stone per turn. If Black connects any two sides of the board with a single orthogonally-connected group, they win; White wins if they connect all four sides with a group connected either orthogonally or diagonally. During the initial chicken ballot phase, you may add stones by clicking on available spaces, or skip the rest of your placements (by choosing the Next Player action). Alternatively, you may Pass at the start of your turn to take White. After that, play continues with White playing one stone and Black playing two, until one player forms a connection (draws are impossible). Played on a size 13 board. ###
(define "Skip" (move Set NextPlayer (player (next)))) (define "IsPlayingPhase" (= 1 (var))) (define "BlackVC" (or (is Connected Orthogonal {(sites Side N) (sites Side S)}) (is Connected Orthogonal {(sites Side E) (sites Side W)}))) (define "WhiteVC" (is Connected All {(sites Side N) (sites Side S) (sites Side E) (sites Side W)})) (game "Pippinzip (Zipline variant)" (players 2) (equipment { (board (square 13) use:Vertex) (piece "Disc" Each)}) (rules phases:{ (phase "Opening" (play (or (or (move Add (piece (id "Disc" P2)) (to (sites Empty)) (then (if (< (count MovesThisTurn) 2) (moveAgain)))) "Skip") (if (= (count MovesThisTurn) 0) (move Pass (then (if (is Mover P1) (swap Players P1 P2 (then (note "Player 1 is now White. Player 2 is now Black." to:All))) (note "Player 1 is now Black. Player 2 is now White." to:All) (then (do (set NextPlayer (player 1)) next:(set Var 1))))))))) (nextPhase ("IsPlayingPhase") "Playing")) (phase "Playing" (play (or (move Add (to (sites Empty) if:(= (id P1) (mover))) (then (if (= 0 (count MovesThisTurn)) (moveAgain)))) (move Add (to (sites Empty) if:(= (id P2) (mover)))))))} (end { (if (and (not ("IsPlayingPhase")) ("WhiteVC")) (result Mover Win)) (if (and {(= (id P1) (mover)) ("BlackVC")}) (result P1 Win)) (if (and {(= (id P2) (mover)) ("WhiteVC")}) (result P2 Win))}))) END
Construct a Ludii game based on the following description 2x6 board. Three counters per hole. Sowing occurs in an anti-clockwise direction when starting from the right three holes of a player's row, or in a clockwise direction when starting from the player's left three holes. When the final counter falls into an occupied hole, these are picked up and sowing continues, except when this hole is made to contain four counters, in which case these counters are captured and the player takes another turn. These captures may not be made on the first turn. When the final counter lands in an empty hole, the turn ends. Play continues until one player is without counters in their row. The opponent then captures the remaining counters in their row, and the player that has captured the most counters wins. ###
(define "PiecesOwnedBy" (count Cell at:(handSite #1))) (define "OneRowEmpty" (or (all Sites (sites P1 "Home") if:(= 0 (count at:(site)))) (all Sites (sites P2 "Home") if:(= 0 (count at:(site)))))) (game "Wa'ache Waledat" (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) (regions "Home" P1 (sites Bottom)) (regions "Home" P2 (sites Top)) (regions "RightHome" P1 (intersection (expand (sites Right) steps:2) (sites Bottom))) (regions "RightHome" P2 (intersection (expand (sites Right) steps:2) (sites Top))) (regions "LeftHome" P1 (intersection (expand (sites Left) steps:2) (sites Bottom))) (regions "LeftHome" P2 (intersection (expand (sites Left) steps:2) (sites Top))) (hand Each)}) (rules (start (set Count 3 to:(sites Track))) (play (or (if (or (>= 0 (var "Direction")) (= 1 (var "Direction"))) (move Select (from (if (and ("SameTurn") (= 1 (var "ContinueSowing"))) "LastHoleSowed" (sites Mover "RightHome")) if:(> (count at:(from)) 0)) (then (sow "TrackCCW" apply:(if (< 1 (count at:(to))) (and { (moveAgain) (set Var "Direction" 1) (set Var "ContinueSowing" 1) (if (and (= 4 (count at:(to))) (< 2 (count Turns))) (and (fromTo (from (to)) (to (handSite Mover)) count:4) (set Var "ContinueSowing" 0)))}) (set Var "Direction" 0)))))) (if (or (>= 0 (var "Direction")) (= 2 (var "Direction"))) (move Select (from (if (and ("SameTurn") (= 1 (var "ContinueSowing"))) "LastHoleSowed" (sites Mover "LeftHome")) if:(> (count at:(from)) 0)) (then (sow "TrackCW" apply:(if (< 1 (count at:(to))) (and { (moveAgain) (set Var "Direction" 2) (set Var "ContinueSowing" 1) (if (and (= 4 (count at:(to))) (< 2 (count Turns))) (and (fromTo (from (to)) (to (handSite Mover)) count:4) (set Var "ContinueSowing" 0)))}) (set Var "Direction" 0)))))) (then (if ("OneRowEmpty") (and (forEach Site (sites P1 "Home") (fromTo (from (site)) (to (handSite P1)) count:(count at:(site)))) (forEach Site (sites P2 "Home") (fromTo (from (site)) (to (handSite P2)) count:(count at:(site))))))))) (end ("MancalaByScoreWhen" ("NoPieceOnBoard"))))) END
Construct a Ludii game based on the following description 8x8 board. 16 pieces per player, lined up in the second and third rows (first row on each side is empty). Pieces move forward or horizontally one space, and capture opponents' pieces by jumping in these directions. When they reach the opposite side, they become a king and can jump opponents' pieces from any distance orthogonally. Captures must be taken if possible, and the maximum number of jumps must be made. In a situation where two pieces are able to make the maximum number of captures and one of them is a king, the king must make the captures. Multiple captures cannot be made by moving 180 degrees from the previous jump. Pieces can be promoted to king mid-jump. Winning is achieved by capturing all of the other player's pieces or by blocking them so they cannot move. ###
(define "IsUnpromoted" ("IsPieceAt" "Counter" Mover (last To))) (define "HopMan" ("HopCapture" (from #1) (directions {Forward Rightward Leftward}) #2)) (define "PromotedHopOrthogonalSequenceCapture" ("HopCaptureDistance" #1 #2 ~ (then ("ReplayIfCanMove" ("HopCaptureDistanceNotAlreadyHopped" (from (last To)) (difference Orthogonal OppositeDirection)))))) (game "Dama (Kenya)" (players 2) ("DraughtsEquipment" (square 8)) (rules (start { (place "Counter1" (union (sites Row 1) (sites Row 2))) (place "Counter2" (union (sites Row 5) (sites Row 6)))}) (play (if "SameTurn" (if "IsUnpromoted" (max Moves ("HopMan" (last To) (then ("ReplayIfCanMove" ("HopMan" (last To)) ("PromoteIfReach" (sites Next) "DoubleCounter"))))) (max Moves ("PromotedHopOrthogonalSequenceCapture" (from (last To)) (difference Orthogonal OppositeDirection)))) (priority { (max Moves (priority { (forEach Piece "DoubleCounter" ("PromotedHopOrthogonalSequenceCapture" (from) Orthogonal)) (forEach Piece "Counter" ("HopMan" (from) (then ("ReplayIfCanMove" ("HopMan" (last To)) ("PromoteIfReach" (sites Next) "DoubleCounter")))))})) (or (forEach Piece "Counter" ("StepToEmpty" (directions {Forward Rightward Leftward})) (then ("PromoteIfReach" (sites Next) "DoubleCounter"))) (forEach Piece "DoubleCounter" (move Slide Orthogonal)))}))) (end ("BlockWin")))) END
Modify the Ludii game according to the following option changes: Each player has 8 holes. -> Each player has 9 holes. (define "NoPiece" (all Sites (sites Player "Home") if:(= 0 (count at:(site))))) (define "Columns" 8) (game "Namudilakunze" (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" "23,W,N1,E" loop:True P2)}) (piece "Seed" Shared) (regions "Home" P1 (sites Track "TrackCCW1")) (regions "Home" P2 (sites Track "TrackCCW2")) (regions "Inner" P1 (difference (sites Track "TrackCCW1") (sites Bottom))) (regions "Inner" P2 (difference (sites Track "TrackCCW2") (sites Top))) (hand Each)}) (rules (start (set Count 1 to:(difference (sites Board) (sites { 0 (- (* ("Columns") 4) 1)})))) phases:{ (phase "FirstTurn" (play (move Select (from (if ("SameTurn") ("LastHoleSowed") (sites Mover "Home")) if:(is Occupied (from))) (then (sow "TrackCW" owner:(mover) apply:(if (< 1 (count at:(to))) (moveAgain) (if (is In (to) (sites Mover "Inner")) (if (is Occupied ("OppositePit" (to))) (remove ("OppositePit" (to))) (if (is Occupied ("OppositeOuterPit" (to))) (remove ("OppositeOuterPit" (to))))))))))) (nextPhase Mover (not (is Next Mover)) "Main")) (phase "Main" (play (or (if (or (>= 0 (value Player Mover)) (= (value Player Mover) 1)) (move Select (from (if ("SameTurn") ("LastHoleSowed") (sites Mover "Home")) if:(is Occupied (from))) (then (sow "TrackCCW" owner:(mover) apply:(and (if (< 1 (count at:(to))) (moveAgain) (if (is In (to) (sites Mover "Inner")) (if (is Empty ("OppositePit" (to))) (if (is Occupied ("OppositeOuterPit" (to))) (remove ("OppositeOuterPit" (to))))))) (if (!= 1 (value Player Mover)) (set Value Mover 1))))))) (if (or (>= 0 (value Player Mover)) (= (value Player Mover) 2)) (move Select (from (if ("SameTurn") ("LastHoleSowed") (sites Mover "Home")) if:(is Occupied (from))) (then (sow "TrackCW" owner:(mover) apply:(and (if (< 1 (count at:(to))) (moveAgain) (if (is In (to) (sites Mover "Inner")) (if (is Empty ("OppositePit" (to))) (if (is Occupied ("OppositeOuterPit" (to))) (remove ("OppositeOuterPit" (to))))))) (if (!= 2 (value Player Mover)) (set Value Mover 2))))))))))} (end (forEach NonMover if:("NoPiece") (result Player Loss))))) ###
(define "NoPiece" (all Sites (sites Player "Home") if:(= 0 (count at:(site))))) (define "Columns" 9) (game "Namudilakunze" (players 2) (equipment { (mancalaBoard 4 "Columns" store:None { (track "TrackCCW1" "0,E,N1,W" loop:True P1) (track "TrackCCW2" "18,E,N1,W" loop:True P2) (track "TrackCW1" "8,W,N1,E" loop:True P1) (track "TrackCW2" "26,W,N1,E" loop:True P2)}) (piece "Seed" Shared) (regions "Home" P1 (sites Track "TrackCCW1")) (regions "Home" P2 (sites Track "TrackCCW2")) (regions "Inner" P1 (difference (sites Track "TrackCCW1") (sites Bottom))) (regions "Inner" P2 (difference (sites Track "TrackCCW2") (sites Top))) (hand Each)}) (rules (start (set Count 1 to:(difference (sites Board) (sites { 0 (- (* ("Columns") 4) 1)})))) phases:{ (phase "FirstTurn" (play (move Select (from (if ("SameTurn") ("LastHoleSowed") (sites Mover "Home")) if:(is Occupied (from))) (then (sow "TrackCW" owner:(mover) apply:(if (< 1 (count at:(to))) (moveAgain) (if (is In (to) (sites Mover "Inner")) (if (is Occupied ("OppositePit" (to))) (remove ("OppositePit" (to))) (if (is Occupied ("OppositeOuterPit" (to))) (remove ("OppositeOuterPit" (to))))))))))) (nextPhase Mover (not (is Next Mover)) "Main")) (phase "Main" (play (or (if (or (>= 0 (value Player Mover)) (= (value Player Mover) 1)) (move Select (from (if ("SameTurn") ("LastHoleSowed") (sites Mover "Home")) if:(is Occupied (from))) (then (sow "TrackCCW" owner:(mover) apply:(and (if (< 1 (count at:(to))) (moveAgain) (if (is In (to) (sites Mover "Inner")) (if (is Empty ("OppositePit" (to))) (if (is Occupied ("OppositeOuterPit" (to))) (remove ("OppositeOuterPit" (to))))))) (if (!= 1 (value Player Mover)) (set Value Mover 1))))))) (if (or (>= 0 (value Player Mover)) (= (value Player Mover) 2)) (move Select (from (if ("SameTurn") ("LastHoleSowed") (sites Mover "Home")) if:(is Occupied (from))) (then (sow "TrackCW" owner:(mover) apply:(and (if (< 1 (count at:(to))) (moveAgain) (if (is In (to) (sites Mover "Inner")) (if (is Empty ("OppositePit" (to))) (if (is Occupied ("OppositeOuterPit" (to))) (remove ("OppositeOuterPit" (to))))))) (if (!= 2 (value Player Mover)) (set Value Mover 2))))))))))} (end (forEach NonMover if:("NoPiece") (result Player Loss))))) END
Construct a Ludii game based on the following description 2x7 board. Five counters in each hole. Players sow in a clockwise direction. When the final counter lands in a hole, the contents of the next hole are picked up and sowing continues. When the final counter is sown and the next hole is empty, the contents of the hole in the opposite row of the empty hole are captured. Play continues until all of the counters are captured. A new game begins. The players fill their holes with five counters in each, starting from their left. The player who has remaining counters after all of their holes are full puts the extra counters aside. The player who has fewer counters places the remainder in the next empty hole. Any empty holes are out of play for the round. Play begins with the same rules, with the following modifications: Each player, during their opponent's turn, also captures counters in any hole that are made to equal the number of extra counters they had at the beginning of this round (i.e., the number of counters set aside by the winning player or the number of counters less than five that placed in the final hole by the loser). The player who could fill their holes will capture one counter each time that player sows into the hole in which the opponent placed fewer than five counters at the beginning of the round. The opponent cannot sow in this hole. In addition, at the end of the round, the player who filled their holes at the beginning of the round will always capture pieces that accumulate in this hole. Subsequent rounds are played like this until one player captures all of the counters, and thus wins. ###
(define "LeftMostEmpty" (trackSite FirstSite "TrackCCW" from:(mapEntry "LeftMost" Mover) if:(is Empty (to)))) (define "NoPieceOnBoard" (all Sites (forEach (sites Board) if:(= 0 (state at:(site)))) if:(= 0 (count at:(site))))) (define "PlayableSites" (sites (values Remembered "Playable"))) (define "NextHole" ("NextSiteOnTrack" #2 from:#1 "Track")) (define "Columns" 7) (game "Mawkar Katiya" (players 2) (equipment { (mancalaBoard 2 "Columns" store:None { (track "TrackCW" "6,W,N,E" loop:True) (track "TrackCCW" "0,E,N,W" loop:True)}) (piece "Seed" Shared) (hand Each) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (map "LeftMost" {(pair P1 0) (pair P2 13)})}) (rules (start { (set Count 5 to:(sites Track "TrackCW")) (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")) (!= (next) (state at:(from)))})) (then (do (and (set Var "NumSowed" (count at:(last To))) (set Var "StateSowFrom" (state at:(last To)))) next:(sow "TrackCW" apply:(if (is Occupied ("NextHole" (to) 1)) (and (moveAgain) (set Var "Replay" ("NextHole" (to) 1))) (if (is Occupied ("OppositePitTwoRows" ("NextHole" (to) 1))) (and (fromTo (from ("OppositePitTwoRows" ("NextHole" (to) 1))) (to (handSite Mover)) count:(count at: ("OppositePitTwoRows" ("NextHole" (to) 1)))) (set State at:("OppositePitTwoRows" ("NextHole" (to) 1)) (state at:("OppositePitTwoRows" ("NextHole" (to) 1))))))) skipIf:(or (and (!= (state at:(to)) (mover)) (!= (state at:(to)) 0)) (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 (and (= (value Player Mover) (count at:(site))) (or (= (state at:(site)) (mover)) (= (state at:(site)) 0))) (and (fromTo (from (site)) (to (handSite Mover)) count:(value Player Mover)) (set State at:(site) (state at:(site)))) (if (and (is Occupied (site)) (= (mover) (state at:(site)))) (and (fromTo (from (site)) (to (handSite Mover)) count:1) (set State at:(site) (state at:(site))))))) (set Var "NumSowed" 0) (if (< 0 (var "StateSowFrom")) (set State at:(last From) (var "StateSowFrom")))})))))} (then (if ("NoPieceOnBoard") (and { (forEach Site (sites Board) (and (if (= (state at:(site)) 1) (fromTo (from (site)) (to (handSite P1)) count:(count at:(site)))) (if (= (state at:(site)) 2) (fromTo (from (site)) (to (handSite P2)) count:(count at:(site)))))) (forget Value "Playable" All) (if (>= (count Cell at:(handSite P1)) (count Cell at:(handSite P2))) (set Var "CurrentWinner" 1) (set Var "CurrentWinner" 2)) (set Value P2 0) (set Value P1 0) (forEach Site (sites Board) (if (!= 0 (state at:(site))) (set State at:(site) 0)))}))))) (end (if ("NoPieceOnBoard") { (if (= 0 (count Cell at:(handSite P1))) (result P2 Win)) (if (= 0 (count Cell at:(handSite P2))) (result P1 Win))})) (nextPhase ("NoPieceOnBoard") "BetweenRounds")) (phase "BetweenRounds" (play (if (not (all Sites (sites Mover) if:(is Occupied (site)))) (if (<= 5 (count Cell at:(handSite Mover))) (move (from (handSite Mover)) (to "LeftMostEmpty") count:5 (then (remember Value "Playable" (last To)))) (if (and (!= 0 (count Cell at:(handSite Mover))) (!= (mover) (var "CurrentWinner"))) (move (from (handSite Mover)) (to "LeftMostEmpty") count:(count Cell at:(handSite Mover)) (then (and { (remember Value "Playable" (last To)) (set Value Mover (count at:(last To))) (set State at:(last To) (next))}))))) (if (= (mover) (var "CurrentWinner")) (move Pass (then (set Value Mover (count Cell at:(handSite Mover)))))))) (nextPhase (all Passed) "Sowing"))})) END
Modify the Ludii game according to the following option changes: The quadrant selected is the bottom left one. -> The quadrant selected is the bottom right one. (define "RemoveAPiece" (move Remove (from))) (define "SiteToMoveOnTrack" ("NextSiteOnTrack" (pips))) (game "Los Doze Canes" (players 2) (equipment { ("TableBoard" "TableTracksOppositeWithHands") (dice d:6 num:2) (piece "Disc" Each (forEach Die if:("DieNotUsed") (if ("NoEnemyOrOnlyOne" ("SiteToMoveOnTrack")) (move (from) (to "SiteToMoveOnTrack" ("HittingCapture" (handSite Next))))))) (hand Each)}) (rules (start { (place Stack "Disc1" (handSite P1) count:12) (place Stack "Disc2" (handSite P2) count:12)}) (play ("RollEachNewTurnMove" (or (forEach Piece top:True) (forEach Piece container:(mover) top:True) (then ("ReplayNotAllDiceUsed"))))) (end { (if (and { (= 2 (size Stack at:0)) (= 2 (size Stack at:1)) (= 2 (size Stack at:2)) (= 2 (size Stack at:3)) (= 2 (size Stack at:4)) (= 2 (size Stack at:5)) (= 0 (count Sites in:(difference (sites Occupied by:Mover) (sites {0..5}))))}) (result Mover Win)) (if (and (< 2 (size Stack at:12)) (< 2 (size Stack at:0))) (result Mover Draw))}))) ###
(define "RemoveAPiece" (move Remove (from))) (define "SiteToMoveOnTrack" ("NextSiteOnTrack" (pips))) (game "Los Doze Canes" (players 2) (equipment { ("TableBoard" "TableTracksOppositeWithHands") (dice d:6 num:2) (piece "Disc" Each (forEach Die if:("DieNotUsed") (if ("NoEnemyOrOnlyOne" ("SiteToMoveOnTrack")) (move (from) (to "SiteToMoveOnTrack" ("HittingCapture" (handSite Next))))))) (hand Each)}) (rules (start { (place Stack "Disc1" (handSite P1) count:12) (place Stack "Disc2" (handSite P2) count:12)}) (play ("RollEachNewTurnMove" (or (forEach Piece top:True) (forEach Piece container:(mover) top:True) (then ("ReplayNotAllDiceUsed"))))) (end { (if (and { (= 2 (size Stack at:6)) (= 2 (size Stack at:7)) (= 2 (size Stack at:8)) (= 2 (size Stack at:9)) (= 2 (size Stack at:10)) (= 2 (size Stack at:11)) (= 0 (count Sites in:(difference (sites Occupied by:Mover) (sites {6..11}))))}) (result Mover Win)) (if (and (< 2 (size Stack at:12)) (< 2 (size Stack at:0))) (result Mover Draw))}))) END
Construct a Ludii game based on the following description Forty stones, placed in a circle with a larger space after every tenth stone. The spaces between the stones are the playing spaces. Two to four players, each with one counter. Three sticks, round on one side and flat on the other, used as dice. The throws are as follows: three round sides = 10; three flat sides up = 5; one round and two flat = 3; two round and one flat = 1 or 2. Players move from one of the wider spaces around the board in opposite directions. When a player lands on the same spot as the opponent's piece, the opponent's piece is sent back to the beginning. The first player to complete a circuit of the board wins. The game has 2 players. ###
(define "MadeACompleteCircuit" (if (= 1 (state at:(where "Stick" Mover))) (is In (value Piece at:(where "Stick" Mover)) (sites Track "TrackCCW" from:("NextSite" (last From) "TrackCCW") to:(last To))) (is In (value Piece at:(where "Stick" Mover)) (sites Track "TrackCW" from:("NextSite" (last From) "TrackCW") to:(last To))))) (define "MoveOn" (if ("IsNotOffBoard" #1) (if (or (is Empty #1) ("IsEnemyAt" #1)) (move (from (from) level:(level)) (to #1 ("HittingCapture" (value Piece at:((to))))))))) (define "NextSite" ("NextSiteOnTrack" 1 from:#1 #2)) (define "SiteToMoveOnSelectedTrack" (if (= (state at:(from)) 1) ("NextSiteOnTrack" #1 "TrackCCW") ("NextSiteOnTrack" #1 "TrackCW"))) (define "ThrowValue" (mapEntry "ThrowDiceValue" (count Pips))) (game "Tsaydithl" (players 2) (equipment { ("FortyStonesWithFourGapsBoard" { (track "TrackCW" {39 35 33 31 29 27 25 23 21 19 38 17 15 13 11 9 7 5 3 1 37 0 2 4 6 8 10 12 14 16 36 18 20 22 24 26 28 30 32 34} loop:True) (track "TrackCCW" {39 34 32 30 28 26 24 22 20 18 36 16 14 12 10 8 6 4 2 0 37 1 3 5 7 9 11 13 15 17 38 19 21 23 25 27 29 31 33 35} loop:True)}) (piece "Stick" Each (or (if (= 2 ("ThrowValue")) ("MoveOn" ("SiteToMoveOnSelectedTrack" (- ("ThrowValue") 1)))) ("MoveOn" ("SiteToMoveOnSelectedTrack" ("ThrowValue"))))) (regions "Gates" (sites {36..39})) (map "ThrowDiceValue" {(pair 0 5) (pair 1 3) (pair 2 2) (pair 3 10)}) ("StickDice" 3) (hand Each)}) (rules (start { (place "Stick1" 36 state:1 value:36) (place "Stick2" 38 state:2 value:38)}) (play ("RollMove" (forEach Piece))) (end (if ("MadeACompleteCircuit") (result Mover Win))))) END
Construct a Ludii game based on the following description 6x7 lines forming a grid. Diagonals in each small square, with a point where the diagonals cross. 28 pieces, which begin on opposite sides of the board. In addition, each player has a Prince piece, which begins on the rightmost point immediately in front of the other pieces, and a King piece, which begins on the rightmost point in the line in front of the Prince. All pieces move one space to an empty adjacent spot along the lines. A piece may capture an adjacent opponent's piece by hopping over it to an empty adjacent spot on the opposite side of it. Multiple captures are allowed. Captures are not compulsory and neither are the maximum number of captures. Pieces may only capture other pieces of the same rank or lower. A player wins when they capture all of the opponent's pieces, or by blocking a higher ranking piece from being able to move if it is the only remaining piece belonging to the opponent. If players are left with only one piece each of the same rank, one player may declare single combat, and both pieces must move toward one another until one captures the other. If only the Kings are left on the board the game is a draw. ###
(define "StepToEmptyToward" (move Step (to if:(and (is Empty (to)) (< (count Steps (to) (regionSite (sites Occupied by:Next) index:0)) (count Steps (from) (regionSite (sites Occupied by:Next) index:0))))))) (define "OneSinglePieceSameRank" (and { ("OneSinglePiece" P1) ("OneSinglePiece" P2) (= ("HigherValue" P1) ("HigherValue" P2))})) (define "SingleEnemyHigherPieceBlocked" (and { (< ("HigherValue" Mover) ("HigherValue" Next)) ("OneSinglePiece" Next) (no Moves Next)})) (define "OneSinglePiece" (= 1 (count Pieces #1))) (define "HigherValue" (max (results from:(sites Occupied by:#1) to:(sites Occupied by:#1) (value Piece at:(to))))) (define "OnlyKings" (and { (= 1 (count Pieces P1)) ("IsNotOffBoard" (where "King" P1)) (= 1 (count Pieces P2)) ("IsNotOffBoard" (where "King" P2))})) (define "HopSequenceCapture" (move Hop #1 (between if:(and ("IsEnemyAt" (between)) (>= (value Piece at:(from)) (value Piece at:(between)))) (apply (remove (between)))) (to if:(is Empty (to))) (then ("ReplayIfCanMove" (hop (from (last To)) (between if:(and ("IsEnemyAt" (between)) (>= (value Piece at:(from)) (value Piece at:(between)))) (apply (remove (between)))) (to if:(is Empty (to)))))))) (game "Dablot Prejjesne" (players {(player S) (player N)}) (equipment { (board (rectangle 7 6 diagonals:Solid) use:Vertex) (piece "Cone" Each (or ("StepToEmpty") ("HopSequenceCapture"))) (piece "Prince" Each (or ("StepToEmpty") ("HopSequenceCapture"))) (piece "King" Each (or ("StepToEmpty") ("HopSequenceCapture"))) (regions P1 (sites Top)) (regions P2 (sites Bottom))}) (rules (start { (place "Cone1" (expand (sites Bottom) steps:2)) (place "Cone2" (expand (sites Top) steps:2)) (place "Prince1" coord:"H4" value:1) (place "Prince2" coord:"E9" value:1) (place "King1" coord:"I4" value:2) (place "King2" coord:"D9" value:2)}) (play (if ("SameTurn") (or ("HopSequenceCapture" (from (last To))) (move Pass)) (if ("OneSinglePieceSameRank") (forEach Piece (priority ("HopCapture") ("StepToEmptyToward"))) (forEach Piece)))) (end { ("CaptureAll" Next) (if ("SingleEnemyHigherPieceBlocked") (result Mover Win)) (if ("OnlyKings" Next) (result Mover Draw))}))) END
Modify the Ludii game according to the following option changes: The game is played on a 2x2 board -> The game is played on a 3x3 board (define "NoEdgeBetweenCells" (not ("NoSites" (sites Around (to) Own Orthogonal if:("NoSites" (difference "EdgeInCommon" (sites Empty Edge))))))) (define "EdgeInCommon" (intersection (sites Incident Edge of:Cell at:(from)) (sites Incident Edge of:Cell at:(to)))) (define "NumContainmentByTurn" 4) (define "NumContagionByTurn" 3) (game "Contagion" (players 2) (equipment { (board (rectangle 2 2))}) (rules (start (set Score P2 (* (count Rows) (count Columns)))) phases:{ (phase "InitContagion" P1 (play (move Add (to Cell (sites Empty Cell)) (then (and (if (< (count MovesThisTurn) (- "NumContagionByTurn" 1)) (moveAgain)) (addScore {P1 P2} {1 -1}))))) (nextPhase (not (is Next Mover)) "ContagionGrowth")) (phase "ContagionGrowth" P1 (play (move Add (to Cell (sites Empty Cell) if:("NoEdgeBetweenCells")) (then (and (if (< (count MovesThisTurn) (- "NumContagionByTurn" 1)) (moveAgain)) (addScore {P1 P2} {1 -1})))))) (phase "Containment" P2 (play (move Add (to Edge (sites Empty Edge)) (then (if (< (count MovesThisTurn) (- "NumContainmentByTurn" 1)) (moveAgain))))))} (end { (if (> (score P1) (/ (* (count Rows) (count Columns)) 2)) (result P1 Win)) (if (no Moves P1) (result P2 Win))}))) ###
(define "NoEdgeBetweenCells" (not ("NoSites" (sites Around (to) Own Orthogonal if:("NoSites" (difference "EdgeInCommon" (sites Empty Edge))))))) (define "EdgeInCommon" (intersection (sites Incident Edge of:Cell at:(from)) (sites Incident Edge of:Cell at:(to)))) (define "NumContainmentByTurn" 4) (define "NumContagionByTurn" 3) (game "Contagion" (players 2) (equipment { (board (rectangle 3 3))}) (rules (start (set Score P2 (* (count Rows) (count Columns)))) phases:{ (phase "InitContagion" P1 (play (move Add (to Cell (sites Empty Cell)) (then (and (if (< (count MovesThisTurn) (- "NumContagionByTurn" 1)) (moveAgain)) (addScore {P1 P2} {1 -1}))))) (nextPhase (not (is Next Mover)) "ContagionGrowth")) (phase "ContagionGrowth" P1 (play (move Add (to Cell (sites Empty Cell) if:("NoEdgeBetweenCells")) (then (and (if (< (count MovesThisTurn) (- "NumContagionByTurn" 1)) (moveAgain)) (addScore {P1 P2} {1 -1})))))) (phase "Containment" P2 (play (move Add (to Edge (sites Empty Edge)) (then (if (< (count MovesThisTurn) (- "NumContainmentByTurn" 1)) (moveAgain))))))} (end { (if (> (score P1) (/ (* (count Rows) (count Columns)) 2)) (result P1 Win)) (if (no Moves P1) (result P2 Win))}))) END
Construct a Ludii game based on the following description There are three red ships and three black ships. The remainder of the cells contain white icebergs. The two players, Red and Black, take turns moving one of their own ships, one move per turn, starting with Red. Players are not allowed to pass. MOVES: You must move one of your ships to an adjacent cell which doesn't contain another ship. By moving to a cell containing an iceberg, you capture the iceberg, and your score increases by 1. MOVE DIRECTION: You must select one of your ships to move, and move it closer to its closest iceberg. Distance is measured by the number of cells between ship and iceberg along the shortest path of cells that connects them, going around other ships. If the ship you've chosen to move has icebergs adjacent to it, you must capture one of them. OBJECT OF THE GAME: The goal is to capture the majority of the icebergs. On the default size 5 board, there are 55 icebergs starting out. If you capture 28 of them, you win. A size 5 board is currently selected ###
(define "OntoEmptyOrIceberg" (step (to if:(or (= (id Neutral) (who at:(to))) (is Empty (to)))))) (define "NearestIcebergs" (intersection (sites Occupied by:Neutral) (sites Distance ("OntoEmptyOrIceberg") from:(from) (exact ("DistanceToNearestIceberg"))))) (define "DistanceToNearestIceberg" (count Steps ("OntoEmptyOrIceberg") (from) (sites Occupied by:Neutral))) (game "Icebreaker" (players 2) (equipment { (board (hex 5)) (piece "Disc" Each (move Step (to if:(and (or (= (id Neutral) (who at:(to))) (is Empty (to))) (= 1 (- (count Steps ("OntoEmptyOrIceberg") (from) ("NearestIcebergs")) (count Steps ("OntoEmptyOrIceberg") (to) ("NearestIcebergs"))))) (apply (if (is Occupied (to)) (and (remove (to)) (addScore Mover 1))))))) (piece "Disc" Neutral)}) (rules (start { (place "Disc0" (difference (sites Board) (sites Corners))) (place "Disc1" (sites Around (centrePoint) distance:(- 5 1) NNW)) (place "Disc1" (sites Around (centrePoint) distance:(- 5 1) E)) (place "Disc1" (sites Around (centrePoint) distance:(- 5 1) SSW)) (place "Disc2" (sites Around (centrePoint) distance:(- 5 1) NNE)) (place "Disc2" (sites Around (centrePoint) distance:(- 5 1) W)) (place "Disc2" (sites Around (centrePoint) distance:(- 5 1) SSE))}) (play (forEach Piece Mover)) (end (if (or (< (/ (- (count Sites in:(sites Board)) 6) 2) (score P1)) (< (/ (- (count Sites in:(sites Board)) 6) 2) (score P2))) (byScore))))) END
Construct a Ludii game based on the following description The graph is initially empty. Players alternate turns colouring an uncoloured edge between two of the vertices. Both players share a common colour for this gameplay. Radran is a score-based game. At each turn, a player gets a score, which is equal to the cost of his last coloured edge. The game ends when the coloured graph is regular. The player with the highest score wins. The version of the game played with 2 players. ###
(game "Radran" (players 2) (equipment { (board (graph vertices:{{0 0} {5 0} {10 0} {0 5} {5 5} {10 5} {0 10} {5 10} {10 10}} edges:{{0 1} {0 2} {0 3} {0 4} {0 5} {0 6} {0 7} {1 2} {1 3} {1 4} {1 5} {1 6} {1 8} {2 3} {2 4} {2 5} {2 7} {2 8} {3 4} {3 6} {3 7} {3 8} {4 5} {4 6} {4 7} {4 8} {5 6} {5 8} {5 7} {6 7} {6 8} {7 8}}) use:Edge) (piece "Marker" Neutral)}) (rules (start { (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) (set Cost 2 Edge at:21) (set Cost 3 Edge at:22) (set Cost 1 Edge at:23) (set Cost 2 Edge at:24) (set Cost 3 Edge at:25) (set Cost 1 Edge at:26) (set Cost 2 Edge at:27) (set Cost 3 Edge at:28) (set Cost 3 Edge at:29) (set Cost 1 Edge at:30) (set Cost 2 Edge at:31)}) (play (move Add (piece "Marker0") (to Edge (sites Empty Edge)) (then (addScore Mover (cost Edge at:(last To)))))) (end (if (is RegularGraph Neutral) (byScore))))) END
Describe the mechanics of the following Ludii game (define "NumEnemyOppositeCorners" (count Sites in:(forEach (sites Around (site)) if:(and (is In (site) (sites Around (last To))) ("IsEnemyAt" (site)))))) (define "NumEnemyCorners" (count Sites in:(forEach (sites Around (site)) if:("IsEnemyAt" (site))))) (define "AllCornersSquareOccupied" (all Sites (sites Around (site)) if:(is Occupied (site)))) (define "AllCornersSquareEmpty" (all Sites (sites Around (site)) if:(is Empty (site)))) (define "MidpointSquares" (forEach (sites Board) if:(and (= 4 (count Sites in:(sites Around (site)))) (not (is In (site) (sites Outer)))))) (game "Onyx" (players 2) (equipment { (board (keep (rotate -45 (subdivide (tiling T33434 7 7) min:4)) (poly {{-6.5 1.75} {-6.5 12.75} {4.5 12.75} {4.5 1.75}})) use:Vertex) (piece "Disc" Each) (regions P1 {(sites Side W) (sites Side E)}) (regions P2 {(sites Side N) (sites Side S)})}) (rules (start { (place "Disc1" (sites {15 24 119 128})) (place "Disc2" (sites {20 27 116 123}))}) (play (move Add (to (forEach (sites Empty) if:(if (is In (site) ("MidpointSquares")) ("AllCornersSquareEmpty") True))) (then (forEach Site ("MidpointSquares") (if (and { (is Empty (site)) (is In (last To) (sites Around (site))) ("AllCornersSquareOccupied") (= 2 ("NumEnemyCorners")) (= 2 ("NumEnemyOppositeCorners"))}) (remove (forEach (sites Around (site)) if:("IsEnemyAt" (site))))))))) (end (if (is Connected Mover) (result Mover Win))))) ###
The initial setup has four black pieces and four white pieces pre-placed. Black moves first by placing a black piece on any empty point of the board. White follows suit. Turns continue to alternate. A piece can be placed on the midpoint of a square only if all four corners of that square are currently unoccupied. Once placed, pieces do not move. Captured pieces are immediately removed from the game. The rule for capturing allows a player to capture two enemy pieces in a single turn. All of the following conditions must be met: - the two enemy pieces occupy opposite corners of a square; - a third corner of the square is already occupied by a piece owned by the capturing player; - the square's midpoint is unoccupied. The capture is executed by placing a piece on the remaining unoccupied corner of the square. If the capturing move also simultaneously completes a second square on the board where the same conditions prevail, then the move results in the capture of four enemy pieces instead of two. Black tries to connect the two horizontal (black) sides with an unbroken chain of black pieces, while White tries to connect the two vertical (white) sides with an unbroken chain of white pieces. The first to do so wins the game. END
Construct a Ludii game based on the following description 4x12 board. Four counters in each hole. Players alternate turns sowing the counters from one hole in an anti-clockwise direction. When the counters fall into a hole in their inner row, the contents of the opponent's opposite inner row hole are captured, as are any in the opponent's corresponding outer row hole, but only if counters were captured from the inner row hole. The player who captures the most counters wins. ###
(define "PiecesOwnedBy" (count Cell at:(handSite #1))) (define "Columns" 12) (game "Moruba" (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) (hand Each)}) (rules (start (set Count 4 to:(union (sites P1 "Home") (sites P2 "Home")))) (play (move Select (from (sites Mover "Home") if:(> (count at:(from)) 0)) (then (sow "Track" owner:(mover) if:(and { (is In (to) (sites Mover "Inner")) (> (count at:("OppositePit" (to))) 0)}) apply:(and (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)))))))))) (end ("MancalaByScoreWhen" (no Moves Mover))))) END
Describe the mechanics of the following Ludii game (define "Columns" 8) (game "Lobudok" (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))) (regions "SideHoles" P1 (intersection (sites Track "Track1") (union (sites Left) (sites Right)))) (regions "SideHoles" P2 (intersection (sites Track "Track2") (union (sites Right) (sites Left)))) (piece "Seed" Shared) (hand Each)}) (rules (start { (set Count 1 to:(sites {2 5 13 10 29 26 18 21})) (set Count 8 to:(sites {15 16 8 23})) (set Count 6 to:(sites {6 9 22 25}))}) (play (or (move Select (from (if ("SameTurn") "LastHoleSowed" (difference (sites Mover "Home") (sites Mover "SideHoles"))) if:(> (count at:(from)) 1)) (then (sow "Track" owner:(mover) apply:(if (and { (is In (to) (sites Mover "Inner")) (< 1 (count at:(to))) (is Occupied ("OppositeOuterPit" (to))) (is Occupied ("OppositePit" (to)))}) (and { (fromTo (from ("OppositeOuterPit" (to))) (to (last From)) count:(count at:("OppositeOuterPit" (to)))) (fromTo (from ("OppositePit" (to))) (to (last From)) count:(count at:("OppositePit" (to)))) (sow (last From) count:(+ (count at:("OppositePit" (to))) (count at:("OppositeOuterPit" (to)))) "Track" owner:(mover) skipIf:(and (!= 1 (value Player Mover)) (is In (to) (sites "SideHoles"))))}) (if (< 1 (count at:(to))) (moveAgain))) skipIf:(and (!= 1 (value Player Mover)) (is In (to) (sites "SideHoles")))))) (if (if (= 1 (value Player Mover)) True (all Sites (difference (sites Mover "Home") (sites Mover "SideHoles")) if:(<= (count at:(site)) 1))) (move Select (from (if ("SameTurn") "LastHoleSowed" (sites Mover "SideHoles")) if:(> (count at:(from)) 1)) (then (and (sow "Track" owner:(mover) apply:(if (and { (is In (to) (sites Mover "Inner")) (< 1 (count at:(to))) (is Occupied ("OppositeOuterPit" (to))) (is Occupied ("OppositePit" (to)))}) (and { (fromTo (from ("OppositeOuterPit" (to))) (to (last From)) count:(count at:("OppositeOuterPit" (to)))) (fromTo (from ("OppositePit" (to))) (to (last From)) count:(count at:("OppositePit" (to)))) (sow (last From) count:(+ (count at:("OppositePit" (to))) (count at:("OppositeOuterPit" (to)))) "Track" owner:(mover))}) (if (< 1 (count at:(to))) (moveAgain)))) (if (= 0 (value Player Mover)) (set Value Mover 1)))))))) (end ("ForEachPlayerNoMovesLoss")))) ###
4x8 board. The counters begin in the following arrangement, starting from a player's left most hole in the outer row and proceeding anticlockwise: 0,0,1,0,0,1,6,0,8,0,1,0,0,1,6,8. To start, players may not sow into or sow from the leftmost and rightmost holes in both of their rows. When it is no longer possible for the player to make a legal move using only these twelve holes, they may then play using all of the holes. The opponent must continue using only twelve holes until they also cannot make a legal move with them. Sowing proceeds in an anti-clockwise direction. When the final counter falls into an occupied hole in the player's inner row and both of the opposite holes on the opponent's side of the board are occupied, the counters in the opposite holes are captured and sown beginning in the first hole that was sown into to begin the sowing that caused the capture. When the final counter falls into an occupied hole and a capture is not possible, the contents of the hole are picked up and sowing continues. When the final counter lands in an empty hole, the turn ends. Players cannot sow from a hole containing a single counter. The player who captures all of their opponent's counters wins. END
Construct a Ludii game based on the following description 3x5 intersecting lines, with diagonals in the four quadrants created. On either short end, an arc connects the two corner points, and the center line is extended to the arc. One player plays as four hounds, which begin on the four points to the left side of the board. The other player plays as one hare, which begins on the point where the center line and the second line cross. Players alternate turns moving a piece to an empty adjacent spot along the lines. The hounds may only move forward. The hounds win when they block the hare from being able to move. The game has an ending condition only for P2. ###
(game "Hund efter Hare (Thy)" (players 2) (equipment { (board (remove (add (merge { (rectangle 3 5) (shift 1 0 (scale 0.5 (rectangle 5 1))) (shift 3 0 (scale 0.5 (rectangle 5 1))) (shift -1 1 (rectangle 1 7))}) edges:{ {0 15} {15 7} {7 18} {18 14} {17 4} {7 17} {7 16} {16 10} {19 10} {0 19} {20 14} {20 4} {12 16} {16 5} {5 15} {15 2} {2 17} {17 9} {9 18} {18 12}}) edges:{{11 6} {6 1} {13 8} {8 3}}) use:Vertex) (piece "Hare" P1 "StepToEmpty") (piece "Dog" P2 E "StepForwardsToEmpty")}) (rules (start { (place "Hare1" coord:"C3") (place "Dog2" (sites {"B3" "B1" "A3" "B5"}))}) (play (forEach Piece)) (end { (if (no Moves P1) (result P2 Win))}))) END
Describe the mechanics of the following Ludii game (game "T'oki" (players 2) (equipment { (board (square 5)) (piece "Marker" Each (or ("StepOrthogonalToEmpty") (move Hop Orthogonal (between (range 1 (count Rows)) if:("IsEnemyAt" (between)) (apply (remove (between)))) (to if:(or (and (is In (to) (sites Outer)) ("IsEnemyAt" (to))) (is Empty (to))))))) (hand Each)}) (rules (start (place "Marker" "Hand" count:20)) (play (or (move (from (handSite Mover)) (to (sites Empty)) count:2) (forEach Piece))) (end (if (and ("HandEmpty" Next) (no Pieces Next)) (result Mover Win))))) ###
5x5 board. Twenty pieces per player. Players alternate turns placing pieces on the board, two at a time into the same square. At any time, a player may move one piece from a square one spot in an orthogonal direction. Pieces may capture opponent's pieces when either a single square or an unbroken line of squares with opponent's pieces has an empty space beyond it; the player's piece hops over the opponent's pieces and captures them all. When the unbroken line ends at the edge of the board, it is treated as though there were an empty square beyond the edge of the board, and the capturing piece is placed on the last space on the board in that line. Players may enter any reserved pieces on any turn as they see fit. The player to capture all of the opponent's pieces wins. 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 by taking one turn. After that players take DOUBLE turns in alternation. Play: Each turn has two parts that both must be completed: A PLACEMENT and a SWAP. -- The PLACEMENT is made a knight's leap away from a selected stone of the same color. -- The SWAP is done by exchanging the contents of the 2 squares that lie between the selected stone and the placed stone. For a SWAP to be valid, the contents of these squares 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 squares. / Smaller board to focus on stacked play as a significant part of the game. -- Normal single turn alternation for a more fine-grained experience, but with a first player advantage. 8x8 Square First player takes one turn, then players alternate taking 2 turns each ###
(define "KnightVector" (sites (from) {{F R F L F} {F L F R F}})) (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) (if (and ("NewTurn") (< -1 (counter))) (moveAgain))})))) (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 "KnightVector" 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 (Square)" (players 2) (equipment { (board (renumber (rotate 90 (square Square 8))) use:Cell) (piece "Disc" Each)}) (rules (start { (place "Disc1" {28}) (place "Disc2" {36})}) (play (priority ("Placement" (sites Empty)) ("Placement" (sites Occupied by:Next)) (then ("MakeSwap")))) (end (if (!= 0 (+ (score P1) (score P2))) (byScore))))) END
Describe the mechanics of the following Ludii game (define "CaptureMove" (and (fromTo (from ("NextHoleFrom" (to) #1 2)) (to (handSite Mover)) count:(count at:("NextHoleFrom" (to) #1 2))) (if (and (is Empty ("NextHoleFrom" (to) #1 3)) (is Occupied ("NextHoleFrom" (to) #1 4))) (and (fromTo (from ("NextHoleFrom" (to) #1 4)) (to (handSite Mover)) count:(count at:("NextHoleFrom" (to) #1 4))) (if (and (is Empty ("NextHoleFrom" (to) #1 5)) (is Occupied ("NextHoleFrom" (to) #1 6))) (and (fromTo (from ("NextHoleFrom" (to) #1 6)) (to (handSite Mover)) count:(count at:("NextHoleFrom" (to) #1 6))) (if (and (is Empty ("NextHoleFrom" (to) #1 7)) (is Occupied ("NextHoleFrom" (to) #1 8))) (fromTo (from ("NextHoleFrom" (to) #1 8)) (to (handSite Mover)) count:(count at:("NextHoleFrom" (to) #1 8)))))))))) (define "NextHoleFrom" ("NextSiteOnTrack" #3 from:#1 #2)) (define "LastHoleSowed" (last To afterConsequence:True)) (define "PiecesOwnedBy" (count Cell at:(handSite #1))) (game "Dongjintian" (players 2) (equipment { (mancalaBoard 2 5 store:None { (track "TrackCCW" "0,E,N,W" loop:True) (track "TrackCW" "4,W,N,E" loop:True)}) (piece "Seed" Shared) (hand Each) (regions P1 (sites Bottom)) (regions P2 (sites Top))}) (rules (start (set Count 5 to:(sites Track))) (play (or (if (or (>= 0 (var "Direction")) (= (var "Direction") 1)) (move Select (from (if ("SameTurn") (sites {("NextHoleFrom" "LastHoleSowed" "TrackCCW" 1)}) (sites Mover)) if:(is Occupied (from))) (then (sow "TrackCCW" apply:(if (is Occupied ("NextHoleFrom" (to) "TrackCCW" 1)) (and (moveAgain) (set Var "Direction" 1)) (if (and (is Empty ("NextHoleFrom" (to) "TrackCCW" 1)) (is Occupied ("NextHoleFrom" (to) "TrackCCW" 2))) (and ("CaptureMove" "TrackCCW") (set Var "Direction" 0)))))))) (if (or (>= 0 (var "Direction")) (= (var "Direction") 2)) (move Select (from (if ("SameTurn") (sites {("NextHoleFrom" "LastHoleSowed" "TrackCW" 1)}) (sites Mover)) if:(is Occupied (from))) (then (sow "TrackCW" apply:(if (is Occupied ("NextHoleFrom" (to) "TrackCW" 1)) (and (moveAgain) (set Var "Direction" 2)) (if (and (is Empty ("NextHoleFrom" (to) "TrackCW" 1)) (is Occupied ("NextHoleFrom" (to) "TrackCW" 2))) (and ("CaptureMove" "TrackCW") (set Var "Direction" 0)))))))))) (end ("MancalaByScoreWhen" (<= (count Pieces All in:(sites Board)) 1))))) ###
2x5 board. Five counters per hole. Sowing can happen in either direction. When the last counter falls into a hole, sowing continues if there are counters in the following holes; these are picked up and sowing continues from there. When the hole after the end of a sowing is empty, the counters in the next hole following it are captured. If a pattern of alternating empty and occupied holes continues after this, the counters in the occupied holes are captured, until there are two occupied or two empty holes in a row. The player who captures the most counters wins. END
Construct a Ludii game based on the following description Play begins with the supply of pieces (30 of each colour) randomly distributed on the board, so each cell contains only one stone and there is one free space left. This free space can be anywhere except the centre space. Each player has an allocated colour. Before the game starts, Black can swap the positions of any two stones on the board. White then starts the game. Players alternate turns during the game until one of them cannot make a valid move, thereby losing the game. On a turn, a player must make one capture. A player makes a capture by leaping in a straight line in any of the 6 directions exactly as many spaces as friendly pieces surround its original position, and landing on an enemy piece, which is removed from the game. The player who cannot make a capture loses. ###
(define "DistanceToMove" (count Sites in:(sites Around (from) Orthogonal if:("IsFriendAt" (to))))) (game "Quantum Leap" (players 2) (equipment { (board (hex 5)) (piece "Marker" Each (move Hop Orthogonal (between (exact (- "DistanceToMove" 1)) if:True) (to if:("IsEnemyAt" (to)) (apply (remove (to))))))}) (rules (start { (place "Marker2" (centrePoint)) (place Random {"Marker2"} count:29) (place Random {"Marker1"} count:30)}) phases:{ (phase "Swap" (play (or (move Pass) (move Select (from (sites Occupied by:Mover)) (to (sites Occupied by:Next)) (then (swap Pieces (last From) (last To)))))) (nextPhase "Play")) (phase "Play" (play (forEach Piece)))} (end ("NoMoves" Loss)))) END
Construct a global Ludii definition which fulfills the following requirements. Defines a piece moving like a knight in Chess. ###
(define "ChessKnight" (piece #1 Each ("LeapCapture" "KnightWalk" #2 #3))) END
Modify the Ludii game according to the following option changes: The game is played on a 9x9 board. -> The game is played on a 13x13 board. (define "HasMadeACapture" (is Triggered "CaptureMade" Next)) (define "CaptureSurroundedPiece" (enclose (from (last To)) Orthogonal (between if:("IsEnemyAt" (between)) (apply (and (trigger "CaptureMade" Next) (remove (between))))))) (game "Atari Go" (players 2) (equipment { (board (square 9) use:Vertex) (piece "Marker" Each)}) (rules (play (do (move Add (to (sites Empty)) (then ("CaptureSurroundedPiece"))) ifAfterwards:("HasFreedom" Orthogonal))) (end (if "HasMadeACapture" (result Mover Win))))) ###
(define "HasMadeACapture" (is Triggered "CaptureMade" Next)) (define "CaptureSurroundedPiece" (enclose (from (last To)) Orthogonal (between if:("IsEnemyAt" (between)) (apply (and (trigger "CaptureMade" Next) (remove (between))))))) (game "Atari Go" (players 2) (equipment { (board (square 13) use:Vertex) (piece "Marker" Each)}) (rules (play (do (move Add (to (sites Empty)) (then ("CaptureSurroundedPiece"))) ifAfterwards:("HasFreedom" Orthogonal))) (end (if "HasMadeACapture" (result Mover Win))))) END
Modify the Ludii game according to the following option changes: Order 5 board -> Order 7 board (define "ColourBackground" (colour 156 130 126)) (define "ColourBackground2" (colour 156 130 126)) (define "ColourBackground1" (colour 126 130 156)) (define "SquareDiagonal" (board (square 5) use:Vertex)) (define "SquareGrid" (board (square 5) use:Cell)) (define "BoardUsed" "SquareDiagonal") (define "ConnectionDirection" All) (define "ScoreConnectionDirection" Orthogonal) (define "AllHave1Connection2Edge" (all Sites #1 if:(or (and (is Empty (site)) (is In (site) (sites Outer))) (!= Infinity (count Steps (step "ConnectionDirection" (to if:(is Empty (to)))) (site) (difference (sites Outer) (site))))))) (define "CapturingAtScoreWhat4Who" (forEach Value (array #1) (if (> 2 (count Sites in:(sites Around (value) "ConnectionDirection" if:(is Empty (to))))) (if (is #2 (who at:(value))) (remove (value) (then (if (is Empty (handSite #3)) (add (piece (id "Disc" #2)) (to (handSite #3)) (then (set Value at:(handSite #3) (+ 1 (value Piece at:(handSite #3)))))) (set Value at:(handSite #3) (+ 1 (value Piece at:(handSite #3))))))) (remove (value)))))) (define "Scoring" (set Var "MoverScore" (+ (value Piece at:(handSite Mover)) ("GroupCount" Mover)) (then (set Var "NextScore" (+ (value Piece at:(handSite Next)) ("GroupCount" Next)) (then ("CascadeTiebreaker")))))) (define "CascadeTiebreaker" (if (= (var "MoverScore") (var "NextScore")) (and (set Score Mover (* -1 ("CascadeScore" Mover Next))) (set Score Next (* -1 ("CascadeScore" Next Mover)))) ("CascadeTie"))) (define "CascadeTie" (and (set Score Mover (var "MoverScore")) (set Score Next (var "NextScore")))) (define "CascadeScore" (max 0 (max (difference (sizes Group "ScoreConnectionDirection" #1) (sizes Group "ScoreConnectionDirection" #2))))) (define "GroupCount" (max 0 (max (sizes Group "ScoreConnectionDirection" #1)))) (game "Watershed" (players 2) (equipment { "BoardUsed" (piece "Ball" Each) (piece "Disc" Each) (hand Each size:1)}) (rules (start (set Score Each 0)) (play (do (move Add (to (sites Empty) if:(< 1 (count Sites in:(intersection (sites Around (to) "ConnectionDirection") (sites Empty)))))) ifAfterwards:("AllHave1Connection2Edge" (intersection (sites Around (last To) "ConnectionDirection") (sites Empty))) (then (do ("CapturingAtScoreWhat4Who" (intersection (sites Occupied by:All) (sites Around (last To) "ConnectionDirection")) Next Mover) next:("Scoring"))))) (end (if (no Moves Next) { (if (= (score Mover) (score Next)) (result Mover Win)) (if (!= (score Mover) (score Next)) (byScore))})))) ###
(define "ColourBackground" (colour 156 130 126)) (define "ColourBackground2" (colour 156 130 126)) (define "ColourBackground1" (colour 126 130 156)) (define "SquareDiagonal" (board (square 7) use:Vertex)) (define "SquareGrid" (board (square 7) use:Cell)) (define "BoardUsed" "SquareDiagonal") (define "ConnectionDirection" All) (define "ScoreConnectionDirection" Orthogonal) (define "AllHave1Connection2Edge" (all Sites #1 if:(or (and (is Empty (site)) (is In (site) (sites Outer))) (!= Infinity (count Steps (step "ConnectionDirection" (to if:(is Empty (to)))) (site) (difference (sites Outer) (site))))))) (define "CapturingAtScoreWhat4Who" (forEach Value (array #1) (if (> 2 (count Sites in:(sites Around (value) "ConnectionDirection" if:(is Empty (to))))) (if (is #2 (who at:(value))) (remove (value) (then (if (is Empty (handSite #3)) (add (piece (id "Disc" #2)) (to (handSite #3)) (then (set Value at:(handSite #3) (+ 1 (value Piece at:(handSite #3)))))) (set Value at:(handSite #3) (+ 1 (value Piece at:(handSite #3))))))) (remove (value)))))) (define "Scoring" (set Var "MoverScore" (+ (value Piece at:(handSite Mover)) ("GroupCount" Mover)) (then (set Var "NextScore" (+ (value Piece at:(handSite Next)) ("GroupCount" Next)) (then ("CascadeTiebreaker")))))) (define "CascadeTiebreaker" (if (= (var "MoverScore") (var "NextScore")) (and (set Score Mover (* -1 ("CascadeScore" Mover Next))) (set Score Next (* -1 ("CascadeScore" Next Mover)))) ("CascadeTie"))) (define "CascadeTie" (and (set Score Mover (var "MoverScore")) (set Score Next (var "NextScore")))) (define "CascadeScore" (max 0 (max (difference (sizes Group "ScoreConnectionDirection" #1) (sizes Group "ScoreConnectionDirection" #2))))) (define "GroupCount" (max 0 (max (sizes Group "ScoreConnectionDirection" #1)))) (game "Watershed" (players 2) (equipment { "BoardUsed" (piece "Ball" Each) (piece "Disc" Each) (hand Each size:1)}) (rules (start (set Score Each 0)) (play (do (move Add (to (sites Empty) if:(< 1 (count Sites in:(intersection (sites Around (to) "ConnectionDirection") (sites Empty)))))) ifAfterwards:("AllHave1Connection2Edge" (intersection (sites Around (last To) "ConnectionDirection") (sites Empty))) (then (do ("CapturingAtScoreWhat4Who" (intersection (sites Occupied by:All) (sites Around (last To) "ConnectionDirection")) Next Mover) next:("Scoring"))))) (end (if (no Moves Next) { (if (= (score Mover) (score Next)) (result Mover Win)) (if (!= (score Mover) (score Next)) (byScore))})))) END
Describe the mechanics of the following Ludii game (define "IsSpecialThrow" (is In ("ThrowValue") (sites {7 25 30 14}))) (define "SiteToMoveOnTrack" ("NextSiteOnTrack" #2 #1)) (define "ThrowValue" (mapEntry "Throw" (count Pips))) (game "Pachih" (players 4) (equipment { ("PachisiBoard" { (track "Track1" "96,9,S,E,N,11,E,N,W,53,N,W,S,42,W,S,E,8,S,E1,N7,End" P1 directed:True) (track "Track2" "96,26,W,S,E,8,S,E,N,11,E,N,W,53,N,W,S,42,W,S1,E7,End" P2 directed:True) (track "Track3" "96,52,N,W,S,42,W,S,E,8,S,E,N,11,E,N,W,53,N,W1,S7,End" P3 directed:True) (track "Track4" "96,27,E,N,W,53,N,W,S,42,W,S,E,8,S,E,N,11,E,N1,W7,End" P4 directed:True)}) ("StickDice" 7) (piece "Pawn" Each (if ("IsEndTrack" ("SiteToMoveOnTrack" from:(from) ("ThrowValue"))) (move Remove (from) level:(level)) (move (from (from) level:(level)) (to ("SiteToMoveOnTrack" from:(from) ("ThrowValue")) if:True (apply (if (and (not (is In (to) (sites "SafeSites"))) ("IsEnemyAt" (to))) (forEach Level (to) FromTop (fromTo (from (to) level:(level)) (to (centrePoint)))))))))) (regions "SafeSites" (sites {60 62 2 37 87 89 16 48})) (map "Throw" {(pair 0 7) (pair 1 10) (pair 2 2) (pair 3 3) (pair 4 4) (pair 5 25) (pair 6 30) (pair 7 14)})}) (rules (start { (place Stack "Pawn1" 9 count:4) (place Stack "Pawn2" 26 count:4) (place Stack "Pawn3" 52 count:4) (place Stack "Pawn4" 27 count:4)}) (play ("RollMove" (forEach Piece) (then (if (and (< (value Player Mover) 2) ("IsSpecialThrow")) (and (moveAgain) (set Value Mover (+ 1 (value Player Mover)))) (set Value Mover Undefined))))) (end ("EscapeWin")))) ###
Four 3x8 rectangles, arranged in a cross shape around a large central square. The third space, counting from the outer corner, in the two outer rows of each arm of the board are marked with an \ END
Construct a Ludii game based on the following description Three concentric squares, with lines connecting the corners and the midpoints of the sides. Two diamonds drawn, one connecting the midpoints of the outer square and intersecting the corners of the second square; the second connecting the midpoints of the second square and intersecting the corners of the central square. Twelve pieces per plays. Players alternate turns placing a piece on an empty spot on the board. When all of the pieces are placed, players alternate turns moving a piece to an empty adjacent spot along the lines. During either phase, when a player places three of their pieces in a row, they remove one of the opponent's pieces. Pieces which are in a three-in-a-row pattern cannot be removed. The player who removes all of the opponent's pieces wins. ###
(game "Xonin Shatar (Complex)" (players 2) (equipment { (board (add (remove (merge { (shift 3 3 (remove (square 3) edges:{{1 4} {3 4} {4 7} {4 5}})) (shift 2 2 (scale 2 (remove (square 3) edges:{{1 4} {3 4} {4 7} {4 5}}))) (scale 4 (remove (square 3) edges:{{1 4} {3 4} {4 7} {4 5}}))}) vertices:{4}) edges:{ {17 19} {17 20} {20 22} {22 19} {17 9} {19 11} {22 14} {12 20} {21 13} {23 15} {18 10} {16 8} {11 9} {9 12} {12 14} {14 11} {9 1} {11 3} {6 14} {4 12} {0 8} {5 13} {7 15} {10 2}}) use:Vertex) (hand Each) (piece "Marker" Each ("StepToEmpty" ~ (then ("ReplayIfLine3"))))}) (rules (start (place "Marker" "Hand" count:12)) phases:{ (phase "Placement" (play (if "SameTurn" ("RemoveAnyEnemyPieceNotInLine3" Orthogonal) (move (from (handSite Mover)) (to (sites Empty)) (then ("ReplayIfLine3"))))) (nextPhase Mover ("HandEmpty" Mover) "Movement")) (phase "Movement" (play (if "SameTurn" ("RemoveAnyEnemyPieceNotInLine3" Orthogonal) (forEach Piece))))} (end ("CaptureAll" Next)))) END
Construct a Ludii game based on the following description The two players, Red and Blue, take turns coloring cells with their own color, one cell per turn, starting with Red. To win you must form a path of cells of your own color connecting the two border regions of your color. ###
(game "Fractal" (players 2) (equipment { (board (add (add (union (shift 3.45 6 (scale 3 (remove (remove (clip (hex 3) (poly { { 0 1} { 2 1} { 4 5} { 1 4}})) cells:{9}) vertices:{26 30 34 39 35 40 36 31 27 22 18 14 9 13 8 12 17 21 25}))) (union (remove (shift 5.77 10 (scale 0.333 (remove (remove (hex Star 5) cells:{0 1 2 3 4 5 6 7 8 9 30 29 45 28 44 59 27 43 58 72 165 164 149 163 148 134 162 147 133 120 180 178 179 175 176 177 171 172 173 174 150 135 151 152 136 121 108 122 137 153 15 16 31 17 32 46 18 33 47 60}) cells:{ 0 1 2 3 4 12 21 31 42 54 77 88 98 107 115 120 119 118 117 116 108 99 89 78 66 43 32 22 13 5 6 8 9 11 30 41 65 87 97 114 112 111 109 90 79 55 33 23}))) vertices:{0..40 42 43 45..50 62..67 80..84 97..100 113..116 128..131 143..146 158..160 173 174 187 200 212 224 366 237 250 263 264 276..278 290..293 305..308 321..324 337..340 353..357 369..374 375..380 382 383 385..425 358..363 341..345 325..328 309..312 294..297 279..282 265..267 251 252 238 225 213 201 188 175 161..162 147..149 132..135 117..120 101..104 85..88 68..72 51..56 59}) (remove (remove (remove (remove (remove (hex Star 5) cells:{0 1 2 3 4 5 6 7 8 9 30 29 45 28 44 59 27 43 58 72 165 164 149 163 148 134 162 147 133 120 180 178 179 175 176 177 171 172 173 174 150 135 151 152 136 121 108 122 137 153 15 16 31 17 32 46 18 33 47 60}) cells:{ 0 1 2 3 4 12 21 31 42 54 77 88 98 107 115 120 119 118 117 116 108 99 89 78 66 43 32 22 13 5 6 8 9 11 30 41 65 87 97 114 112 111 109 90 79 55 33 23}) cells:{ 26 27 35 36 37 45 46}) vertices:{ 193 180 167 181 168 182 195 208 220 232 245 258 244 257 243 230 217 205}) vertices:{188 198 199 208 209 219 0..40 42 43 59 45..50 62..67 80..84 97..100 113..116 128..131 143..146 158..160 171..172 182 193 203 213 224 234 245 246 258..260 272..275 287..290 303..306 319..322 335..339 351..362 364 365 367..407 340..345 323..327 307..310 291..294 276..279 261..264 247..249 235 236 225 214 204 194 183 173 161 162 147..149 132..135 117..120 101..104 85..88 68..72 51..56}))) edges:{ {216 4} {7 229} {217 5} {236 8} {12 282} {18 318} {22 364} {25 378} {24 377} {21 357} {17 311} {11 275} {91 286} {43 270} {30 262} {31 263} {50 271} {287 101} {307 154} {323 202} {331 215} {330 214} {322 195} {306 144}}) cells:{ {0 4 216 218 223 230 222 229 7 3} {4 1 5 217 220 226 233 225 232 224 219 216} {5 2 6 8 236 228 235 227 221 217} {8 10 12 282 274 281 273 266 258 251 244 236} {12 14 16 18 318 310 302 296 290 282} {18 20 22 364 356 348 341 334 325 317 326 318} {22 26 29 25 378 376 370 363 371 364} {25 28 24 377 373 367 360 368 361 369 375 378} {24 27 23 21 357 365 358 366 372 377} {21 19 17 311 319 312 320 327 335 342 349 357} {17 15 13 11 275 283 291 297 303 311} {275 11 9 7 229 237 245 252 259 268 276 267} {43 36 44 37 32 30 262 254 261 270} {30 33 38 46 39 47 40 34 31 263 255 262} {31 35 41 49 42 50 271 264 256 263} {50 58 65 72 80 89 100 90 101 287 279 271} {101 112 122 132 143 154 307 300 294 287} {202 323 315 307 154 164 153 163 172 179 186 194} {323 332 339 331 215 213 208 201 209 202} {338 331 215 212 207 199 206 198 205 211 214 330} {330 337 329 322 195 203 196 204 210 214} {322 314 306 144 155 145 156 165 173 180 187 195} {306 299 293 286 91 102 113 123 133 144} {286 278 270 43 51 59 66 73 82 92 81 91}})) (piece "Marker" Each) (regions P1 {(sites Side NW) (sites Side SE)}) (regions P2 {(sites Side NE) (sites Side SW)})}) (rules (play (move Claim (to (sites Empty)))) (end (if (is Connected Mover) (result Mover Win))))) END
Construct a Ludii game based on the following description 2x4 board. Six counters in each hole. At the beginning of the game, each player chooses one hole to be their sowing hole, from which each move on their turn must begin. The players agree on a direction of play, which is maintained throughout the game. Players alternate turns sowing from their sowing hole. The players may choose to sow one-by-one, two-by-two, three-by-three, four-by-four, and so forth, into the following holes. When the final counter lands in a hole causing it to contain two, four, six, or eight counters, the contents of that hole are captured. If the preceding hole also contains two, four, six, or eight counters, these are also captured, proceeding until there is a no longer a hole with two, four, six, or eight counters. If at the end of a turn a player sowed into the opponent's row and any of the opponent's holes contain two, four, six, or eight counters, providing the player sowed into them, the opponent captures these counters. In a players own row, if either player sows into a hole with an odd number of counters, making it an even number of counters, the player who owns that row captures the counters. If a player's sowing hole is empty at the beginning of their turn, they pass. Play continues until all of the counters are captured, or there is only one left on the board. The single counter is captured by the player in whose row it is located. A new round begins. Players fill up as many holes as they can with six counters. If a player cannot, they fill as many as they can with six counters, and place the remainder in a hole, either between two with six counters or after them, and erases any empty holes. Play continues as before. When one player has erased all of their holes, the opponent wins. The game is played counter clockwise. ###
(define "OneOrLessPieceOnBoard" (> 2 (count in:(union (sites Top) (sites Bottom))))) (define "PlayableSites" (sites (values Remembered "Playable"))) (game "Buqruru" (players 2) (equipment { (mancalaBoard 2 4 store:None (track "Track" "0,E,N,W" loop:True)) (piece "Seed" Shared) (hand Each) (regions P1 (sites Bottom)) (regions P2 (sites Top))}) (rules (start { (set Count 6 to:(sites Track)) (set RememberValue "Playable" (sites Board))}) phases:{ (phase "SelectingHole" (play (move Select (from (sites Mover) if:(is In (from) ("PlayableSites"))) (then (set Value Mover (last To))))) (nextPhase Mover "Sowing")) (phase "Sowing" (play (if (is Occupied (value Player Mover)) (or { (move Select (from (value Player Mover) if:(is In (from) ("PlayableSites"))) (then (sow numPerHole:1 sowEffect:(if (and (is In (to) (sites Next)) (or { (= 1 (count at:(to))) (= 3 (count at:(to))) (= 5 (count at:(to))) (= 7 (count at:(to)))})) (fromTo (from (to)) (to (handSite Mover)) count:(count at:(to)))) apply:(if (or { (= 2 (count at:(to))) (= 4 (count at:(to))) (= 6 (count at:(to))) (= 8 (count at:(to)))}) (fromTo (from (to)) (to (handSite Mover)) count:(count at:(to)))) skipIf:(not (is In (to) ("PlayableSites"))) backtracking:True))) (if (= 0 (% (count at:(value Player Mover)) 2)) (move Select (from (value Player Mover)) (then (sow numPerHole:2 sowEffect:(if (and (is In (to) (sites Next)) (or { (= 0 (count at:(to))) (= 2 (count at:(to))) (= 4 (count at:(to))) (= 6 (count at:(to)))})) (fromTo (from (to)) (to (handSite Mover)) count:(count at:(to)))) apply:(if (or { (= 2 (count at:(to))) (= 4 (count at:(to))) (= 6 (count at:(to))) (= 8 (count at:(to)))}) (fromTo (from (to)) (to (handSite Mover)) count:(count at:(to)))) skipIf:(not (is In (to) ("PlayableSites"))) backtracking:True)))) (if (= 0 (% (count at:(value Player Mover)) 3)) (move Select (from (value Player Mover)) (then (sow numPerHole:3 sowEffect:(if (and (is In (to) (sites Next)) (or { (= 1 (count at:(to))) (= 3 (count at:(to))) (= 5 (count at:(to)))})) (fromTo (from (to)) (to (handSite Mover)) count:(count at:(to)))) apply:(if (or { (= 2 (count at:(to))) (= 4 (count at:(to))) (= 6 (count at:(to))) (= 8 (count at:(to)))}) (fromTo (from (to)) (to (handSite Mover)) count:(count at:(to)))) skipIf:(not (is In (to) ("PlayableSites"))) backtracking:True)))) (if (= 0 (% (count at:(value Player Mover)) 4)) (move Select (from (value Player Mover)) (then (sow numPerHole:4 sowEffect:(if (and (is In (to) (sites Next)) (or { (= 0 (count at:(to))) (= 2 (count at:(to))) (= 4 (count at:(to)))})) (fromTo (from (to)) (to (handSite Mover)) count:(count at:(to)))) apply:(if (or { (= 2 (count at:(to))) (= 4 (count at:(to))) (= 6 (count at:(to))) (= 8 (count at:(to)))}) (fromTo (from (to)) (to (handSite Mover)) count:(count at:(to)))) skipIf:(not (is In (to) ("PlayableSites"))) backtracking:True))))}) (then (if ("OneOrLessPieceOnBoard") (and { (forEach Site (sites P1) (if (is Occupied (site)) (fromTo (from (site)) (to (handSite P1)) count:(count at:(site))))) (forEach Site (sites P2) (if (is Occupied (site)) (fromTo (from (site)) (to (handSite P2)) count:(count at:(site))))) (forget Value "Playable" All)}))))) (end { (if (and (= 0 (count at:(value Player P1))) (= 0 (count at:(value Player P2)))) (result Mover Draw)) (if ("OneOrLessPieceOnBoard") { (if (= 0 (count Cell at:(handSite P1))) (result P2 Win)) (if (= 0 (count Cell at:(handSite P2))) (result P1 Win))})}) (nextPhase ("OneOrLessPieceOnBoard") "BetweenRounds")) (phase "BetweenRounds" (play (if (not (all Sites (sites Mover) if:(is Occupied (site)))) (if (<= 6 (count at:(handSite Mover))) (move (from (handSite Mover)) (to (sites Mover)) count:6 (then (remember Value "Playable" (last To)))) (move (from (handSite Mover)) (to (sites Mover)) count:(count at:(handSite Mover)) (then (remember Value "Playable" (last To))))))) (nextPhase (all Passed) "SelectingHole"))})) END
Construct a Ludii game based on the following description A Latin Square puzzle is one in which an n x n grid is filled with n symbols, which cannot repeat in a row or column of the grid. ###
(game "Latin Square" (players 1) (equipment { (board (square 5) (values Cell (range 1 5))) (regions {Columns Rows})}) (rules (play (satisfy (all Different))) (end (if (is Solved) (result P1 Win))))) END
Describe the mechanics of the following Ludii game (game "Gomoku" (players 2) (equipment { (board (square 15) use:Vertex) (piece "Marker" Each)}) (rules (play (move Add (to (sites Empty)))) (end (if (is Line 5 All exact:True) (result Mover Win))))) ###
Played on a Go board, using 15x15 of the intersecting lines. The first player places 2 black and 1 white piece on the board. The second player can then choose to: play as black, play as white and place another white piece, or place two more stones and let the other player choose which color to play. Players take turns placing pieces in an attempt to make 5 in a row. In the Standard version, rows of more than five do not count. Played on a 15x15 board. Open anywhere. Win with a line of exactly five stones. END
Construct a Ludii game based on the following description 4x8 board. Two counters in each hole. Before play, players may arrange their counters as they see fit in their holes. Players alternate turns sowing the counters from one of their holes in an anticlockwise direction. When the final counter lands in an empty hole, their turn is over. If the final counter lands in an occupied hole, the contents of the two opposite hole in the opponent's rows are captured. If both do not have counters, then the player picks up the counters from the hole the last counter fell into and continues sowing. The player who captures all of the opponent's counters wins. ###
(define "PiecesOwnedBy" (count in:(sites #1 "Home"))) (define "Columns" 8) (game "Lisolo" (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)}) (piece "Seed" Shared) (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)))}) (rules (start (set Count 2 to:(union (sites P1 "Home") (sites P2 "Home")))) phases:{ (phase "Opening" (play (or (forEach Site (sites Mover "Home") (if (is Occupied (site)) (move (from (site)) (to (forEach (sites Mover "Home") if:(!= (to) (site))))))) (move Pass))) (nextPhase (all Passed) "Sowing")) (phase "Sowing" (play (move Select (from (if ("SameTurn") "LastHoleSowed" (sites Mover)) if:(> (count at:(from)) 0)) (then (sow "Track" owner:(mover) apply:(if (> (count at:(to)) 1) (if (not (is In (to) (sites Mover "Inner"))) (moveAgain) (if (and (= 0 (count at:("OppositePit" (to)))) (= 0 (count at:("OppositeOuterPit" (to))))) (moveAgain) (and (if (!= 0 (count at:("OppositePit" (to)))) (remove ("OppositePit" (to)) count:(count at:("OppositePit" (to))))) (if (!= 0 (count at:("OppositeOuterPit" (to)))) (remove ("OppositeOuterPit" (to)) count:(count at:("OppositeOuterPit" (to))))))))))))))} (end (forEach Player if:(= 0 ("PiecesOwnedBy" Player)) (result Player Loss))))) END
What does the following global Ludii definition do? (define "KintsBoard" (board (add (merge { (shift -1.25 -0.34 (rotate 30 (rectangle 6 1))) (rectangle 1 5) (rectangle 5 1) (shift 0 6 (rectangle 5 1)) (shift 0 10 (rectangle 1 5)) (shift 7 0 (rectangle 1 5)) (shift 7 10 (rectangle 1 5)) (shift 11 0 (rectangle 5 1)) (shift 11 6 (rectangle 5 1)) (shift 12.25 5.33 (rotate 30 (rectangle 6 1)))}) edges:{{13 14} {22 28} {37 36} {9 23}}) #1 use:Vertex)) ###
Defines a rectangular board with some arcs used in some native american games such as Kints. END
Modify the Ludii game according to the following option changes: Each row has 12 holes. -> Each row has 14 holes. (define "PiecesOwnedBy" (+ (count Cell at:(handSite #1)) (count in:(sites #1 "Home")))) (define "Columns" 12) (game "Okwe (Nigeria)" (players 2) (equipment { (mancalaBoard 2 "Columns" store:None { (track "Track" "0,E,N,W" loop:True) (track "TrackSpecialHome1" "0,E" loop:True P1) (track "TrackSpecialHome2" "23,W" loop:True P2)}) (regions "OpeningRegion" P1 (sites {17..20})) (regions "OpeningRegion" P2 (sites {5..3})) (piece "Seed" Shared) (hand Each) (map "LeftMost" {(pair P1 0) (pair P2 (- (* ("Columns") 2) 1))}) (regions "Home" P1 (sites Bottom)) (regions "Home" P2 (sites Top))}) (rules (start { (set Count 5 to:((sites {0..2 5 23..21 18}))) (set Count 1 to:((sites {3 4 6 20 19 17})))}) phases: { (phase "Opening" (play (move (from (sites Mover "OpeningRegion") if:(is Occupied (from))) (to (handSite Mover)) count:(count at:(from)))) (nextPhase (all Sites (union (sites P1 "OpeningRegion") (sites P2 "OpeningRegion")) if:(is Empty (site))) "Sowing")) (phase "Sowing" (play (or (move Select (from (sites Mover "Home") if:(is Occupied (from))) (then (sow "Track" apply:(if (and (is In (to) (sites Next "Home")) (or { (= 1 (count at:("OppositePitTwoRows" (to)))) (= 3 (count at:("OppositePitTwoRows" (to)))) (= 5 (count at:("OppositePitTwoRows" (to))))})) (fromTo (from ("OppositePitTwoRows" (to))) (to (handSite Mover)) count:(count at:("OppositePitTwoRows" (to))))) origin:(< 1 (count at:(from)))))) (if (is Occupied Cell (handSite Mover)) (do (set Var "NumToSow" (count Cell at:(handSite Mover))) next:(move (from (handSite Mover)) (to (mapEntry "LeftMost" Mover)) count:(count Cell at:(handSite Mover)) (then (and (sow count:(var "NumToSow") "TrackSpecialHome" owner:(mover) origin:True) (set Var "NumToSow" 0)))))))))} (end (if (all Sites (sites Board) if:(= 0 (count at:(site)))) { (if (is Empty (handSite P1)) (result P2 Win)) (if (is Empty (handSite P2)) (result P1 Win))})))) ###
(define "PiecesOwnedBy" (+ (count Cell at:(handSite #1)) (count in:(sites #1 "Home")))) (define "Columns" 14) (game "Okwe (Nigeria)" (players 2) (equipment { (mancalaBoard 2 "Columns" store:None { (track "Track" "0,E,N,W" loop:True) (track "TrackSpecialHome1" "0,E" loop:True P1) (track "TrackSpecialHome2" "27,W" loop:True P2)}) (regions "OpeningRegion" P1 (sites {20..23})) (regions "OpeningRegion" P2 (sites {6..4})) (piece "Seed" Shared) (hand Each) (map "LeftMost" {(pair P1 0) (pair P2 (- (* ("Columns") 2) 1))}) (regions "Home" P1 (sites Bottom)) (regions "Home" P2 (sites Top))}) (rules (start { (set Count 5 to:((sites {0..3 6 27..24 21}))) (set Count 1 to:((sites {4 5 7 22 23 20})))}) phases: { (phase "Opening" (play (move (from (sites Mover "OpeningRegion") if:(is Occupied (from))) (to (handSite Mover)) count:(count at:(from)))) (nextPhase (all Sites (union (sites P1 "OpeningRegion") (sites P2 "OpeningRegion")) if:(is Empty (site))) "Sowing")) (phase "Sowing" (play (or (move Select (from (sites Mover "Home") if:(is Occupied (from))) (then (sow "Track" apply:(if (and (is In (to) (sites Next "Home")) (or { (= 1 (count at:("OppositePitTwoRows" (to)))) (= 3 (count at:("OppositePitTwoRows" (to)))) (= 5 (count at:("OppositePitTwoRows" (to))))})) (fromTo (from ("OppositePitTwoRows" (to))) (to (handSite Mover)) count:(count at:("OppositePitTwoRows" (to))))) origin:(< 1 (count at:(from)))))) (if (is Occupied Cell (handSite Mover)) (do (set Var "NumToSow" (count Cell at:(handSite Mover))) next:(move (from (handSite Mover)) (to (mapEntry "LeftMost" Mover)) count:(count Cell at:(handSite Mover)) (then (and (sow count:(var "NumToSow") "TrackSpecialHome" owner:(mover) origin:True) (set Var "NumToSow" 0)))))))))} (end (if (all Sites (sites Board) if:(= 0 (count at:(site)))) { (if (is Empty (handSite P1)) (result P2 Win)) (if (is Empty (handSite P2)) (result P1 Win))})))) END
Construct a Ludii game based on the following description 2x6 board. Four counters in each hole. Sowing occurs in an anti-clockwise direction. The first player sows from the hole on their right. When the final counter lands in an occupied hole, the turn ends. When the final counter lands in an empty hole, that counter is captured. The player who captures the most counters wins. The game is played with 6 holes per row. ###
(define "Column" 6) (define "PiecesOwnedBy" (count Cell at:(handSite #1))) (game "Um el-Bil" (players 2) (equipment { (mancalaBoard 2 "Column" 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))) phases:{ (phase "Opening" (play (move Select (from (- ("Column") 1)) (then (sow if:(= (count at:(to)) 1) apply:(fromTo (from (to)) (to (handSite Mover)) count:1))))) (nextPhase "Play")) (phase "Play" (play (move Select (from (sites Mover) if:(< 0 (count at:(from)))) (then (sow if:(= (count at:(to)) 1) apply:(fromTo (from (to)) (to (handSite Mover)) count:1))))))} (end ("MancalaByScoreWhen" (all Sites (sites Board) if:(is Empty (site))))))) END
What does the following global Ludii definition do? (define "NoMovesP2NoPiecesP1" { (if (no Moves P2) (result P1 Win)) (if (no Pieces P1) (result P2 Win))}) ###
Checks if P2 has no moves and P1 wins and checks if P1 has no pieces and P2 wins. This ludemeplex can be used only in an ending condition. END
Construct a Ludii game based on the following description 2x12 board, divided in half. Spaces on each side take the form of points. 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. ###
(define "CanEscape" ("IsOffBoard" #1)) (define "AllPieceEscaped" (no Pieces Mover)) (define "NotEnemyOrOnlyOne" (or (and ("IsEnemyAt" (to)) ("IsSingletonStack" (to))) (and (if (not (is In (to) (sites Mover))) True (is Empty (to))) (not ("IsEnemyAt" (to)))))) (define "Bar" (mapEntry (mover))) (define "RemoveAPiece" (move Remove (site))) (define "NextSiteFromDist6" ("NextSiteOnTrack" 6 from:#1)) (define "NextSiteFrom" ("NextSiteOnTrack" (pips) from:#1)) (game "Ludus Anglicorum" (players 2) (equipment { ("BackgammonBoard" { (track "Track1" {6 0..5 7..12 25..20 18..12} P1 directed:True) (track "Track2" {19 12..18 20..25 12..7 5..0} P2 directed:True)}) (dice num:3) (map {(pair 1 19) (pair 2 6)}) (piece "Disc" Each) (regions P1 { 0..5}) (regions P2 { 13..18})}) (rules (start { (place Stack "Disc1" 0 count:15) (place Stack "Disc2" 13 count:15)}) (play ("RollEachNewTurnMove" (forEach Die if:("DieNotUsed") (forEach Site (sites Occupied by:Mover) (if ("CanEscape" ("NextSiteFrom" (site))) ("RemoveAPiece") (move (from (site)) (to ("NextSiteFrom" (site)) if:("NotEnemyOrOnlyOne") ("HittingCapture" ("Bar")))))) (then ("ReplayNotAllDiceUsed"))))) (end (if ("AllPieceEscaped") (result Mover Win))))) END
Modify the Ludii game according to the following option changes: The game is played on a board with 8 hexes per side. -> The game is played on a board with 9 hexes per side. (define "IsPlayingPhase" (= 1 (var))) (define "LimpCorners" (start { (place "Disc2" { 0 (- (/ (+ (* {3 #1 #1}) #1) 2) 1) (- (* 3 (* #1 #1)) #1)}) (place "Disc2" { #1 (/ (- (* {3 #1 #1}) (* 3 #1)) 2) (- (* 3 (* #1 #1)) 1)})})) (define "Skip" (move Set NextPlayer (player (next)))) (define "HexCorners" (start { (place "Disc2" { 0 (- (/ (- (* {3 #1 #1}) #1) 2) 1) (+ 1 (- (* {3 #1 #1}) (* 4 #1)))}) (place "Disc2" {(- #1 1) (+ 1 (/ (- (* {3 #1 #1}) (* 5 #1)) 2)) (- (* {3 #1 #1}) (* 3 #1))})})) (define "BlackVC" (is Loop)) (define "WhiteVC" (is Full)) (define "NonAdjacent" (not (is Within (id "Disc" P2) in:(sites Around (to))))) (define "Size" 8) (game "Coil" (players 2) (equipment { (board (hex Hexagon 8)) (piece "Disc" Each)}) (rules ("HexCorners" "Size") phases: { (phase "Opening" (play (or (or (move Add (piece (id "Disc" P2)) (to (sites Empty) if:"NonAdjacent") (then (if (< (count MovesThisTurn) 2) (moveAgain)))) "Skip") (if (= (count MovesThisTurn) 0) (move Pass (then (if (is Mover P1) (swap Players P1 P2 (then (note "Player 1 is now Black. Player 2 is now White." to:All))) (note "Player 1 remains White. Player 2 remains Black." to:All) (then (do (set NextPlayer (player 1)) next:(set Var 1))))))))) (nextPhase ("IsPlayingPhase") "Playing")) (phase "Playing" (play (move Add (to (sites Empty)))))} (end (forEach Player if:(and {("IsPlayingPhase") (= (id Player) (mover)) ("BlackVC")}) (result Player Win))))) ###
(define "IsPlayingPhase" (= 1 (var))) (define "LimpCorners" (start { (place "Disc2" { 0 (- (/ (+ (* {3 #1 #1}) #1) 2) 1) (- (* 3 (* #1 #1)) #1)}) (place "Disc2" { #1 (/ (- (* {3 #1 #1}) (* 3 #1)) 2) (- (* 3 (* #1 #1)) 1)})})) (define "Skip" (move Set NextPlayer (player (next)))) (define "HexCorners" (start { (place "Disc2" { 0 (- (/ (- (* {3 #1 #1}) #1) 2) 1) (+ 1 (- (* {3 #1 #1}) (* 4 #1)))}) (place "Disc2" {(- #1 1) (+ 1 (/ (- (* {3 #1 #1}) (* 5 #1)) 2)) (- (* {3 #1 #1}) (* 3 #1))})})) (define "BlackVC" (is Loop)) (define "WhiteVC" (is Full)) (define "NonAdjacent" (not (is Within (id "Disc" P2) in:(sites Around (to))))) (define "Size" 9) (game "Coil" (players 2) (equipment { (board (hex Hexagon 9)) (piece "Disc" Each)}) (rules ("HexCorners" "Size") phases: { (phase "Opening" (play (or (or (move Add (piece (id "Disc" P2)) (to (sites Empty) if:"NonAdjacent") (then (if (< (count MovesThisTurn) 2) (moveAgain)))) "Skip") (if (= (count MovesThisTurn) 0) (move Pass (then (if (is Mover P1) (swap Players P1 P2 (then (note "Player 1 is now Black. Player 2 is now White." to:All))) (note "Player 1 remains White. Player 2 remains Black." to:All) (then (do (set NextPlayer (player 1)) next:(set Var 1))))))))) (nextPhase ("IsPlayingPhase") "Playing")) (phase "Playing" (play (move Add (to (sites Empty)))))} (end (forEach Player if:(and {("IsPlayingPhase") (= (id Player) (mover)) ("BlackVC")}) (result Player Win))))) END
Construct a Ludii game based on the following description Forty stones are arranged in a circle, with a larger gap between every tenth and eleventh stone. The gaps between the stones are the playing spaces. One piece per player. Any number of players. Three sticks used as dice, marked on one side and blank on the other. Throws are as follows: One marked side up = 3, two marked sides up = 2, three marked sides up = 10; all blank sides up = 5. Players enter their pieces from one of the wider gaps in the board, and chooses to move either clockwise or anti-clockwise. When a player's piece lands on a space occupied by the opponent, the opponent's piece is sent back to the space in which they entered. The first player to complete the circuit wins. The game has 2 players. Captures are possible. ###
(define "MadeACompleteCircuit" (if (= 1 (value Player Mover)) (is In (value Piece at:(where "Marker" Mover)) (sites Track "TrackCW" from:("NextSite" (last From) "TrackCW") to:(last To))) (is In (value Piece at:(where "Marker" Mover)) (sites Track "TrackCCW" from:("NextSite" (last From) "TrackCCW") to:(last To))))) (define "MoveOn" (if ("IsNotOffBoard" #1) (if (or (is In #1 (sites Empty)) ("IsEnemyAt" #1)) (move (from (from) level:(level)) (to #1 ("HittingCapture" (value Piece at:(to)))))) #2)) (define "RememberSelectedTrack" (then (if ("IsOffBoard" (value Player Mover)) #1))) (define "SelectCCW" (set Value Mover 2)) (define "SelectCW" (set Value Mover 1)) (define "SiteToMoveOnTrackCCW" ("NextSiteOnTrack" ("ThrowValue") "TrackCCW")) (define "SiteToMoveOnTrackCW" ("NextSiteOnTrack" ("ThrowValue") "TrackCW")) (define "NextSite" ("NextSiteOnTrack" 1 from:#1 #2)) (define "SiteToMoveOnSelectedTrack" (if (= (value Player Mover) 2) ("NextSiteOnTrack" ("ThrowValue") "TrackCCW") ("NextSiteOnTrack" ("ThrowValue") "TrackCW"))) (define "ThrowValue" (mapEntry "ThrowDiceValue" (count Pips))) (game "Patol" (players 2) (equipment { ("FortyStonesWithFourGapsBoard" { (track "TrackCW" {39 35 33 31 29 27 25 23 21 19 38 17 15 13 11 9 7 5 3 1 37 0 2 4 6 8 10 12 14 16 36 18 20 22 24 26 28 30 32 34} loop:True) (track "TrackCCW" {39 34 32 30 28 26 24 22 20 18 36 16 14 12 10 8 6 4 2 0 37 1 3 5 7 9 11 13 15 17 38 19 21 23 25 27 29 31 33 35} loop:True)}) (regions "Gates" (sites {36..39})) (piece "Marker" Each (if ("IsOffBoard" (value Player Mover)) (or ("MoveOn" ("SiteToMoveOnTrackCW") ("RememberSelectedTrack" ("SelectCW"))) ("MoveOn" ("SiteToMoveOnTrackCCW") ("RememberSelectedTrack" ("SelectCCW")))) ("MoveOn" "SiteToMoveOnSelectedTrack"))) ("StickDice" 3) (map "ThrowDiceValue" {(pair 0 5) (pair 1 3) (pair 2 2) (pair 3 10)}) (hand Each)}) (rules (start (place "Marker" "Hand")) phases:{ (phase "Placement" (play (move (from (handSite Mover)) (to (sites "Gates")) (then (set Value at:(last To) (last To))))) (nextPhase Mover "Playing")) (phase "Playing" (play ("RollMove" (forEach Piece))) (end (if ("MadeACompleteCircuit") (result Mover Win))))})) END
Describe the mechanics of the following Ludii game (define "Custodial" (custodial (from (last To)) All (between if:(is Next (who at:(between))) (apply (remove (between)))) (to if:(and (= 3 (count Steps Vertex All (last To) (to))) (is Mover (who at:(to))))) (then (addScore Mover 1)))) (game "Pente" (players 2) (equipment { (board (square 19) use:Vertex) (piece "Ball" Each)}) (rules (start (set Score Each 0)) phases:{ (phase "Opening" (play (move Add (to (sites "J10")))) (nextPhase "General")) (phase "General" (play (move Add (to (sites Empty)) (then "Custodial"))))} (end { (if (is Line 5 All) (result Mover Win)) (if (> (score Mover) 9) (result Mover Win))}))) ###
Pente is played on a 19x19 Go board. White goes first, and plays their first move on the centre point (unless playing Freestyle). In the Pro Pente variation, White's second move must be at least 3 points away from the centre. After the opening, players alternate playing one stone of their colour onto any empty point. If their placement results in a pair of enemy stones being sandwiched between two of their own stones, those enemy stones are captured. The first player to form an orthogonal or diagonal line of five (or more) of their stones, or to capture 10 enemy stones, wins the game. Played on a 19x19 board. Open at the centre point. END
Construct a Ludii game based on the following description Played on an 8x8 board. 16 pieces per player, lined up in the second and third rows (first row on each side is empty). Pieces move forward or horizontally one space, and capture opponents' pieces by jumping in these directions. When they reach the opposite side, they become a king and can jump opponents' pieces from any distance orthogonally. Captures must be taken if possible, and the maximum number of jumps must be made. Multiple captures cannot be made by moving 180 degrees from the previous jump. Pieces can be promoted to king mid-jump. Winning is achieved by capturing all of the other player's pieces or by blocking them so they cannot move. ###
(define "JumpToPromotionZone" (is In (last To) (sites Next))) (define "IsUnpromoted" ("IsPieceAt" "Counter" Mover (last To))) (define "HopMan" ("HopCapture" (from #1) (directions {Forward Rightward Leftward}) #2)) (define "PromotedHopOrthogonalSequenceCapture" ("HopCaptureDistance" #1 #2 ~ (then ("ReplayIfCanMove" ("HopCaptureDistanceNotAlreadyHopped" (from (last To)) (difference Orthogonal OppositeDirection)))))) (game "Dama" (players 2) ("DraughtsEquipment" (square 8)) (rules (start { (place "Counter1" (union (sites Row 1) (sites Row 2))) (place "Counter2" (union (sites Row 5) (sites Row 6)))}) (play (if "SameTurn" (if "IsUnpromoted" (max Moves ("HopMan" (last To) (then ("ReplayIfCanMove" ("HopMan" (last To)) ("PromoteIfReach" (sites Next) "DoubleCounter"))))) (max Moves ("PromotedHopOrthogonalSequenceCapture" (from (last To)) (difference Orthogonal OppositeDirection)))) (priority { (max Moves (or (forEach Piece "Counter" ("HopMan" (from) (then ("ReplayIfCanMove" ("HopMan" (last To)) ("PromoteIfReach" (sites Next) "DoubleCounter"))))) (forEach Piece "DoubleCounter" ("PromotedHopOrthogonalSequenceCapture" (from) Orthogonal)))) (or (forEach Piece "Counter" ("StepToEmpty" (directions {Forward Rightward Leftward})) (then ("PromoteIfReach" (sites Next) "DoubleCounter"))) (forEach Piece "DoubleCounter" (move Slide Orthogonal)))}))) (end ("BlockWin")))) END
Construct a Ludii game based on the following description 12x12 board. 24 pieces per player. Pieces begin on the board in the following arrangement, and with the following movements: Outer row, from left corner: Rukh: moves orthogonally any distance; Ghora: moves orthogonally one space and then diagonally another space, jumping over the first space; Dahja: moves orthogonally any distance; Ratha: moves orthogonally any distance; Fil: moves diagonally any distance; Wazir: moves diagonally or orthogonally any distance; Padshah: moves one space in any direction; Fil, Ratha, Dahja, Ghora, Rukh. In the second row are twelve Paidal: moves one square forward orthogonally or one diagonally to capture. Players alternate turns moving a piece to a space on the board. If one of the opponent's pieces is on the space to which a player moves their piece, the opponent's piece is captured. If the Padshah can be captured on the opponent's next turn, it is in check. The Padshah cannot remain in check at the end of the player's turn. If this is not possible, it is checkmate and the opponent wins. ###
(game "Shatranj (12x12)" (players 2) (equipment { (board (square 12)) ("ChessPawn" "Pawn") ("ChessRook" "Rook") ("ChessRook" "Commoner") ("ChessRook" "Wazir") ("ChessKing" "King_noCross") ("ChessBishop" "Bishop_noCross") ("ChessKnight" "Knight") ("ChessQueen" "Queen")}) (rules (start { (place "Pawn1" (sites Row 1)) (place "Pawn2" (sites Row 10)) (place "Rook1" {"A1" "L1"}) (place "Knight1" {"B1" "K1"}) (place "Commoner1" {"C1" "J1"}) (place "Wazir1" {"D1" "I1"}) (place "Bishop_noCross1" {"E1" "H1"}) (place "Queen1" coord:"F1") (place "King_noCross1" coord:"G1") (place "Rook2" {"A12" "L12"}) (place "Knight2" {"B12" "K12"}) (place "Commoner2" {"C12" "J12"}) (place "Wazir2" {"D12" "I12"}) (place "Bishop_noCross2" {"E12" "H12"}) (place "Queen2" coord:"G12") (place "King_noCross2" coord:"F12")}) (play (do (forEach Piece) ifAfterwards:(not ("IsInCheck" "King_noCross" Mover)))) (end ("Checkmate" "King_noCross")))) END
Construct a Ludii game based on the following description Chess-Breakthrough is played using a regular chess board and pieces and from the standard chess start position. The first player to place a pawn or a knight on the opponent’s backrank wins (thus no promotions). The normal chess rules for piece movements have also been slightly modified to fit our simplified boardgame framework: castling, en-passant, and two-step pawn moves are not allowed; a king can be moved into and left in check (and thus captured); and the draw-by-threefold-repetition and 50-move rules do not apply. ###
(define "LastMoveWasPawn" ("IsPieceAt" "Pawn" Mover (last To))) (define "LastMoveWasKnight" ("IsPieceAt" "Knight" Mover (last To))) (define "ReachedTarget" (is In (last To) (sites Mover))) (game "Breakthrough Chess" ("TwoPlayersNorthSouth") (equipment { (board (square 8)) ("ChessPawn" "Pawn") ("ChessRook" "Rook") ("ChessKing" "King") ("ChessBishop" "Bishop") ("ChessKnight" "Knight") ("ChessQueen" "Queen") (regions P1 (sites Top)) (regions 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 (forEach Piece)) (end (if (and "ReachedTarget" (or "LastMoveWasKnight" "LastMoveWasPawn")) (result Mover Win))))) END
Construct a Ludii game based on the following description 3x6 board. Three counters per hole. Each player owns the row of holes closest to them, as well as the right half of the central row, with respect to their perspective. Sowing occurs from left to right in the player's complete row, right to left in the player's half of the central row, then continuing from right to left in the opponent's outer row, left to right in the opponent's holes in the central row, and then continuing as before into the player's outer row. In the opening phase, players play simultaneously. When the final counter of a sowing falls into an occupied hole, the contents are picked up and sowing continues. Each player plays until their final counter falls into an empty hole; the first player to do so begins the main phase. In the main phase, players alternate turns, and picking up the counters and continuing to sow when the final counter lands in an occupied hole, and stopping when the final counter lands in an empty hole. There are some restrictions with regard to sowing. Each of the player's three leftmost holes cannot be sown from to begin a turn if they contain three counters or less, unless there are no other options for play, in which case sowing must occur from a hole with one counter, and if none are available, then it must begin from a hole with two counters, or three counters if that is the only option. Separately, if the player's other holes only contain two or three counters, the player must play from a hole containing two counters, and these must be the option closest to the opponent's holes. Players must also play from holes containing more than three counters when available. During sowing, a player may not drop a counter into any of the opponent's holes which contain three counters (except when making a nedf, see below), skipping over them and sowing in the next available holes. When the final counter of a sowing lands in a hole in the opponent's row containing three counters, this hole becomes a \ ###
(define "OnlyHolesWithTwoOrThree" (all Sites (intersection (sites Mover "Home") (sites Mover "ThreeLeftMost")) if:(or (= 2 (count at:(site))) (= 3 (count at:(site)))))) (define "NextHole" ("NextSiteOnTrack" #2 from:#1 "Track")) (define "NoNedf" (all Sites (sites Board) if:(!= (mover) (state at:(site))))) (define "Columns" 6) (game "Selus" (players 2) (equipment { (mancalaBoard 3 "Columns" store:None (track "Track" "0,E,N1,W2,17,W,S1,E2" loop:True)) (piece "Seed" Shared) (hand Each) (regions "Home" P1 (union (intersection (sites Row 1) (expand (sites Right) steps:2)) (sites Bottom))) (regions "Home" P2 (union (intersection (sites Row 1) (expand (sites Left) steps:2)) (sites Top))) (regions "ThreeLeftMost" P1 (intersection (sites Bottom) (expand (sites Left) steps:2))) (regions "ThreeLeftMost" P2 (intersection (sites Top) (expand (sites Right) steps:2)))}) (rules (start (set Count 3 to:(sites Board))) (play (priority { (move Select (from (if ("SameTurn") (sites {(var "Replay")}) (sites Mover)) if:(< 3 (count at:(site)))) (then (do (set Var "NumSowed" (count at:(last From))) next:(sow apply:(if (< 1 (count at:(to))) (if (and { (= 0 (state at:(to))) (= 4 (count at:(to))) ("NoNedf") (is In (to) (sites Next))}) (set State at:(to) (mover)) (and (moveAgain) (set Var "Replay" (to))))) skipIf:(and (= 3 (count at:(to))) (is In (to) (sites Next))))))) (if ("OnlyHolesWithTwoOrThree") (move Select (from (if ("SameTurn") (sites {(var "Replay")}) (sites Mover)) if:(= 2 (count at:(site)))) (then (do (set Var "NumSowed" (count at:(last From))) next:(sow apply:(if (< 1 (count at:(to))) (if (and { (= 0 (state at:(to))) (= 4 (count at:(to))) ("NoNedf") (is In (to) (sites Next))}) (set State at:(to) (mover)) (and (moveAgain) (set Var "Replay" (to))))) skipIf:(and (= 3 (count at:(to))) (is In (to) (sites Next)))))))) (move Select (from (if ("SameTurn") (sites {(var "Replay")}) (sites Mover)) if:(and (is Occupied (from)) (if ("SameTurn") True (if (is In (to) (sites Mover "ThreeLeftMost")) (< 3 (count at:(to))) True)))) (then (do (set Var "NumSowed" (count at:(last From))) next:(sow apply:(if (< 1 (count at:(to))) (if (and { (= 0 (state at:(to))) (= 4 (count at:(to))) ("NoNedf") (is In (to) (sites Next))}) (set State at:(to) (mover)) (and (moveAgain) (set Var "Replay" (to))))) skipIf:(and (= 3 (count at:(to))) (is In (to) (sites Next))))))) (move Select (from (if ("SameTurn") (sites {(var "Replay")}) (sites Mover "ThreeLeftMost")) if:(and (= 1 (count at:(from))) (is Occupied (from)))) (then (do (set Var "NumSowed" (count at:(last From))) next:(sow apply:(if (< 1 (count at:(to))) (if (and { (= 0 (state at:(to))) (= 4 (count at:(to))) ("NoNedf") (is In (to) (sites Next))}) (set State at:(to) (mover)) (and (moveAgain) (set Var "Replay" (to))))) skipIf:(and (= 3 (count at:(to))) (is In (to) (sites Next))))))) (move Select (from (if ("SameTurn") (sites {(var "Replay")}) (sites Mover "ThreeLeftMost")) if:(and (= 2 (count at:(from))) (is Occupied (from)))) (then (do (set Var "NumSowed" (count at:(last From))) next:(sow apply:(if (< 1 (count at:(to))) (if (and { (= 0 (state at:(to))) (= 4 (count at:(to))) ("NoNedf") (is In (to) (sites Next))}) (set State at:(to) (mover)) (and (moveAgain) (set Var "Replay" (to))))) skipIf:(and (= 3 (count at:(to))) (is In (to) (sites Next))))))) (move Select (from (if ("SameTurn") (sites {(var "Replay")}) (sites Mover "ThreeLeftMost")) if:(and (= 3 (count at:(from))) (is Occupied (from)))) (then (do (set Var "NumSowed" (count at:(last From))) next:(sow apply:(if (< 1 (count at:(to))) (if (and { (= 0 (state at:(to))) (= 4 (count at:(to))) ("NoNedf") (is In (to) (sites Next))}) (set State at:(to) (mover)) (and (moveAgain) (set Var "Replay" (to))))) skipIf:(and (= 3 (count at:(to))) (is In (to) (sites Next)))))))})) (end ("BlockWin")))) END
Construct a Ludii game based on the following description 2x6 board, with stores on either end. The store to a player's left belongs to them. Four counters in each hole. Players sow in an anti-clockwise direction from any hole in their row. When the final counter lands in a hole in the opponent's row, causing it to contain two or four counters, these are captured and put in the store. The player also captures the contents of any adjacent holes in the opponent's row if they also contain two or four counters. Play continues until one player has no counters in their row, their opponent capturing the remaining counters. A new round begins. Players fill up their holes with four counters, beginning from the left. Any excess counters are placed in that player's store; the final hole of the player with fewer counters may contain fewer than four counters. Any empty holes are out of play. Play continues as before. The game repeats in this fashion until one player has no counters remaining, their opponent is the winner. ###
(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 "NoPieceOnBoard" (all Sites (union (sites Top) (sites Bottom)) if:(= 0 (count at:(site))))) (define "EastHoleExist" (!= (to) ("EastHole"))) (define "EastHole" (ahead (to) E)) (define "WestHoleExist" (!= (to) ("WestHole"))) (define "WestHole" (ahead (to) W)) (define "PlayableSites" (sites (values Remembered "Playable"))) (define "PiecesOwnedBy" (+ (count at:(mapEntry #1)) (count in:(sites #1)))) (game "Erherhe" (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)}) (map "LeftMost" {(pair P1 1) (pair P2 12)}) (piece "Seed" Shared)}) (rules (start { (set Count 4 to:(sites Track)) (set RememberValue "Playable" (union (sites Top) (sites Bottom)))}) phases:{ (phase "Sowing" (play (or { (move Select (from (sites Mover) if:(and (is Occupied (from)) (is In (from) ("PlayableSites")))) (then (sow apply:(if (and (is In (to) (sites Next)) (or (= 2 (count at:(to))) (= 4 (count at:(to))))) (and { (fromTo (from (to)) (to (mapEntry Mover)) count:(count at:(to))) (if ("WestHoleExist") (if (or (= 2 (count at:("WestHole"))) (= 4 (count at:("WestHole")))) (fromTo (from ("WestHole")) (to (mapEntry Mover)) count:(count at:("WestHole"))))) (if ("EastHoleExist") (if (or (= 2 (count at:("EastHole"))) (= 4 (count at:("EastHole")))) (fromTo (from ("EastHole")) (to (mapEntry Mover)) count:(count at:("EastHole")))))})) skipIf:(not (is In (to) ("PlayableSites"))))))} (then (if ("OneRowIsEmpty") (and { (forEach Site (sites P1) (fromTo (from (site)) (to (mapEntry P1)) count:(count at:(site)))) (forEach Site (sites P2) (fromTo (from (site)) (to (mapEntry P2)) count:(count at:(site)))) (forget Value "Playable" All)}))))) (end (if ("NoPieceOnBoard") { (if (= 0 (count at:(mapEntry P1))) (result P2 Win)) (if (= 0 (count at:(mapEntry P2))) (result P1 Win))})) (nextPhase ("NoPieceOnBoard") "BetweenRounds")) (phase "BetweenRounds" (play (if (not (all Sites (sites Mover) if:(is Occupied (site)))) (if (<= 4 (count at:(mapEntry Mover))) (move (from (mapEntry Mover)) (to "LeftMostEmpty") count:4 (then (remember Value "Playable" (last To)))) (move (from (mapEntry Mover)) (to "LeftMostEmpty") count:(count at:(mapEntry Mover)) (then (remember Value "Playable" (last To))))))) (nextPhase (all Passed) "Sowing"))})) END
Modify the Ludii game according to the following option changes: 5 Square -> 7 Square (define "SquareGraphics" (graphics { (board Style Go) (piece Background image:"square.svg" edgeColour:(colour 100 100 100 255)) (piece Foreground image:"cross.svg" edgeColour:(colour 100 100 100 255)) (piece Colour strokeColour:(colour 100 100 100 255)) (piece Scale .26) (show Piece Value CornerLeft valueOutline:True scale:1.5)})) (define "HexGraphics" (graphics { (board Colour OuterEdges (colour Black)) (board Colour InnerEdges (colour Black)) (board StyleThickness OuterEdges 1.5) (board StyleThickness InnerEdges 0.4) (board StyleThickness InnerVertices 0.4) (board StyleThickness OuterVertices 0.4) (board Colour Symbols (colour Black)) (player Colour P1 (colour Black)) (player Colour P2 (colour LightOrange)) (region Colour (sites Occupied by:P1) (colour 60 120 170 120)) (region Colour (sites Occupied by:P2) (colour 195 195 200 120)) (show Piece Value Middle valueOutline:False scale:.8)})) (define "SetNewGroupValue" (forEach Site (sites Group at:(last To) All) (set Value at:(site) (count Sites in:(sites Group at:(last To) All))))) (define "ToToSites" (to (difference (sites Empty) (forEach of:(sites Occupied by:Mover) (if (>= (value Piece at:(site)) (score Mover)) (sites Around (site) All)))))) (game "Ecosys" (players 2) (equipment { ((board (square Square 5) use:Vertex)) (piece "Disc" Each)}) (rules (start (set Score Each 0)) (play (move Add ("ToToSites") (then (and ("SetNewGroupValue") (set Score Mover (size Array (sizes Group All Mover))))))) (end ("NoMoves" Loss)))) ###
(define "SquareGraphics" (graphics { (board Style Go) (piece Background image:"square.svg" edgeColour:(colour 100 100 100 255)) (piece Foreground image:"cross.svg" edgeColour:(colour 100 100 100 255)) (piece Colour strokeColour:(colour 100 100 100 255)) (piece Scale .26) (show Piece Value CornerLeft valueOutline:True scale:1.5)})) (define "HexGraphics" (graphics { (board Colour OuterEdges (colour Black)) (board Colour InnerEdges (colour Black)) (board StyleThickness OuterEdges 1.5) (board StyleThickness InnerEdges 0.4) (board StyleThickness InnerVertices 0.4) (board StyleThickness OuterVertices 0.4) (board Colour Symbols (colour Black)) (player Colour P1 (colour Black)) (player Colour P2 (colour LightOrange)) (region Colour (sites Occupied by:P1) (colour 60 120 170 120)) (region Colour (sites Occupied by:P2) (colour 195 195 200 120)) (show Piece Value Middle valueOutline:False scale:.8)})) (define "SetNewGroupValue" (forEach Site (sites Group at:(last To) All) (set Value at:(site) (count Sites in:(sites Group at:(last To) All))))) (define "ToToSites" (to (difference (sites Empty) (forEach of:(sites Occupied by:Mover) (if (>= (value Piece at:(site)) (score Mover)) (sites Around (site) All)))))) (game "Ecosys" (players 2) (equipment { ((board (square Square 7) use:Vertex)) (piece "Disc" Each)}) (rules (start (set Score Each 0)) (play (move Add ("ToToSites") (then (and ("SetNewGroupValue") (set Score Mover (size Array (sizes Group All Mover))))))) (end ("NoMoves" Loss)))) END
Construct a global Ludii definition which fulfills the following requirements. Checks if a site returned by a track is off board. ###
(define "IsOffBoard" (= #1 Off)) END