prompt
stringlengths 71
4.65k
| completion
stringlengths 34
5.1k
|
---|---|
Construct a global Ludii definition which fulfills the following requirements.
Checks if a player has no piece and lose. This ludemeplex can be used only in an ending condition.
###
| (define "CaptureAll" (if (no Pieces #1) (result #1 Loss))) END |
Construct a Ludii game based on the following description
Essentially, the game consists of a number of objects in \ The last mover loses. The game involves 5 piles.
###
| (game "Nim" (players 2) (equipment { (board (rectangle 1 5)) (piece "Marker" Neutral)}) (rules (start { (set Count 3 to:(sites {0 4})) (set Count 4 to:(sites {1 3})) (set Count 5 at:2)}) (play (if "SameTurn" (or (move Select (from (last To)) (then (if (= (count at:(last To)) 1) (remove (last To)) (and (set Count at:(last To) (- (count at:(last To)) 1)) (moveAgain))))) (move Pass)) (move Select (from (sites Occupied by:Neutral)) (then (if (= (count at:(last To)) 1) (remove (last To)) (and (set Count at:(last To) (- (count at:(last To)) 1)) (moveAgain))))))) (end (if (no Moves Next) (result Next Win))))) END |
Construct a Ludii game based on the following description
Played on an 8x8 board with each player having twelve pieces. Pieces move diagonally one space forward, and can capture opponent's pieces by jumping them in a forward direction if they are adjacent. Capturing must happen if it is possible. Multiple captures are allowed. Once pieces reach the opposite side of the board from their starting position, they become kings and can move diagonally either forwards or backwards. The goal is to capture all of the opponent's pieces.
###
| (define "IsUnpromoted" ("IsPieceAt" "Counter" Mover (last To))) (game "English Draughts" ("TwoPlayersNorthSouth") ("DraughtsEquipment" (square 8)) (rules ("BlackCellsSetup" 3) (play (if "SameTurn" (if "IsUnpromoted" ("HopCapture" (from (last To)) (directions {FR FL}) (then ("PromoteIfReach" (sites Next) "DoubleCounter" ("ReplayIfCanMove" ("HopCapture" (from (last To)) (directions {FR FL})))))) ("HopDiagonalSequenceCaptureAgain")) (priority { (or (forEach Piece "Counter" ("HopCapture" (from) (directions {FR FL}) (then ("PromoteIfReach" (sites Next) "DoubleCounter" ("ReplayIfCanMove" ("HopCapture" (from (last To)) (directions {FR FL}))))))) (forEach Piece "DoubleCounter" ("HopDiagonalSequenceCapture"))) (or (forEach Piece "Counter" ("StepToEmpty" (directions {FR FL})) (then ("PromoteIfReach" (sites Next) "DoubleCounter"))) (forEach Piece "DoubleCounter" "StepDiagonalToEmpty"))}))) (end ("BlockWin")))) END |
Construct a Ludii game based on the following description
For setup, players may drop their initial two workers anywhere on the board. Then players take turns moving either a worker or a soldier. Soldiers move in straight lines and capture by replacement. Workers produce new things based on the piece opposite them (worker+worker = base, worker+base = worker or soldier). The first player to be left with no moves loses.
###
| (define "Produce" (and (custodial (from (last To)) (between (max 1) if:(is Empty (between)) (apply (set State at:(between) "ProduceBase"))) (to if:("IsFriendlyWorkerAt" (to)))) (custodial (from (last To)) (between (max 1) if:(is Empty (between)) (apply (set State at:(between) "ProduceWorkerOrSoldier"))) (to if:("IsFriendlyBaseAt" (to)))))) (define "IsFriendlyBaseAt" (and (is Friend (who at:#1 #2)) ("IsPieceAt" "Base" Mover #1))) (define "IsFriendlyWorkerAt" (and (is Friend (who at:#1 #2)) ("IsPieceAt" "Soldier" Mover #1))) (define "ClearProduction" (forEach Site (sites Empty) (set State at:(to) 0))) (define "ProductionSites" (> (+ (count Sites in:(sites State "ProduceWorkerOrSoldier")) (count Sites in:(sites State "ProduceBase"))) 0)) (define "ProduceBase" 2) (define "ProduceWorkerOrSoldier" 1) (game "Workers and Soldiers" (players {(player N) (player S)}) (equipment { (board (hex Limping 5 4)) (piece "Soldier" Each (move Slide (then "Produce"))) (piece "Shooter" Each (move Slide (to if:(is Enemy (who at:(to))) (apply (remove (to)))))) (piece "Base" Each) (hand Each size:2)}) (rules (start { (place "Soldier" "Hand" count:2)}) phases:{ (phase "Movement2" (play (or (forEach Piece) (move (from (sites Occupied by:Mover container:"Hand")) (to (sites Empty)) (then "Produce")) (then (if ("ProductionSites") (moveAgain))))) { (nextPhase ("ProductionSites") "Produce2") (nextPhase (not ("ProductionSites")) "Movement1")}) (phase "Produce2" (play (or { (move Add (piece (id "Soldier" Mover)) (to (sites Empty) if:(= (state at:(to)) "ProduceWorkerOrSoldier")) ((then (set State at:(last To) 0)))) (move Add (piece (id "Shooter" Mover)) (to (sites Empty) if:(= (state at:(to)) "ProduceWorkerOrSoldier")) ((then (set State at:(last To) 0)))) (move Add (piece (id "Base" Mover)) (to (sites Empty) if:(= (state at:(to)) "ProduceBase")) ((then (set State at:(last To) 0)))) (move Pass (then "ClearProduction"))} (then (if ("ProductionSites") (moveAgain))))) { (nextPhase (not ("ProductionSites")) "Movement1")}) (phase "Movement1" (play (or (forEach Piece) (move (from (sites Occupied by:Mover container:"Hand")) (to (sites Empty)) (then "Produce")) (then (moveAgain)))) { (nextPhase ("ProductionSites") "Produce1") (nextPhase (not ("ProductionSites")) "Movement2")}) (phase "Produce1" (play (or { (move Add (piece (id "Soldier" Mover)) (to (sites Empty) if:(= (state at:(to)) "ProduceWorkerOrSoldier")) ((then (set State at:(last To) 0)))) (move Add (piece (id "Shooter" Mover)) (to (sites Empty) if:(= (state at:(to)) "ProduceWorkerOrSoldier")) ((then (set State at:(last To) 0)))) (move Add (piece (id "Base" Mover)) (to (sites Empty) if:(= (state at:(to)) "ProduceBase")) ((then (set State at:(last To) 0)))) (move Pass (then "ClearProduction"))} (then (moveAgain)))) { (nextPhase (not ("ProductionSites")) "Movement2")})} (end { (if (no Moves P1) (result P2 Win)) (if (no Moves P2) (result P1 Win))}))) END |
Construct a Ludii game based on the following description
8x12 board. Each player begins with a complement of pieces, each with their own powers of movement as follows: King (x1): may move one space in any direction; Queen (x1): moves one space diagonally, may leap two spaces diagonally on its first move over any intervening pieces; Man (x1): moves one space in any direction; Fool (x1): moves orthogonally one space; Courier (x2): moves diagonally any distance; Bishop (x2): moves diagonally two spaces, jumping over any intervening pieces; Knight (x2): moves orthogonally one space and then diagonally another space, jumping over any intervening pieces; Rook (x2): moves orthogonally any distance; Pawns (x12): move forward one space or diagonally forward one space to capture. Only the Rooks' and Queens' pawns may move forward two spaces for their first move. Each player must move the Rooks' Pawns and Queens' Pawn in this way in their first three moves. A piece is captured when an opponent's piece moves onto its space. The King is in check when it can be taken on the opponent's next turn; it must not remain in check at the end of the player's turn. When the king cannot move out of check, it is checkmated and the opponent wins.
###
| (game "Currierspiel" ("TwoPlayersNorthSouth") (equipment { (board (rectangle 8 12)) (regions "StartingPawnRookQueen" P1 (sites {"A2" "G2" "L2"})) (regions "StartingPawnRookQueen" P2 (sites {"A7" "G7" "L7"})) ("ChessKing" "King") (piece "Queen" Each (or ("StepToNotFriend" Diagonal) (if (= 1 (state at:(from))) (move Hop (between if:True) (to if:(not ("IsFriendAt" (to))) (apply (remove (to))))) (then (set State at:(last To) 0))))) ("ChessKing" "Mann") (piece "Fool" Each ("StepToNotFriend" Orthogonal)) ("ChessBishop" "Ferz") (piece "Bishop" Each (move Hop (between if:True) (to if:(not ("IsFriendAt" (to))) (apply (remove (to)))))) ("ChessKnight" "Knight") ("ChessRook" "Rook") ("ChessPawn" "Pawn")}) (rules (start { (place "Pawn1" (sites Row 1)) (place "Pawn2" (sites Row 6)) (place "Rook1" {"A1" "L1"}) (place "Knight1" {"B1" "K1"}) (place "Ferz1" {"C1" "J1"}) (place "Bishop1" {"D1" "I1"}) (place "Queen1" coord:"G1" state:1) (place "Fool1" coord:"H1") (place "Mann1" coord:"E1") (place "King1" coord:"F1") (place "Rook2" {"A8" "L8"}) (place "Knight2" {"B8" "K8"}) (place "Ferz2" {"C8" "J8"}) (place "Bishop2" {"D8" "I8"}) (place "Queen2" coord:"G8" state:1) (place "Fool2" coord:"H8") (place "Mann2" coord:"E8") (place "King2" coord:"F8")}) phases: { (phase "Opening" (play (forEach Site (intersection (sites Occupied by:Mover) (sites Mover)) (move (from (site)) (to (ahead (site) steps:2 Forward))))) (nextPhase Mover (= 0 (count Sites in:(intersection (sites Occupied by:Mover) (sites Mover)))) "Playing")) (phase "Playing" (play (do (forEach Piece) ifAfterwards:(not ("IsInCheck" "King" Mover)))))} (end ("Checkmate" "King")))) END |
Construct a Ludii game based on the following description
9x9 intersecting lines, with diagonals drawn in every 4x4 square formed. Forty pieces per player, placed on the board with the central space unoccupied. Players alternate turns moving one piece to an empty adjacent spot. They may capture an opponent's piece by hopping over it. Multiple hops in one turn are allowed, but not required. The first person to capture all of the opponent's pieces wins.
###
| (game "Meurimueng-rimueng Peuet Ploh" (players 2) (equipment { ("AlquerqueBoard" 9 9) (piece "Marker" Each (or ("HopSequenceCapture") ("StepToEmpty")))}) (rules ("BeforeAfterCentreSetup" "Marker1" "Marker2") (play (if "SameTurn" (or ("HopSequenceCaptureAgain") (move Pass)) (forEach Piece))) (end ("ForEachPlayerNoPiecesLoss")))) END |
Construct a Ludii game based on the following description
4x3 grid with a 3x 2 grid connected by a \ The pieces follow the track described by Finkel. The rosettes are protecting the pieces and allow them to replay.
###
| (define "RemoveAPiece" (move Remove (from))) (define "SiteToMoveOnTrack" ("NextSiteOnTrack" (count Pips))) (game "Royal Game of Ur" (players 2) (equipment { (board (hole (hole (rectangle 3 8) (poly { {4 0} {4 1} {6 1} {6 0}})) (poly { {4 2} {4 3} {6 3} {6 2}})) {(track "Track1" "20,3,W,N1,E,S1,W,End" P1 directed:True) (track "Track2" "21,17,W,S1,E,N1,W,End" P2 directed:True)}) ("StickDice" 4) (hand Each) (regions "Replay" (sites {"A1" "A3" "D2" "G1" "G3"})) (piece "UrPiece" Each (if ("IsEndTrack" "SiteToMoveOnTrack") "RemoveAPiece" (if ("IsNotOffBoard" "SiteToMoveOnTrack") (if (or (is Empty "SiteToMoveOnTrack") (and (not ("IsFriendAt" "SiteToMoveOnTrack")) (not (is In "SiteToMoveOnTrack" (sites "Replay"))))) (move (from) (to "SiteToMoveOnTrack" ("HittingCapture" (handSite Next))) (then ("ReplayInMovingOn" (sites "Replay"))))))))}) (rules (start { (place "UrPiece1" (handSite P1) count:7) (place "UrPiece2" (handSite P2) count:7)}) (play ("RollMove" (if (!= (count Pips) 0) (or (forEach Piece) (forEach Piece container:(mover)))))) (end ("EscapeWin")))) END |
Modify the Ludii game according to the following option changes:
1 extra capture. -> 2 extra captures.
12 Holes per row. -> 15 Holes per row.
(define "HaveToMakeExtraCapture" (set Var 1)) (define "NumCapture" (var)) (define "NextHoleFrom" ("NextSiteOnTrack" 1 from:#1 #2)) (define "AHoleHasMoreThanOneCounter" (not (all Sites (forEach (sites Mover) if:(< 1 (count at:(site)))) if:(= 0 (count at:(site)))))) (define "NoPiece" (all Sites (sites Player "Home") if:(= 0 (count at:(site))))) (define "Columns" 12) (game "Tsoro (Additional Capture)" (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 (< 0 ("NumCapture")) (move Remove (forEach (sites Next) if:(< 0 (count at:(site)))) (then (and (if (< 1 ("NumCapture")) (moveAgain)) (set Var (- ("NumCapture") 1))))) (move Select (from (if ("SameTurn") "LastHoleSowed" (sites Mover "Home")) if:(if "AHoleHasMoreThanOneCounter" (> (count at:(from)) 1) (and (= (count at:(from)) 1) (= 0 (count at:("NextHoleFrom" (from) Mover)))))) (then (sow "Track" owner:(mover) apply:(if (= (count at:(to)) 1) (if (is In (to) (sites Mover "Inner")) (if (> (count at:("OppositePit" (to))) 0) (and { (remove ("OppositePit" (to))) (if (> (count at:("OppositeOuterPit" (to))) 0) (remove ("OppositeOuterPit" (to)))) (moveAgain) ("HaveToMakeExtraCapture")}))) (moveAgain))))))) (end (forEach NonMover if:("NoPiece") (result Player Loss)))))
###
| (define "HaveToMakeExtraCapture" (set Var 2)) (define "NumCapture" (var)) (define "NextHoleFrom" ("NextSiteOnTrack" 1 from:#1 #2)) (define "AHoleHasMoreThanOneCounter" (not (all Sites (forEach (sites Mover) if:(< 1 (count at:(site)))) if:(= 0 (count at:(site)))))) (define "NoPiece" (all Sites (sites Player "Home") if:(= 0 (count at:(site))))) (define "Columns" 15) (game "Tsoro (Additional Capture)" (players 2) (equipment { (mancalaBoard 4 "Columns" store:None { (track "Track1" "0,E,N1,W" loop:True P1) (track "Track2" "30,E,N1,W" loop:True P2)}) (regions "Home" P1 (sites Track "Track1")) (regions "Home" P2 (sites Track "Track2")) (regions "Inner" P1 (difference (sites Track "Track1") (sites Bottom))) (regions "Inner" P2 (difference (sites Track "Track2") (sites Top))) (piece "Seed" Shared)}) (rules (start (set Count 2 to:(union (sites Top) (sites Bottom)))) (play (if (< 0 ("NumCapture")) (move Remove (forEach (sites Next) if:(< 0 (count at:(site)))) (then (and (if (< 1 ("NumCapture")) (moveAgain)) (set Var (- ("NumCapture") 1))))) (move Select (from (if ("SameTurn") "LastHoleSowed" (sites Mover "Home")) if:(if "AHoleHasMoreThanOneCounter" (> (count at:(from)) 1) (and (= (count at:(from)) 1) (= 0 (count at:("NextHoleFrom" (from) Mover)))))) (then (sow "Track" owner:(mover) apply:(if (= (count at:(to)) 1) (if (is In (to) (sites Mover "Inner")) (if (> (count at:("OppositePit" (to))) 0) (and { (remove ("OppositePit" (to))) (if (> (count at:("OppositeOuterPit" (to))) 0) (remove ("OppositeOuterPit" (to)))) (moveAgain) ("HaveToMakeExtraCapture")}))) (moveAgain))))))) (end (forEach NonMover if:("NoPiece") (result Player Loss))))) END |
Construct a Ludii game based on the following description
8x8 board, twelve pieces per player, arranged on the black spaces. Pieces move diagonally one space, or may hop an opponent's piece to capture it. Pieces may also capture orthogonally, but must remain on the black spaces. When a piece reaches the opponent's edge of the board, the piece becomes a \
###
| (game "Makvoer" (players 2) (equipment { (board (square 8)) (piece "Counter" Each (or { "StepDiagonalToEmpty" "HopDiagonalCapture" (do (move Hop Orthogonal (between before:1 after:2 if:("IsEnemyAt" (between)) (apply (remove (between)))) (to if:(is Empty (to)))) ifAfterwards:(is In (last To) (sites Phase 0)))} (then ("PromoteIfReach" (sites Next) "DoubleCounter")))) (piece "DoubleCounter" Each (or (move Slide) ("HopCaptureDistance"))) (regions P1 (sites Bottom)) (regions P2 (sites Top))}) (rules ("BlackCellsSetup" 3) (play (forEach Piece)) (end ("CaptureAll" Next)))) END |
Modify the Ludii game according to the following option changes:
Each player has 8 holes on each row. -> Each player has 10 holes on each row.
(define "PiecesOwnedBy" (count in:(sites #1 "Home"))) (define "Columns" 8) (game "Tshuba" (players 2) (equipment { (mancalaBoard 4 "Columns" store:None { (track "Track1" "0,E,N1,W" loop:True P1) (track "Track2" "16,E,N1,W" loop:True P2)}) (regions "Home" P1 (sites Track "Track1")) (regions "Home" P2 (sites Track "Track2")) (regions "Inner" P1 (difference (sites Track "Track1") (sites Bottom))) (regions "Inner" P2 (difference (sites Track "Track2") (sites Top))) (piece "Seed" Shared) (hand Each)}) (rules (start (set Count 2 to:(union (sites P1 "Home") (sites P2 "Home")))) (play (if (= 1 (var "ExtraCapture")) (move Remove (difference (sites Next "Home") (sites Empty)) count:(count at:(to)) (then (set Var "ExtraCapture" 0))) (move Select (from (if ("SameTurn") "LastHoleSowed" (sites Mover)) if:(< 0 (count at:(from)))) (then (sow "Track" owner:(mover) apply:(if (< 1 (count at:(to))) (moveAgain) (if (is In (to) (sites Mover "Inner")) (and { (if (> (count at:("OppositePit" (to))) 0) (remove ("OppositePit" (to)) count:(count at:("OppositePit" (to))))) (if (> (count at:("OppositeOuterPit" (to))) 0) (remove ("OppositeOuterPit" (to)) count:(count at:("OppositeOuterPit" (to))))) (set Var "ExtraCapture" 1) (moveAgain)})))))))) (end (if (all Sites (sites Next "Home") if:(= 0 (count at:(site)))) (result Mover Win)))))
###
| (define "PiecesOwnedBy" (count in:(sites #1 "Home"))) (define "Columns" 10) (game "Tshuba" (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) (hand Each)}) (rules (start (set Count 2 to:(union (sites P1 "Home") (sites P2 "Home")))) (play (if (= 1 (var "ExtraCapture")) (move Remove (difference (sites Next "Home") (sites Empty)) count:(count at:(to)) (then (set Var "ExtraCapture" 0))) (move Select (from (if ("SameTurn") "LastHoleSowed" (sites Mover)) if:(< 0 (count at:(from)))) (then (sow "Track" owner:(mover) apply:(if (< 1 (count at:(to))) (moveAgain) (if (is In (to) (sites Mover "Inner")) (and { (if (> (count at:("OppositePit" (to))) 0) (remove ("OppositePit" (to)) count:(count at:("OppositePit" (to))))) (if (> (count at:("OppositeOuterPit" (to))) 0) (remove ("OppositeOuterPit" (to)) count:(count at:("OppositeOuterPit" (to))))) (set Var "ExtraCapture" 1) (moveAgain)})))))))) (end (if (all Sites (sites Next "Home") if:(= 0 (count at:(site)))) (result Mover Win))))) END |
Modify the Ludii game according to the following option changes:
Each player has 7 holes. -> Each player has 8 holes.
(define "PiecesOwnedBy" (+ (count Cell at:(handSite #1)) (count in:(sites #1)))) (define "PlayFrom" (play (move Select (from (if ("SameTurn") "LastHoleSowed" (sites Mover #1)) if:(> (count at:(from)) 0)) (then (sow "Track" owner:(mover) apply:(if (= (count at:(to)) 1) (if (is In (to) (sites Mover "Inner")) (if (> (count at:("OppositePit" (to))) 0) (and (fromTo (from ("OppositePit" (to))) (to (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)))))))) (moveAgain))))))) (define "Columns" 7) (game "Muvalavala (Luena)" (players 2) (equipment { (mancalaBoard 4 "Columns" store:None { (track "Track1" "6,W,N1,E" loop:True P1) (track "Track2" "20,W,N1,E" loop:True P2)}) (regions "Home" P1 (sites Track "Track1")) (regions "Home" P2 (sites Track "Track2")) (regions "Inner" P1 (difference (sites Track "Track1") (sites Bottom))) (regions "Inner" P2 (difference (sites Track "Track2") (sites Top))) (piece "Seed" Shared) (hand Each)}) (rules (start (set Count 2 to:(union (sites P1 "Home") (sites P2 "Home")))) phases:{ (phase "Opening" ("PlayFrom" "Inner") (nextPhase (>= (count Turns) 2) "Playing")) (phase "Playing" ("PlayFrom" "Home"))} (end ("MancalaByScoreWhen" (no Moves Mover)))))
###
| (define "PiecesOwnedBy" (+ (count Cell at:(handSite #1)) (count in:(sites #1)))) (define "PlayFrom" (play (move Select (from (if ("SameTurn") "LastHoleSowed" (sites Mover #1)) if:(> (count at:(from)) 0)) (then (sow "Track" owner:(mover) apply:(if (= (count at:(to)) 1) (if (is In (to) (sites Mover "Inner")) (if (> (count at:("OppositePit" (to))) 0) (and (fromTo (from ("OppositePit" (to))) (to (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)))))))) (moveAgain))))))) (define "Columns" 8) (game "Muvalavala (Luena)" (players 2) (equipment { (mancalaBoard 4 "Columns" store:None { (track "Track1" "7,W,N1,E" loop:True P1) (track "Track2" "23,W,N1,E" loop:True P2)}) (regions "Home" P1 (sites Track "Track1")) (regions "Home" P2 (sites Track "Track2")) (regions "Inner" P1 (difference (sites Track "Track1") (sites Bottom))) (regions "Inner" P2 (difference (sites Track "Track2") (sites Top))) (piece "Seed" Shared) (hand Each)}) (rules (start (set Count 2 to:(union (sites P1 "Home") (sites P2 "Home")))) phases:{ (phase "Opening" ("PlayFrom" "Inner") (nextPhase (>= (count Turns) 2) "Playing")) (phase "Playing" ("PlayFrom" "Home"))} (end ("MancalaByScoreWhen" (no Moves Mover))))) END |
Construct a global Ludii definition which fulfills the following requirements.
Defines a piece moving like a rook in Chess.
###
| (define "ChessRook" (piece #1 Each (move Slide Orthogonal (to if:("IsEnemyAt" (to)) (apply (remove (to) #2))) #3))) END |
Construct a global Ludii definition which fulfills the following requirements.
Defines a rectangular board with Alquerque-style alternating diagonals with four triangle extensions on each side.
###
| (define "AlquerqueBoardWithFourTriangles" (board ("AlquerqueGraphWithFourTriangles") use:Vertex)) END |
Modify the Ludii game according to the following option changes:
The fox can capture many pieces in a sequence. -> The fox can capture orthogonally one single piece.
(define "BottomEmptySites" (intersection (sites Empty) (sites Bottom))) (define "HenAdded" (set Value Prev (- (value Player Prev) 1))) (define "DidNotCaptured" (> (value Player Prev) 0)) (define "HasNotCaptured" (if (< (value Player Mover) 0) (set Value Mover 1) (set Value Mover (+ 1 (value Player Mover))))) (define "HopCustomSequenceCapture" (move Hop #1 #2 (between if:("IsEnemyAt" (between)) (apply (remove (between) #3))) (to if:(is Empty (to))) (then (if (can Move (hop (from (last To)) #2 (between if:(and (not (is In (between) (sites ToClear))) ("IsEnemyAt" (between))) (apply (remove (between) #3))) (to if:(is Empty (to))))) (moveAgain))))) (define "ShouldCapturedButMoved" (and (is Pending) (not (is In (last To) ("SitesWithPossibleCaptureInPreviousTurn"))))) (define "SitesWithPossibleCaptureInPreviousTurn" (sites Pending)) (define "RememberSiteWithPossibleMultiCapture" (set Pending (sites To (if ("SameTurn") #1 (forEach Piece "Fox" #2))))) (define "RememberSiteWithPossibleCapture" (set Pending (sites To (forEach Piece "Fox" #1)))) (game "Renard et les Poules" (players 2) (equipment { ("CrossBoard" 3 7 use:Vertex diagonals:Alternating) (hand P1) (piece "Fox" P1 S (or ("HopSequenceCapture") ("StepToEmpty"))) (piece "Hen" P2 N ("StepToEmpty" (directions {Forwards Rightward Leftward})))}) (rules (start { (place "Fox1" (centrePoint)) (place "Hen2" (union {(expand (sites Bottom)) (sites Row 2) (sites {"A4" "G4" "A5" "G5"})}))}) phases:{ (phase "FoxPhase" P1 (play (do ("RememberSiteWithPossibleMultiCapture" ("HopSequenceCaptureAgain") ("HopSequenceCapture")) next: (if ("SameTurn") (or ("HopSequenceCaptureAgain") (move Pass)) (forEach Piece) (then (if ("ShouldCapturedButMoved") ("HasNotCaptured"))))))) (phase "HenPhase" P2 (play (if (and ("DidNotCaptured") (!= 0 (count Sites in:("BottomEmptySites")))) (move Add (to ("BottomEmptySites")) (then (and ("HenAdded") (moveAgain)))) (forEach Piece))))} (end { (if (no Moves P1) (result P1 Loss)) (if (or (is In (where "Fox" P1) (sites Bottom)) (no Pieces P2)) (result P1 Win))})))
###
| (define "BottomEmptySites" (intersection (sites Empty) (sites Bottom))) (define "HenAdded" (set Value Prev (- (value Player Prev) 1))) (define "DidNotCaptured" (> (value Player Prev) 0)) (define "HasNotCaptured" (if (< (value Player Mover) 0) (set Value Mover 1) (set Value Mover (+ 1 (value Player Mover))))) (define "HopCustomSequenceCapture" (move Hop #1 #2 (between if:("IsEnemyAt" (between)) (apply (remove (between) #3))) (to if:(is Empty (to))) (then (if (can Move (hop (from (last To)) #2 (between if:(and (not (is In (between) (sites ToClear))) ("IsEnemyAt" (between))) (apply (remove (between) #3))) (to if:(is Empty (to))))) (moveAgain))))) (define "ShouldCapturedButMoved" (and (is Pending) (not (is In (last To) ("SitesWithPossibleCaptureInPreviousTurn"))))) (define "SitesWithPossibleCaptureInPreviousTurn" (sites Pending)) (define "RememberSiteWithPossibleMultiCapture" (set Pending (sites To (if ("SameTurn") #1 (forEach Piece "Fox" #2))))) (define "RememberSiteWithPossibleCapture" (set Pending (sites To (forEach Piece "Fox" #1)))) (game "Renard et les Poules" (players 2) (equipment { ("CrossBoard" 3 7 use:Vertex diagonals:Alternating) (hand P1) (piece "Fox" P1 S (or ("HopCapture" (directions {N S E W})) ("StepToEmpty" (directions {N S E W})))) (piece "Hen" P2 N ("StepToEmpty" (directions {Forwards Rightward Leftward})))}) (rules (start { (place "Fox1" (centrePoint)) (place "Hen2" (union {(expand (sites Bottom)) (sites Row 2) (sites {"A4" "G4" "A5" "G5"})}))}) phases:{ (phase "FoxPhase" P1 (play (do ("RememberSiteWithPossibleCapture" ("HopCapture" (directions {N S E W}))) next:(forEach Piece (then (if ("ShouldCapturedButMoved") ("HasNotCaptured"))))))) (phase "HenPhase" P2 (play (if (and ("DidNotCaptured") (!= 0 (count Sites in:("BottomEmptySites")))) (move Add (to ("BottomEmptySites")) (then (and ("HenAdded") (moveAgain)))) (forEach Piece))))} (end { (if (no Moves P1) (result P1 Loss)) (if (or (is In (where "Fox" P1) (sites Bottom)) (no Pieces P2)) (result P1 Win))}))) END |
Construct a Ludii game based on the following description
2x6 board. Four counters per hole. Play begins with a simultaneous racing move, where players attempt to be the first to drop the final counter of their sowing into an empty hole. Sowing occurs in an anti-clockwise direction. If the final counter falls into an occupied hole, these are picked up and sowing continues. If the final counter falls into an empty hole, the turn ends. At any time during the sowing, if a hole is made to contain four counters, the owner of the hole in which the four counters are located captures them, unless it is the final hole of the sowing, in which case the player who is sowing captures them. Play continues until a player can no longer move because there are no counters in their row, and the opponent captures the remaining counters. Players then count their pieces by placing four in each hole, and the player who has more than their original number takes ownership of one of the opponent's holes for every four counters more than the original number that have been taken. If no player took four more than the original, the player with three extra gets the hole. Play then begins again as before. The game ends when one player owns all of the counters, and thus all of the holes.
###
| (define "APlayerCanNotMove" (and (not (is Next Mover)) (or (all Sites (sites (values Remembered "OwnedP1")) if:(is Empty (site))) (all Sites (sites (values Remembered "OwnedP2")) if:(is Empty (site)))))) (define "RemmemberOwnedHoles" (if (is Mover P1) (remember Value "OwnedP1" #1) (remember Value "OwnedP2" #1))) (define "RightMostEmpty" (trackSite FirstSite "TrackCW" from:(mapEntry "RightMost" Mover) if:(is Empty (to)))) (define "OwnedHoles" (if (is Mover P1) (sites (values Remembered "OwnedP1")) (sites (values Remembered "OwnedP2")))) (define "NextHole" ("NextSiteOnTrack" #2 from:#1 "Track")) (game "Mewelad" (players 2) (equipment { (mancalaBoard 2 6 store:None { (track "TrackCCW" "0,E,N,W" loop:True) (track "TrackCW" "5,W,N,E" loop:True)}) (piece "Seed" Shared) (hand Each) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (map "RightMost" {(pair P1 5) (pair P2 6)})}) (rules (start { (set Count 4 to:(sites Track)) (set RememberValue "OwnedP1" (sites Bottom)) (set RememberValue "OwnedP2" (sites Top))}) phases:{ (phase "Sowing" (play (or { (move Select (from (if ("SameTurn") (sites {(var "Replay")}) ("OwnedHoles")) if:(is Occupied (from))) (then (do (set Var "NumSowed" (count at:(last To))) next:(sow "TrackCCW" apply:(if (= 4 (count at:(to))) (fromTo (from (to)) (to (handSite Mover)) count:4) (if (< 1 (count at:(to))) (and (moveAgain) (set Var "Replay" (to)))))) (then (and (forEach Site (sites Track from:(last From) to:(trackSite Move from:(last From) "Track" steps:(- (var "NumSowed") 1))) (if (= 4 (count at:(site))) (fromTo (from (site)) (to (if (is In (to) (sites (values Remembered "OwnedP1"))) (handSite P1) (handSite P2))) count:4))) (set Var "NumSowed" 0))))))} (then (if ("APlayerCanNotMove") (and { (if (no Moves P1) (forEach Site (sites Board) (if (is Occupied (site)) (fromTo (from (site)) (to (handSite P1)) count:(count at:(site))))) (forEach Site (sites Board) (if (is Occupied (site)) (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 ("RightMostEmpty")) count:(if (>= (count Cell at:(handSite Mover)) 4) 4 3) (then ("RemmemberOwnedHoles" (last To)))))) (nextPhase (all Passed) "Sowing"))})) END |
Construct a global Ludii definition which fulfills the following requirements.
Defines a step move to all the rotational directions to an empty site.
###
| (define "StepRotationalToEmpty" (move Step Rotational (to if:(is Empty (to))))) END |
Construct a Ludii game based on the following description
The goal of Theseus is to escape of the labyrinth. Theseus can step orthogonally but after steeping the Minotaur comes closer to him twice faster. If the Minotaur catches him, Theseus dies. The board in Wikipedia. The minotaur comes closer to Theseus in looking only the number of orthogonal steps without to take in account the walls. Theseus wins immediately if he reaches the exit.
###
| (define "MinotaurThreat" ("GoCloserToTheseus" E ("GoCloserToTheseus" W ("GoCloserToTheseus" N ("GoCloserToTheseus" S))) (then ("MinotaurThreatAgain")))) (define "MinotaurThreatAgain" ("GoCloserToTheseus" E ("GoCloserToTheseus" W ("GoCloserToTheseus" N ("GoCloserToTheseus" S))))) (define "GoCloserToTheseus" (if (and ("NoEdgeBetweenCells" (where (id "Minotaur0")) (ahead (where (id "Minotaur0")) #1)) ("OriginalCloserToTheseus" #1)) ("MoveMinotaur" #1) #2 #3)) (define "MoveMinotaur" (fromTo (from (where (id "Minotaur0"))) (to (ahead (from) #1) (apply (if (= (id "Theseus") (what at:(to))) (remove (to))))))) (define "SmartCloserToTheseus" (> (count Steps (step (from (where (id "Minotaur0"))) Orthogonal (to if:("NoEdgeBetweenCells" (from) (to)))) (where (id "Minotaur0")) (where (id "Theseus"))) (count Steps (step (from (ahead (where (id "Minotaur0")) #1)) Orthogonal (to if:("NoEdgeBetweenCells" (from) (to)))) (ahead (where (id "Minotaur0")) #1) (where (id "Theseus"))))) (define "OriginalCloserToTheseus" (> (count Steps Orthogonal (where (id "Minotaur0")) (where (id "Theseus"))) (count Steps Orthogonal (ahead (where (id "Minotaur0")) #1) (where (id "Theseus"))))) (define "NoEdgeBetweenCells" ("NoSites" (intersection (sites Occupied by:Shared on:Edge) ("EdgeInCommon" #1 #2)))) (define "EdgeInCommon" (intersection (sites Incident Edge of:Cell at:#1) (sites Incident Edge of:Cell at:#2))) (game "Theseus and the Minotaur" (players 1) (equipment { (board (square 6)) (piece "Theseus" P1 (move Step Orthogonal (to if:(and (is Empty (to)) ("NoEdgeBetweenCells" (from) (to)))))) (piece "Minotaur" Neutral) (piece "Marker" Shared) (regions "Exit" {34})}) (rules (start { (place "Theseus" coord:"E4") (place "Minotaur0" coord:"A6") (set Shared Edge (union (sites Outer Edge) (sites {65 60 53 47 46 33 41 63 76 48 28 21 36 43 56 62 20})))}) (play (or (forEach Piece) (move Pass) (then (if (not (is In (where (id "Theseus")) (sites "Exit"))) ("MinotaurThreat"))))) (end { (if (no Pieces Mover) (result Mover Loss)) (if (is In (where (id "Theseus")) (sites "Exit")) (result Mover Win))}))) END |
Modify the Ludii game according to the following option changes:
The version of the game played with 3 players. -> The version of the game played with 4 players.
(game "Line and Cross" (players 3) (equipment { (board (graph vertices:{{2 0} {1 1} {4 1} {7 1} {10 1} {0 2} {2 2} {3 2} {5 2} {9 2} {0 3} {6 3} {7 3} {9 3} {10 3} {11 3} {2 4} {4 4} {6 4} {7 4} {8 4} {10 4} {12 4} {7 5} {9 5} {11 5} {13 5} {1 6} {2 6} {4 6} {6 6} {8 6} {10 6} {12 6} {14 6}} edges:{ {0 6} {5 7} {1 27} {10 11} {2 17} {16 28} {8 9} {3 12} {17 19} {18 30} {29 30} {23 24} {20 31} {13 15} {4 14} {21 32} {25 26} {22 33} {33 34} {1 2} {6 16} {16 17} {27 29} {11 18} {12 19} {19 23} {19 20} {21 22} {15 25} {13 24}}) use:Edge) (piece "Marker" Shared)}) (rules (start { (set Shared Edge (sites Board Edge))}) (play (move Remove (sites Occupied by:Shared) (then (and (remove Edge (last To)) (forEach Site (sites Crossing at:(last To) All) (and (remove Edge (to)) (addScore Mover 1))))))) (end (if (no Moves Next) (byScore)))))
###
| (game "Line and Cross" (players 4) (equipment { (board (graph vertices:{{2 0} {1 1} {4 1} {7 1} {10 1} {0 2} {2 2} {3 2} {5 2} {9 2} {0 3} {6 3} {7 3} {9 3} {10 3} {11 3} {2 4} {4 4} {6 4} {7 4} {8 4} {10 4} {12 4} {7 5} {9 5} {11 5} {13 5} {1 6} {2 6} {4 6} {6 6} {8 6} {10 6} {12 6} {14 6}} edges:{ {0 6} {5 7} {1 27} {10 11} {2 17} {16 28} {8 9} {3 12} {17 19} {18 30} {29 30} {23 24} {20 31} {13 15} {4 14} {21 32} {25 26} {22 33} {33 34} {1 2} {6 16} {16 17} {27 29} {11 18} {12 19} {19 23} {19 20} {21 22} {15 25} {13 24}}) use:Edge) (piece "Marker" Shared)}) (rules (start { (set Shared Edge (sites Board Edge))}) (play (move Remove (sites Occupied by:Shared) (then (and (remove Edge (last To)) (forEach Site (sites Crossing at:(last To) All) (and (remove Edge (to)) (addScore Mover 1))))))) (end (if (no Moves Next) (byScore))))) END |
Modify the Ludii game according to the following option changes:
The game is played on a 4x4 board -> The game is played on a 5x5 board
(game "Havannah" (players 2) (equipment { (board (hex 4)) (piece "Marker" Each)}) (rules (play (move Add (to (sites Empty)))) (end (if (or { (is Loop) (is Connected 3 SidesNoCorners) (is Connected 2 Corners)}) (result Mover Win)))))
###
| (game "Havannah" (players 2) (equipment { (board (hex 5)) (piece "Marker" Each)}) (rules (play (move Add (to (sites Empty)))) (end (if (or { (is Loop) (is Connected 3 SidesNoCorners) (is Connected 2 Corners)}) (result Mover Win))))) END |
What does the following global Ludii definition do?
(define "BottomTopSetup" (start { (place #2 (expand (sites Bottom) steps:(- #1 1))) (place #3 (expand (sites Top) steps:(- #1 1)))}))
###
| Defines starting rules placing one piece on each cell of the bottom and the top rows of the board (e.g. Starting rules of Breakthrough). END |
Modify the Ludii game according to the following option changes:
The number of counters to have in the hole to capture in the initial captures before the sequence is 3. -> The number of counters to have in the hole to capture in the initial captures before the sequence is 4.
(define "UpdateNumCaptureTwo" (set Value Mover (+ 1 (value Player Mover)))) (define "NumCountersToCapture" (if (is In 3 ("NumToCapture")) (+ 1 3) (if (is In 1 ("NumToCapture")) 2 (if (is In 3 ("NumToCapture")) 4 6)))) (define "UpdateNumToCapture" (if (is Mover P1) (and (forget Value "NumToCaptureP1" All) (if (is In 3 ("NumToCapture")) (remember Value "NumToCaptureP1" 1) (if (is In 1 ("NumToCapture")) (remember Value "NumToCaptureP1" 3) (if (is In 5 ("NumToCapture")) (remember Value "NumToCaptureP1" 1) (remember Value "NumToCaptureP1" 5))))) (and (forget Value "NumToCaptureP2" All) (if (is In 3 ("NumToCapture")) (remember Value "NumToCaptureP2" 1) (if (is In 1 ("NumToCapture")) (remember Value "NumToCaptureP2" 3) (if (is In 5 ("NumToCapture")) (remember Value "NumToCaptureP2" 1) (remember Value "NumToCaptureP2" 5))))))) (define "NumToCapture" (if (is Mover P1) (sites (values Remembered "NumToCaptureP1")) (sites (values Remembered "NumToCaptureP2")))) (define "PiecesOwnedBy" (count at:(mapEntry #1))) (define "Columns" 4) (game "The Concentration Game" (players 2) (equipment { (mancalaBoard 3 "Columns" store:None (track "Track" "0,E,N,W,S2" loop:True)) (piece "Seed" Shared) (regions P1 (union (sites {4}) (sites Bottom))) (regions P2 (union (sites {7}) (sites Top))) (map {(pair P1 5) (pair P2 6)})}) (rules (start { (set Count 10 to:(sites Outer)) (set RememberValue "NumToCaptureP1" 3) (set RememberValue "NumToCaptureP2" 3) (set RememberValue "NumCaptureTwoP1" 0) (set RememberValue "NumCaptureTwoP2" 0)}) (play (move Select (from (sites Mover) if:(< 1 (count at:(from)))) (then (sow if:(= (count at:(to)) ("NumCountersToCapture")) apply:(and (fromTo (from (to)) (to (mapEntry (mover))) count:(count at:(to))) (if (< (value Player Mover) 5) ("UpdateNumCaptureTwo") ("UpdateNumToCapture"))) origin:True)))) (end ("MancalaByScoreWhen" (no Moves Next)))))
###
| (define "UpdateNumCaptureTwo" (set Value Mover (+ 1 (value Player Mover)))) (define "NumCountersToCapture" (if (is In 4 ("NumToCapture")) (+ 1 4) (if (is In 1 ("NumToCapture")) 2 (if (is In 3 ("NumToCapture")) 4 6)))) (define "UpdateNumToCapture" (if (is Mover P1) (and (forget Value "NumToCaptureP1" All) (if (is In 4 ("NumToCapture")) (remember Value "NumToCaptureP1" 1) (if (is In 1 ("NumToCapture")) (remember Value "NumToCaptureP1" 3) (if (is In 5 ("NumToCapture")) (remember Value "NumToCaptureP1" 1) (remember Value "NumToCaptureP1" 5))))) (and (forget Value "NumToCaptureP2" All) (if (is In 4 ("NumToCapture")) (remember Value "NumToCaptureP2" 1) (if (is In 1 ("NumToCapture")) (remember Value "NumToCaptureP2" 3) (if (is In 5 ("NumToCapture")) (remember Value "NumToCaptureP2" 1) (remember Value "NumToCaptureP2" 5))))))) (define "NumToCapture" (if (is Mover P1) (sites (values Remembered "NumToCaptureP1")) (sites (values Remembered "NumToCaptureP2")))) (define "PiecesOwnedBy" (count at:(mapEntry #1))) (define "Columns" 4) (game "The Concentration Game" (players 2) (equipment { (mancalaBoard 3 "Columns" store:None (track "Track" "0,E,N,W,S2" loop:True)) (piece "Seed" Shared) (regions P1 (union (sites {4}) (sites Bottom))) (regions P2 (union (sites {7}) (sites Top))) (map {(pair P1 5) (pair P2 6)})}) (rules (start { (set Count 10 to:(sites Outer)) (set RememberValue "NumToCaptureP1" 4) (set RememberValue "NumToCaptureP2" 4) (set RememberValue "NumCaptureTwoP1" 0) (set RememberValue "NumCaptureTwoP2" 0)}) (play (move Select (from (sites Mover) if:(< 1 (count at:(from)))) (then (sow if:(= (count at:(to)) ("NumCountersToCapture")) apply:(and (fromTo (from (to)) (to (mapEntry (mover))) count:(count at:(to))) (if (< (value Player Mover) 5) ("UpdateNumCaptureTwo") ("UpdateNumToCapture"))) origin:True)))) (end ("MancalaByScoreWhen" (no Moves Next))))) END |
Construct a Ludii game based on the following description
8x8 board, with diagonals drawn in the 2x2 squares in each corner, as well as the diagonals of the entire board. Each player has a complement of pieces, with special moves as follows: Min-gyi (x1, \
###
| (define "AllPiecesOnBoard" (= 0 (count Sites in:(union (sites Occupied by:P1 container:"Hand") (sites Occupied by:P2 container:"Hand"))))) (define "IfPawnStoreIt" (if (is Occupied (to)) (fromTo (from (to)) (to (handSite Mover 5))))) (define "EmptySiteOnPlayerSideOrOccupiedByOwnedPawn" (difference (intersection (sites Mover) (union (sites Empty) (sites Occupied by:Mover container:"Board" component:"Pawn"))) (sites "NoPawnSites"))) (define "AnyOwnedSitesOnBoardExceptPawn" (difference (sites Occupied by:Mover container:"Board") (sites Occupied by:Mover container:"Board" component:"Pawn"))) (define "PawnWasMovedForward" (and (is In (last From) (sites Board)) ("IsPieceAt" "Pawn" Mover (last To)))) (define "ReplaceAPawn" (move (from (sites Occupied by:Mover container:"Hand" component:"Pawn")) (to ("EmptySitesBehindPawnPositions")))) (define "EmptySitesBehindPawnPositions" (intersection (difference (sites Mover) (union (sites "PawnSites") (sites "NoPawnSites"))) (sites Empty))) (define "PawnToReplace" (!= 0 (count Sites in:(sites Occupied by:Mover container:"Hand" component:"Pawn")))) (game "Sittuyin" ("TwoPlayersNorthSouth") (equipment { (board (square 8)) (hand Each size:6) ("ChessKing" "King_noCross") ("ChessRook" "Rook") (piece "Elephant" Each ("StepToNotFriend" Forwards)) ("ChessKnight" "Knight") ("ChessPawn" "Pawn" ~ (then ("PromoteIfReach" (difference (sites "DiagonalSites") (sites Mover "Home")) "Queen"))) (piece "Queen" Each ("StepToNotFriend" Diagonal)) (regions "Home" P1 (expand (sites Bottom) steps:3)) (regions "Home" P2 (expand (sites Top) steps:3)) (regions "NoPawnSites" (union (difference (sites Row 3) (expand (sites Right) steps:3)) (difference (sites Row 4) (expand (sites Left) steps:3)))) (regions "PawnSites" (union { (difference (sites Row 2) (expand (sites Right) steps:3)) (difference (sites Row 3) (expand (sites Left) steps:3)) (difference (sites Row 4) (expand (sites Right) steps:3)) (difference (sites Row 5) (expand (sites Left) steps:3))})) (regions "DiagonalSites" (union (union (sites Centre) (expand (sites Corners) steps:1)) (sites {"C6" "F6" "F3" "C3"}))) (map "KingInitPos" { (pair P1 (coord "G2")) (pair P2 (coord "B7"))})}) (rules (start { (place "Pawn1" (difference (sites Row 2) (expand (sites Right) steps:3))) (place "Pawn1" (difference (sites Row 3) (expand (sites Left) steps:3))) (place "Pawn2" (difference (sites Row 4) (expand (sites Right) steps:3))) (place "Pawn2" (difference (sites Row 5) (expand (sites Left) steps:3))) (place "King_noCross1" (handSite P1)) (place "King_noCross2" (handSite P2)) (place "Queen1" (handSite P1 1)) (place "Queen2" (handSite P2 1)) (place "Elephant1" (handSite P1 2) count:2) (place "Elephant2" (handSite P2 2) count:2) (place "Knight1" (handSite P1 3) count:2) (place "Knight2" (handSite P2 3) count:2) (place "Rook1" (handSite P1 4) count:2) (place "Rook2" (handSite P2 4) count:2)}) phases:{ (phase "PlaceKing" (play (move (from (sites Occupied by:Mover container:"Hand" component:"King_noCross")) (to (mapEntry "KingInitPos" Mover)))) (nextPhase Mover "PlaceFirstElephant")) (phase "PlaceFirstElephant" (play (move (from (sites Occupied by:Mover container:"Hand" component:"Elephant")) (to (sites Around (mapEntry "KingInitPos" Mover))))) (nextPhase Mover "PlaceOtherPieces")) (phase "PlaceOtherPieces" (play (if ("PawnToReplace") ("ReplaceAPawn") (or (if ("AllPiecesOnBoard") (or (forEach Piece "Pawn" "StepForwardToEmpty") (move (from ("AnyOwnedSitesOnBoardExceptPawn")) (to ("EmptySiteOnPlayerSideOrOccupiedByOwnedPawn") (apply ("IfPawnStoreIt"))) (then (if ("PawnToReplace") (moveAgain)))))) (move (from (sites Occupied by:Mover container:"Hand")) (to ("EmptySiteOnPlayerSideOrOccupiedByOwnedPawn") (apply ("IfPawnStoreIt"))) (then (if ("PawnToReplace") (moveAgain))))))) (nextPhase ("PawnWasMovedForward") "Playing")) (phase "Playing" (play (do (forEach Piece) ifAfterwards:(not ("IsInCheck" "King_noCross" Mover)))) (end ("Checkmate" "King_noCross")))})) END |
Construct a Ludii game based on the following description
3x15 board, with the central spot marked. Fifteen pieces per player, arranged along the outer two rows of the board. Another piece, the Gonagas (\
###
| (define "DieNotUsed" (!= (pips) 0)) (define "MoveGonagasWithStoredPips" (forEach Value (values Remembered "Pips") (move Slide (from (from) level:(level) if:(= (state at:(from) level:(level)) (mover))) Orthogonal (between (exact (value)) if:True) (to (apply if:(or (is Empty (to)) (and ("IsEnemyAt" (to)) ("IsActivated" (to) (topLevel at:(to))))))) (then (and { (forEach Level (last To) (if (!= (topLevel at:(last To)) (level)) (remove (last To) level:(level)))) (forget Value "Pips" (count Steps (last From) (last To))) (if (!= 1 (size Array (values Remembered "Pips"))) (moveAgain))}))))) (define "MovePieceWithStoredPips" (forEach Value (values Remembered "Pips") (move (from (from) level:(level) if:(or ("IsActivated" (from) (level)) ("Sahkku" (value)))) (to ("NextSiteOnTrack" (value) from:(from)) if:(or { (= (id "Gonagas" Shared) (what at:(to))) (is Empty (to)) (and ("IsEnemyAt" (to)) ("IsActivated" (to) (topLevel at:(to))))}) (apply (and { (if (not ("IsActivated" (from) (level))) ("ActivePiece" (from) (level))) (forget Value "Pips" (value)) (if (= (what at:(to)) (id "Gonagas" Shared)) (set State at:(to) (mover)) (if ("IsEnemyAt" (to)) (remove (to))))}))) (then (if (!= 0 (size Array (values Remembered "Pips"))) (moveAgain)))))) (define "IsActivated" (= 1 (state at:#1 level:#2))) (define "ActivePiece" (set State at:#1 level:#2 1)) (define "NumberOfSahkku" (if (and ("Sahkku" ("Die1") 1) (all DiceEqual)) 3 (if (or { (and {(not ("Sahkku" ("Die1"))) ("Sahkku" ("Die2")) ("Sahkku" ("Die3"))}) (and {("Sahkku" ("Die1")) (not ("Sahkku" ("Die2"))) ("Sahkku" ("Die3"))}) (and {("Sahkku" ("Die1")) ("Sahkku" ("Die2")) (not ("Sahkku" ("Die3")))})}) 2 (if (or { (and {(not ("Sahkku" ("Die1"))) (not ("Sahkku" ("Die2"))) ("Sahkku" ("Die3"))}) (and {("Sahkku" ("Die1")) (not ("Sahkku" ("Die2"))) (not ("Sahkku" ("Die3")))}) (and {(not ("Sahkku" ("Die1"))) ("Sahkku" ("Die2")) (not ("Sahkku" ("Die3")))})}) 1 0)))) (define "IsASahkku" (is AnyDie 1)) (define "Die3" (face 47)) (define "Die2" (face 46)) (define "Die1" (face 45)) (define "Sahkku" (= 1 #1)) (game "Sahkku" (players 2) (equipment { (board (rectangle 3 15) { (track "Track1" "0,E,N1,W,N1,E,S1,W" loop:True P1) (track "Track2" "44,W,S1,E,S1,W,N1,E" loop:True P2)}) (dice d:4 from:0 num:3) (piece "Marker" Each (forEach Die if:("DieNotUsed") (move (from (from) level:(level) if:(or ("IsActivated" (from) (level)) ("Sahkku" (pips)))) (to ("NextSiteOnTrack" (pips) from:(from)) if:(or { (= (id "Gonagas" Shared) (what at:(to))) (is Empty (to)) (and ("IsEnemyAt" (to)) ("IsActivated" (to) (topLevel at:(to))))}) (apply (and { (if (not ("IsActivated" (from) (level))) ("ActivePiece" (from) (level))) (forget Value "Pips" (pips)) (if (= (what at:(to)) (id "Gonagas" Shared)) (set State at:(to) (mover)) (if ("IsEnemyAt" (to)) (remove (to))))}))) (then ("ReplayNotAllDiceUsed"))))) (piece "Gonagas" Shared (forEach Die if:("DieNotUsed") (move Slide (from (from) level:(level) if:(= (state at:(from) level:(level)) (mover))) Orthogonal (between (exact (pips)) if:True) (to (apply if:(or (is Empty (to)) (and ("IsEnemyAt" (to)) ("IsActivated" (to) (topLevel at:(to))))))) (then (and (forEach Level (last To) (if (!= (topLevel at:(last To)) (level)) (remove (last To) level:(level)))) ("ReplayNotAllDiceUsed"))))))}) (rules (start { (place Stack "Marker1" (sites Bottom)) (place Stack "Marker2" (sites Top)) (place Stack "Gonagas" (centrePoint))}) phases:{ (phase "Opening" (play (do (and (roll) (if (and (!= 0 (value Player Mover)) (= 0 (count MovesThisTurn))) (set Value Mover 0))) next:(move Pass (then (and (if ("IsASahkku") (set Value Mover (+ ("NumberOfSahkku")(value Player Mover)))) (forEach Die (if (!= 0 (pips)) (remember Value "Pips" (pips))))))) (then (if (or (<= 3 (value Player Mover)) (!= 2 (count MovesThisTurn))) (moveAgain) (and (forget Value "Pips" All) (set Value Mover 0)))))) (nextPhase Mover (<= 3 (value Player Mover)) "PlayingPips")) (phase "PlayingPips" (play ("RollEachNewTurnMove" (or (forEach Piece "MovePieceWithStoredPips") (forEach Piece "MoveGonagasWithStoredPips" Shared)))) (nextPhase Mover (= 0 (size Array (values Remembered "Pips"))) "Playing")) (phase "Playing" (play ("RollEachNewTurnMove" (or (forEach Piece) (forEach Piece Shared)))))} (end ("CaptureAll" Next)))) END |
What does the following global Ludii definition do?
(define "StepBackwardToEmpty" (move Step Backward (to if:(is Empty (to)))))
###
| Defines a step move to the backward direction according to the facing direction of the piece in the 'from' location to an empty site. END |
Describe the mechanics of the following Ludii game
(define "DiagonalSENW" (union (sites Direction from:(last To) SE included:True) (sites Direction from:(last To) NW))) (define "DiagonalNESW" (union (sites Direction from:(last To) NE included:True) (sites Direction from:(last To) SW))) (game "Diagonals" (players 2) (equipment { (board (square 8) use:Vertex) (piece "Ball" Each)}) (rules (play (move Add (to (sites Empty)) (then (and (if (not (is In (last To) (sites {"A8" "H1"}))) (if (all Sites ("DiagonalNESW") if:(is Occupied (site))) (addScore Mover (count Sites in:(forEach ("DiagonalNESW") if:("IsFriendAt" (site))))))) (if (not (is In (last To) (sites {"A1" "H8"}))) (if (all Sites ("DiagonalSENW") if:(is Occupied (site))) (addScore Mover (count Sites in:(forEach ("DiagonalSENW") if:("IsFriendAt" (site))))))))))) (end (if (is Full) (byScore)))))
###
| TURN - On each turn, each player drops a friendly stone on an empty cell. If a diagonal line is full (i.e., there are no empty cells on that diagonal), the player who dropped the last stone achieves so many points as the number of friendly stones on the finished line.
Two lines can be finished on one turn, the player achieves points for both lines (the dropped stone counts twice, once for each diagonal).
A diagonal line must have at least 2 stones. So, corner cells do not count as diagonals.
GOAL - When all cells are occupied, wins the player with more points. END |
Construct a Ludii game based on the following description
Each turn consists of moving a piece one square orthogonally in any direction. An animal may eat any animal smaller than itself by moving on to its square. The only exception to this rule is that the rat can kill the elephant. If the same animals meet, the animal moving on to a square eats the animal already there. Three pieces have special powers. When the rat reaches the river it can enter it and move along those squares squares as if it were any other. If it is in the river no other animal can attack it. The rat is unable to attack the elephant from the river. If both rats meet in the river the moving piece eats the other one. When a lion or a tiger reaches a square on the edge of the river, at the next move it can jump over the river in any orthogonal direction, landing on the nearest land square. It captures any smaller animal on that square: if, however, there is a rat in the river in the line of the jump, it blocks this move. Each side has three trap-squares and the player's own pieces may move on and off them without restriction, but if an enemy animal occupies a trap-square, it loses all its power and becomes weaker than any defending piece. As soon as it moves out of the trap it regains its full strength. A player may not move any of his animals on to his own den. The player who moves any of their pieces into the enemy's den wins.
###
| (define "RestoredPower" (set State at:(last To) (mapEntry (what at:(last To))))) (define "LosePower" (set State at:(last To) 0)) (define "HopTheWater" (move Hop #1 (between #2 if:(is In (between) (forEach (sites "Water") if:(is Empty (site)))) (apply (remove (between)))) (to if:(and { (not (is In (to) (sites "Water"))) (not ("IsFriendAt" (to))) (<= (state at:(to)) (state at:(from)))})))) (define "StepMove" (move Step Orthogonal (to if:(and (is In (to) (difference (union (sites Occupied by:Next) (sites Empty)) (union (sites "Water") (sites Mover)))) (<= (state at:(to)) (state at:(from)))) (apply (remove (to)))))) (game "Jungle" (players 2) (equipment { (board (rectangle 9 7)) (piece "Elephant" Each "StepMove") (piece "Lion" Each (or { "StepMove" ("HopTheWater" (directions {W E}) (max 2)) ("HopTheWater" (directions {N S}) (max 3))})) (piece "Tiger" Each (or { "StepMove" ("HopTheWater" (directions {W E}) (max 2)) ("HopTheWater" (directions {N S}) (max 3))})) (piece "Leopard" Each "StepMove") (piece "Dog" Each "StepMove") (piece "Wolf" Each "StepMove") (piece "Cat" Each "StepMove") (piece "Rat" Each (move Step Orthogonal (to if:(and (is In (to) (difference (union (sites Occupied by:Next) (sites Empty)) (sites Mover))) (or (<= (state at:(to)) (state at:(from))) (and (not (is In (from) (sites "Water"))) ("IsPieceAt" "Elephant" Next (to))))) (apply (remove (to)))))) (regions "Water" (sites {"B4" "C4" "B5" "C5" "B6" "C6" "E4" "F4" "E5" "F5" "E6" "F6"})) (regions "Trap" (sites {"C1" "E1" "D2" "D8" "C9" "E9"})) (regions "Den" P1 (sites {"D1"})) (regions "Den" P2 (sites {"D9"})) (map {(pair 1 8) (pair 2 8) (pair 3 7) (pair 4 7) (pair 5 6) (pair 6 6) (pair 7 5) (pair 8 5) (pair 9 4) (pair 10 4) (pair 11 3) (pair 12 3) (pair 13 2) (pair 14 2) (pair 15 1) (pair 16 1)})}) (rules (start { (place "Rat1" coord:"G3" state:1) (place "Rat2" coord:"A7" state:1) (place "Cat1" coord:"B2" state:2) (place "Cat2" coord:"F8" state:2) (place "Wolf1" coord:"C3" state:3) (place "Wolf2" coord:"E7" state:3) (place "Dog1" coord:"F2" state:4) (place "Dog2" coord:"B8" state:4) (place "Leopard1" coord:"E3" state:5) (place "Leopard2" coord:"C7" state:5) (place "Tiger1" coord:"A1" state:6) (place "Tiger2" coord:"G9" state:6) (place "Lion1" coord:"G1" state:7) (place "Lion2" coord:"A9" state:7) (place "Elephant1" coord:"A3" state:8) (place "Elephant2" coord:"G7" state:8)}) (play (forEach Piece (then (and (if (is In (last From) (sites "Trap")) "RestoredPower") (if (is In (last To) (sites "Trap")) "LosePower"))))) (end ("ReachWin" (sites Next) Mover)))) END |
Describe the mechanics of the following Ludii game
(define "MoveOn" (if ("IsNotOffBoard" #1) (move (from (from) level:(level)) (to #1 if:(is Empty #1))) #2)) (define "ReachEastDoor" (= (last To) "EastDoor")) (define "MadeACompleteCircuit" (if (= 1 (state at:(where "Stick" Mover))) (is In "EastDoor" (sites Track "TrackCW" from:("NextSite" (last From) "TrackCW") to:(last To))) (is In "EastDoor" (sites Track "TrackCCW" from:("NextSite" (last From) "TrackCCW") to:(last To))))) (define "NextSite" ("NextSiteOnTrack" 1 from:#1 #2)) (define "ThrowValue" (if (= (count Pips) 3) 5 (if (= (count Pips) 0) 10 (if (= (count Pips) 1) 2 (if (= (face 44) 1) 15 3))))) (define "SiteToMoveOnTrackCCW" ("NextSiteOnTrack" ("ThrowValue") "TrackCCW")) (define "SiteToMoveOnTrackCW" ("NextSiteOnTrack" ("ThrowValue") "TrackCW")) (define "SiteToMoveOnSelectedTrack" (if (= (state at:(from)) 1) ("NextSiteOnTrack" ("ThrowValue") "TrackCW") ("NextSiteOnTrack" ("ThrowValue") "TrackCCW"))) (define "EastDoor" 38) (game "Owasokotz" (players 4) (equipment { ("FortyStonesWithFourGapsBoard" { (track "TrackCW" {39 35 33 31 29 27 25 23 21 19 38 17 15 13 11 9 7 5 3 1 37 0 2 4 6 8 10 12 14 16 36 18 20 22 24 26 28 30 32 34} loop:True) (track "TrackCCW" {39 34 32 30 28 26 24 22 20 18 36 16 14 12 10 8 6 4 2 0 37 1 3 5 7 9 11 13 15 17 38 19 21 23 25 27 29 31 33 35} loop:True)}) (regions "AllSites" (sites Board)) (piece "Stick" Each (if (= (state at:(from)) 0) (or ("MoveOn" ("NextSiteOnTrack" ("ThrowValue") "TrackCCW") (then (set State at:(last To) 2))) ("MoveOn" ("NextSiteOnTrack" ("ThrowValue") "TrackCW") (then (set State at:(last To) 1)))) ("MoveOn" ("SiteToMoveOnSelectedTrack" ("ThrowValue"))))) ("StickDice" 3) (hand Each)}) (rules (start (place Stack items:{"Stick4" "Stick3" "Stick2" "Stick1"} Edge "EastDoor")) (play ("RollMove" (forEach Piece))) (end (if (and (not (was Pass)) ("MadeACompleteCircuit")) (result Mover Win)))))
###
| Forty stones arranged in a circle, with a larger gap after every tenth stone. These gaps are known as doors. Any number of players, each player begins with one piece, which begins at the east door. Three sticks used as dice, black on one side, white on the other, with one stick notched on the white side. The throws are as follows: two black with one notched white side up = 15; three white sides up = 10; two black and one white, not notched = 3, two white and one black = 2, three black = 5. Throws of 10 and 15 grant the player another throw. Players may move in either direction around the circle. To win, the player must complete a circuit of the board and pass the east door. The game has 4 players. The goal is to pass the east door. END |
Describe the mechanics of the following Ludii game
(define "IsUnpromoted" ("IsPieceAt" "Counter" Mover (last To))) (game "Pleasant Draughts" ("TwoPlayersNorthSouth") ("DraughtsEquipment" (square 8)) (rules ("BlackCellsSetup" 3) (play (if "SameTurn" (or (if "IsUnpromoted" ("HopCapture" (from (last To)) (directions {FR FL}) (then ("PromoteIfReach" (sites Next) "DoubleCounter" ("ReplayIfCanMove" ("HopCapture" (from (last To)) (directions {FR FL})))))) ("HopDiagonalSequenceCaptureAgain")) (move Pass)) (or (forEach Piece "Counter" (or ("HopCapture" (from) (directions {FR FL}) (then ("PromoteIfReach" (sites Next) "DoubleCounter" ("ReplayIfCanMove" ("HopCapture" (from (last To)) (directions {FR FL})))))) ("StepToEmpty" (directions {FR FL})) (then ("PromoteIfReach" (sites Next) "DoubleCounter")))) (forEach Piece "DoubleCounter" (or ("StepDiagonalToEmpty") ("HopDiagonalSequenceCapture")))))) (end ("CaptureAll" Next))))
###
| Played on an 8x8 board with each player having twelve pieces. Pieces move diagonally one space forward, and can capture opponent's pieces by jumping them if they are adjacent. Capturing is not mandatory. Multiple captures are allowed. Once pieces reach the opposite side of the board from their starting position, they become kings and can move diagonally either forwards or backwards. The goal is to capture all of the opponent's pieces.
END |
Construct a Ludii game based on the following description
4x4 board. One player plays as four tigers, which begin the board placed in the four corner spaces. The other player plays as twelve oxen. The first move is made by placing one of the oxen on an empty space, followed by a move by the tiger closest to the ox. Players continue alternating moves, the oxen player placing an ox and the tiger player moving a tiger. When moving, pieces move to an empty adjacent spot orthogonally. Once all of the oxen are placed, the players alternate turns moving their pieces on the board. Pieces may capture another piece by hopping over an adjacent opponent's piece to an empty space immediately on the opposite side of it. Tigers capture orthogonally, oxen capture diagonally. Oxen may also capture a tiger by blocking it from being able to move. The oxen win by reducing the tigers to two.
###
| (define "MinDistanceWithCorners" (min (results from:(last To) to:(sites Corners) (count Steps (from) (to))))) (define "RemoveAllTigersWithNoMove" (then (forEach Site (sites Occupied by:Next) (if (not (can Move (or (step (from (site)) Orthogonal (to if:(is Empty (to)))) (hop (from (site)) Orthogonal (between if:(= (who at:(between)) P1) (apply (remove (between)))) (to if:(is Empty (to))))))) (remove (site)))))) (game "Len Cua Kin Ngoa" (players 2) (equipment { (board (square 4)) (hand P1) (piece "Ox" P1 (or ("HopDiagonalCapture") "StepOrthogonalToEmpty")) (piece "Tiger" P2 (or ("HopOrthogonalCapture") "StepOrthogonalToEmpty"))}) (rules (start { (place "Ox1" (handSite P1) count:12) (place "Tiger2" (sites Corners))}) phases:{ (phase "Placement" P1 (play (move (from (handSite P1)) (to (sites Empty)) ("RemoveAllTigersWithNoMove"))) (nextPhase ("HandEmpty" P1) "MovementP1")) (phase "MovementP1" P1 (play (forEach Piece ("RemoveAllTigersWithNoMove")))) (phase "FirstTigerMovement" P2 (play (forEach Piece (if (= (count Steps (from) (last To)) ("MinDistanceWithCorners")) (or ("HopOrthogonalCapture") "StepToEmpty")))) (nextPhase Mover "MovementP2")) (phase "MovementP2" P2 (play (forEach Piece)))} (end { (if (no Pieces P1) (result P2 Win)) (if (>= 2 (count Pieces P2)) (result P1 Win))}))) END |
Describe the mechanics of the following Ludii game
(define "ReachedTarget" (is In (last To) (sites Mover))) (game "Bombardment" ("TwoPlayersNorthSouth") (equipment { (board (square 8)) (piece "NuclearBomb" Each (or ("StepForwardsToEmpty") (move Select (from (from)) (then (forEach Site (sites Around (last To) includeSelf:True) (if (is Occupied (site)) (remove (site)))))))) (regions P1 (sites Top)) (regions P2 (sites Bottom))}) (rules (start { (place "NuclearBomb1" (expand (sites Bottom))) (place "NuclearBomb2" (expand (sites Top)))}) (play (forEach Piece)) (end (if (or ("ReachedTarget") (no Pieces Next)) (result Mover Win)))))
###
| MOVE - On each turn, each player must do one of the following actions:
- Move one friendly stone (the missiles) one cell forward (orthogonally or diagonally)
- Explode one friendly stone, i.e., capture all stones of either color orthogonally and diagonally adjacent including itself.
GOAL - Wins the player that move a stone into the last row, or is the only with stones in the board. END |
Construct a Ludii game based on the following description
Futoshiki is played on a square grid. The starting state may have numbers placed in the squares of the grid. The goal is to place numbers in the squares so that each row and each column has only one instance of a particular number. The \
###
| (game "Futoshiki" (players 1) (equipment { (board (square 5) (values Vertex (range 1 5)) use:Vertex) (hints { (hint {0 1}) (hint {1 2}) (hint {8 9}) (hint {21 20}) (hint {23 22}) (hint {24 23})} Vertex) (regions {Columns Rows})}) (rules (start (set { {9 4} {12 4} {15 4} {19 2}})) (play (satisfy { (forAll Hint (< (from) (to))) (all Different)})) (end (if (is Solved) (result P1 Win))))) END |
Construct a Ludii game based on the following description
Players take turns removing a piece of their colour whose number is higher than the last piece they removed (free choice of first piece). A player with no legal moves passes. The game ends when neither player has any legal moves and is won by the player with the fewest remaining pieces (draw if equal).
###
| (define "StoreStateRemoved" (set Value Mover (state at:(last To)))) (define "LastStateRemove" (value Player Mover)) (game "Greater" (players 2) (equipment { (board (square 4)) (piece "Disc" Each)}) (rules (start { (place "Disc1" {"A1"} state:1) (place "Disc1" {"B1"} state:2) (place "Disc1" {"C1"} state:3) (place "Disc1" {"D1"} state:4) (place "Disc1" {"A2"} state:5) (place "Disc1" {"B2"} state:6) (place "Disc1" {"C2"} state:7) (place "Disc1" {"D2"} state:8) (place "Disc2" {"A3"} state:5) (place "Disc2" {"B3"} state:6) (place "Disc2" {"C3"} state:7) (place "Disc2" {"D3"} state:8) (place "Disc2" {"A4"} state:1) (place "Disc2" {"B4"} state:2) (place "Disc2" {"C4"} state:3) (place "Disc2" {"D4"} state:4)}) (play (move Select (from (forEach (sites Occupied by:Mover) if:(> (state at:(site)) ("LastStateRemove")))) (then (and ("StoreStateRemoved") (remove (last To)))))) (end (if (and (no Moves P1) (no Moves P2)) (byScore { (score P1 (- (count Pieces P1))) (score P2 (- (count Pieces P2)))}))))) END |
Describe the mechanics of the following Ludii game
(game "Tsatsarandi" (players 2) (equipment { (board (square 8)) ("ChessPawn" "Pawn") ("ChessRook" "Rook") ("ChessKing" "King_noCross") (piece "Bishop_noCross" (move Hop Diagonal (between if:True) (to if:(or (is Empty (to)) ("IsEnemyAt" (to))) (apply (remove (to)))))) ("ChessKnight" "Knight") (piece "Ferz_noCross" ("StepToNotFriend" Diagonal))}) (rules (start { (place "King_noCross1" coord:"E1") (place "King_noCross2" coord:"E8") (place "Ferz_noCross1" coord:"D1") (place "Ferz_noCross2" coord:"D8") (place "Bishop_noCross1" {"C1" "F1"}) (place "Bishop_noCross2" {"C8" "F8"}) (place "Knight1" {"B1" "G1"}) (place "Knight2" {"B8" "G8"}) (place "Rook1" {"A1" "H1"}) (place "Rook2" {"A8" "H8"}) (place "Pawn1" (sites Row 1)) (place "Pawn2" (sites Row 6))}) (play (do (forEach Piece) ifAfterwards:(not ("IsInCheck" "King_noCross" Mover)))) (end ("Checkmate" "King_noCross"))))
###
| 8x8 board. Pieces have specific moves, as follows: Mai (x1): moves one space in any direction; Chiroma (x1): Moves one space diagonally; Bintu (x2): moves exactly two spaces diagonally, jumping over the first square; Fer (x2): moves orthogonally one space and then diagonally another space, jumping over any intervening pieces; Kaigamma (x2): moves orthogonally any distance; Gollo: (x8) move one space forward orthogonally, or one space diagonally forward to capture. Pieces capture the opponent's pieces by moving onto the spot they occupy. No en passant; no castling. When the Mai can be captured at the beginning of the opponent's next turn, it is in check and must be removed from this state on the player's turn. If this is not possible, it is checkmate and the player who threatened the Mai wins. END |
Construct a Ludii game based on the following description
Play is on a grid of any number of squares. Some of the squares are marked with a number which indicates the number of squares adjacent to it are colored. Player determines which squares are colored and colors them in, revealing a picture.
###
| (game "Fill A Pix" (players 1) (equipment { (board (square 10) (values Cell (range 0 1))) (hints { (hint 1 0) (hint 3 3) (hint 5 3) (hint 7 3) (hint 9 0) (hint 13 6) (hint 16 6) (hint 21 4) (hint 22 5) (hint 23 6) (hint 27 7) (hint 28 5) (hint 30 5) (hint 32 6) (hint 34 8) (hint 35 9) (hint 37 8) (hint 38 5) (hint 40 4) (hint 42 3) (hint 45 8) (hint 46 8) (hint 49 1) (hint 50 2) (hint 54 3) (hint 56 5) (hint 60 0) (hint 63 0) (hint 68 2) (hint 69 1) (hint 75 0) (hint 77 2) (hint 81 0) (hint 84 0) (hint 89 4) (hint 96 1) (hint 96 1) (hint 98 4) (hint 99 4)}) (piece "Square" P1)}) (rules (play (satisfy { (forAll Hint (is Count (sites Around (from) includeSelf:True) of:1 (hint)))})) (end (if (is Solved) (result P1 Win))))) END |
Construct a Ludii game based on the following description
Goal: Score the most points:
-- One point for each stone in one's largest group.
-- Bonus points are also awarded for certain captured stones.
The board starts empty.
Players take alternating turns placing one of their stones onto an empty site.
Directly after placement, every site of the board must remain connected to an empty perimeter site via a continuous path of empty sites, and the stone that was placed must be next to any 2 empty sites.
Capture
After placement, simultaneously remove all the stones adjacent to the placed stone that are no longer next to 2 empty sites.
There is no passing. The game ends when no more placements can be made.
Ties are broken in favor of the underdog by compairing cascading largest groups (excluding tied pairs) Tie breaker scores are negative, so largest group LOSES.
Plateau version (mauve background):
Connection to the edge is by omni-directional steps. Stone groups are orthogonal only.
Players score one point for every stone in their largest group, plus a bonus point for each captured opponent's stone.
The player with the higher score wins.
Floodplain version (green background):
Connection to the edge is by orthogonal steps. Stone groups are omni-directional adjacent.
Players score one point for every stone in their largest group, plus a bonus point for each of their stones that the opponent removed from the board.
The player with the higher score wins. Order 9 board Watershed Plateau: Omni-Square Grid - Orthogonal group scoring, Bonus for opponent's captured, Largest group loses a tie.
###
| (define "ColourBackground" (colour 156 130 126)) (define "ColourBackground2" (colour 156 130 126)) (define "ColourBackground1" (colour 126 130 156)) (define "SquareDiagonal" (board (square 9) use:Vertex)) (define "SquareGrid" (board (square 9) 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 |
Construct a Ludii game based on the following description
Three concentric squares, with lines connecting the corners and the midpoints of the sides. Twelve pieces per player. Players alternate turns placing a piece on an empty spot on the board. When all of the pieces have been 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 from the board. The player who removes all of the opponent's pieces wins.
###
| (game "Xonin Shatar (Simple)" (players 2) (equipment { (board (concentric Square rings:3 joinCorners:True) use:Vertex) (hand Each) (piece "Marker" Each ("StepToEmpty" ~ (then ("ReplayIfLine3"))))}) (rules (start (place "Marker" "Hand" count:12)) phases:{ (phase "Placement" (play (if "SameTurn" ("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
2x12 board, with spaces as points, divided in two. Twelve pieces per player, which start stacked, two per point in the quadrant to the player's right. Two six-sided dice. Players unstack the pieces by moving pieces off of the stack, but remaining on the same point, according to the throws of the dice. The value of the throw indicates the number of the point which can be unstacked. For example, a throw of 1 and 4 allows the player to unstack the pieces on points 1 and 4. Doubles allow players to only move one piece, but grant the player another throw. When all of a player's pieces are unstacked, they must be restacked, in the same way. When they have been successfully restacked, the player then bears off the pieces from this quadrant of the board. When bearing off, players move according to the number on each die by moving one piece the value on one die then another piece the value on the other die, or by moving one piece the value of one die and then the value of the other. The first player to bear off all their pieces wins.
###
| (define "Stack" (forEach Level (last To) (set State at:(last To) level:(level) 0))) (define "Unstack" (forEach Level (last To) (set State at:(last To) level:(level) 1))) (define "PieceStacked" (= (state at:#1) 0)) (define "PieceUnstacked" (= (state at:#1) 1)) (define "RemoveAPiece" (move Remove (from))) (define "SiteToMoveOnTrack" ("NextSiteOnTrack" (pips))) (define "SiteToSelect" ("NextSiteOnTrack" (- (pips) 1) from:(mapEntry "StartTrack" (mover)))) (game "Ofanfelling" (players 2) (equipment { ("BackgammonBoard" { (track "Track1" {7..12} P1 directed:True) (track "Track2" {18..13} P2 directed:True)}) (dice d:6 num:2) (piece "Disc" Each (forEach Die if:("DieNotUsed") (if ("IsOffBoard" "SiteToMoveOnTrack") "RemoveAPiece" (move (from) (to "SiteToMoveOnTrack"))))) (map "StartTrack" {(pair P1 7) (pair P2 18)})}) (rules (start { (place Stack "Disc1" (sites {7..12}) count:2) (place Stack "Disc2" (sites {13..18}) count:2)}) phases:{ (phase "UnStacking" (play (do (if (or (is Pending) ("NewTurn")) (roll)) next: (forEach Die if:("DieNotUsed") (if ("PieceStacked" "SiteToSelect") (move Select (from ("SiteToSelect")) (then (and ("Unstack") ("ReplayNotAllDiceUsed")))))) (then (if (all DiceEqual) (and (set Pending) (moveAgain)))))) (nextPhase Mover (all Sites (sites Occupied by:Mover) if:(not ("PieceStacked" (site)))) "Stacking")) (phase "Stacking" (play (do (if (or (is Pending) ("NewTurn")) (roll)) next: (forEach Die if:("DieNotUsed") (if ("PieceUnstacked" "SiteToSelect") (move Select (from ("SiteToSelect")) (then (and ("Stack") ("ReplayNotAllDiceUsed")))))) (then (if (all DiceEqual) (and (set Pending) (moveAgain)))))) (nextPhase Mover (all Sites (sites Occupied by:Mover) if:(not ("PieceUnstacked" (site)))) "BearingOff")) (phase "BearingOff" (play (do (if (or (all DiceEqual) ("NewTurn")) (roll)) next:(forEach Piece top:True) (then (if (or (not (all DiceUsed)) (all DiceEqual)) (moveAgain))))) (end ("EscapeWin")))})) END |
Modify the Ludii game according to the following option changes:
The game is played on a 4x4 board. -> The game is played on a 5x5 board.
(define "ReachedTarget" (is In (last To) (sites Mover))) (game "Breakback" ("TwoPlayersNorthSouth") (equipment { (board (square 4)) (piece "Pawn" Each (or { "StepForwardToEmpty" (move Step (directions {FR FL}) (to if:(or (is Empty (to)) ("IsEnemyAt" (to))) (apply (remove (to)))))})) (regions P1 (sites Top)) (regions P2 (sites Bottom))}) (rules (start { (place "Pawn1" (expand (sites Bottom))) (place "Pawn2" (expand (sites Top)))}) (play (priority (forEach Piece ("StepBackwardToEmpty")) (forEach Piece))) (end (if "ReachedTarget" (result Mover Win)))))
###
| (define "ReachedTarget" (is In (last To) (sites Mover))) (game "Breakback" ("TwoPlayersNorthSouth") (equipment { (board (square 5)) (piece "Pawn" Each (or { "StepForwardToEmpty" (move Step (directions {FR FL}) (to if:(or (is Empty (to)) ("IsEnemyAt" (to))) (apply (remove (to)))))})) (regions P1 (sites Top)) (regions P2 (sites Bottom))}) (rules (start { (place "Pawn1" (expand (sites Bottom))) (place "Pawn2" (expand (sites Top)))}) (play (priority (forEach Piece ("StepBackwardToEmpty")) (forEach Piece))) (end (if "ReachedTarget" (result Mover Win))))) END |
Construct a Ludii game based on the following description
The player to play the last possible legal move wins the game. The other player loses. Unless, that is, the board is completely full, in which case the game is a tie.
###
| (define "AddPiece" (move Add (piece (id #1 Neutral)) (to (sites Empty) if:(and { (all Sites (sites Row (row of:(to))) if:(!= (id #1 Neutral) (what at:(site)))) (all Sites (sites Column (column of:(to))) if:(!= (id #1 Neutral) (what at:(site)))) ("CheckLineRightSubGame" #1)})))) (define "CheckLineRightSubGame" (if (is In (to) (sites "Square0")) (all Sites (sites "Square0") if:(!= (id #1 Neutral) (what at:(site)))) (if (is In (to) (sites "Square1")) (all Sites (sites "Square1") if:(!= (id #1 Neutral) (what at:(site)))) (if (is In (to) (sites "Square2")) (all Sites (sites "Square2") if:(!= (id #1 Neutral) (what at:(site)))) (if (is In (to) (sites "Square3")) (all Sites (sites "Square3") if:(!= (id #1 Neutral) (what at:(site)))) (if (is In (to) (sites "Square4")) (all Sites (sites "Square4") if:(!= (id #1 Neutral) (what at:(site)))) (if (is In (to) (sites "Square5")) (all Sites (sites "Square5") if:(!= (id #1 Neutral) (what at:(site)))) (if (is In (to) (sites "Square6")) (all Sites (sites "Square6") if:(!= (id #1 Neutral) (what at:(site)))) (if (is In (to) (sites "Square7")) (all Sites (sites "Square7") if:(!= (id #1 Neutral) (what at:(site)))) (all Sites (sites "Square8") if:(!= (id #1 Neutral) (what at:(site))))))))))))) (game "Duidoku" (players 2) (equipment { (board (square 9)) (piece "1" Neutral) (piece "2" Neutral) (piece "3" Neutral) (piece "4" Neutral) (piece "5" Neutral) (piece "6" Neutral) (piece "7" Neutral) (piece "8" Neutral) (piece "9" Neutral) (regions "Square0" (sites { 0..2 9..11 18..20})) (regions "Square1" (sites { 3..5 12..14 21..23})) (regions "Square2" (sites { 6..8 15..17 24..26})) (regions "Square3" (sites {27..29 36..38 45..47})) (regions "Square4" (sites {30..32 39..41 48..50})) (regions "Square5" (sites {33..35 42..44 51..53})) (regions "Square6" (sites {54..56 63..65 72..74})) (regions "Square7" (sites {57..59 66..68 75..77})) (regions "Square8" (sites {60..62 69..71 78..80}))}) (rules (play (or { ("AddPiece" "1") ("AddPiece" "2") ("AddPiece" "3") ("AddPiece" "4") ("AddPiece" "5") ("AddPiece" "6") ("AddPiece" "7") ("AddPiece" "8") ("AddPiece" "9")})) (end { (if (all Sites (sites Board) if:(is Occupied (site))) (result Mover Draw)) ("BlockWin")}))) END |
Construct a Ludii game based on the following description
5x5 intersecting lines, with diagonals in the quadrants. Five pieces per player. Players alternate turns placing a piece on the board. Once all of the pieces are placed on the board, players alternate turns moving a piece to an empty adjacent spot on the board. The player who places all five of their pieces in a line wins.
###
| (game "Marelle Quadruple" (players 2) (equipment { ("AlquerqueBoard" 5 5) (hand Each) (piece "Marker" Each "StepToEmpty")}) (rules (start (place "Marker" "Hand" count:5)) phases:{ (phase "Placement" (play (move (from (handSite Mover)) (to (sites Empty)))) (nextPhase ("HandEmpty" P2) "Movement")) ("PhaseMovePiece" "Movement")} (end (if (is Line 5) (result Mover Win))))) END |
Modify the Ludii game according to the following option changes:
The game has 3 players. -> The game has 4 players.
(define "MadeACompleteCircuit" (if (= 1 (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" (count Pips)) (game "Kawasukuts" (players 3) (equipment { ("FortyStonesWithFourGapsBoard" { (track "TrackCW" {39 35 33 31 29 27 25 23 21 19 38 17 15 13 11 9 7 5 3 1 37 0 2 4 6 8 10 12 14 16 36 18 20 22 24 26 28 30 32 34} loop:True) (track "TrackCCW" {39 34 32 30 28 26 24 22 20 18 36 16 14 12 10 8 6 4 2 0 37 1 3 5 7 9 11 13 15 17 38 19 21 23 25 27 29 31 33 35} loop:True)}) (regions "Gates" (sites {36..39})) (piece "Marker" Each (if ("IsOffBoard" (value Player Mover)) (or ("MoveOn" ("SiteToMoveOnTrackCW") ("RememberSelectedTrack" ("SelectCW"))) ("MoveOn" ("SiteToMoveOnTrackCCW") ("RememberSelectedTrack" ("SelectCCW")))) ("MoveOn" "SiteToMoveOnSelectedTrack"))) (dice d:2 facesByDie:{{0 2} {0 3} {0 10}} num:3) (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 (and (!= 0 ("ThrowValue")) ("MadeACompleteCircuit")) (result Mover Win))))}))
###
| (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" (count Pips)) (game "Kawasukuts" (players 4) (equipment { ("FortyStonesWithFourGapsBoard" { (track "TrackCW" {39 35 33 31 29 27 25 23 21 19 38 17 15 13 11 9 7 5 3 1 37 0 2 4 6 8 10 12 14 16 36 18 20 22 24 26 28 30 32 34} loop:True) (track "TrackCCW" {39 34 32 30 28 26 24 22 20 18 36 16 14 12 10 8 6 4 2 0 37 1 3 5 7 9 11 13 15 17 38 19 21 23 25 27 29 31 33 35} loop:True)}) (regions "Gates" (sites {36..39})) (piece "Marker" Each (if ("IsOffBoard" (value Player Mover)) (or ("MoveOn" ("SiteToMoveOnTrackCW") ("RememberSelectedTrack" ("SelectCW"))) ("MoveOn" ("SiteToMoveOnTrackCCW") ("RememberSelectedTrack" ("SelectCCW")))) ("MoveOn" "SiteToMoveOnSelectedTrack"))) (dice d:2 facesByDie:{{0 2} {0 3} {0 10}} num:3) (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 (and (!= 0 ("ThrowValue")) ("MadeACompleteCircuit")) (result Mover Win))))})) END |
Construct a Ludii game based on the following description
Players alternate moving their pieces forward or backward diagonally. A piece may also jump over one adjacent piece of the opponent diagonally forward. This does not capture the opponent's piece. Jumps are compulsory. A player cannot block the other player's pieces such that he or she cannot perform a legal move. The player that can first bring each of their pieces seven rows forward is the winner. The pieces must retain their original order in each row.
###
| (define "GoalOfP2Filled" (and { ("IsPieceAt" "Salta1Star" P2 (coord "A1")) ("IsPieceAt" "Salta2Star" P2 (coord "C1")) ("IsPieceAt" "Salta3Star" P2 (coord "E1")) ("IsPieceAt" "Salta4Star" P2 (coord "G1")) ("IsPieceAt" "Salta5Star" P2 (coord "I1")) ("IsPieceAt" "Salta1Moon" P2 (coord "B2")) ("IsPieceAt" "Salta2Moon" P2 (coord "D2")) ("IsPieceAt" "Salta3Moon" P2 (coord "F2")) ("IsPieceAt" "Salta4Moon" P2 (coord "H2")) ("IsPieceAt" "Salta5Moon" P2 (coord "J2")) ("IsPieceAt" "Salta1Dot" P2 (coord "A3")) ("IsPieceAt" "Salta2Dot" P2 (coord "C3")) ("IsPieceAt" "Salta3Dot" P2 (coord "E3")) ("IsPieceAt" "Salta4Dot" P2 (coord "G3")) ("IsPieceAt" "Salta5Dot" P2 (coord "I3"))})) (define "GoalOfP1Filled" (and { ("IsPieceAt" "Salta1Star" P1 (coord "J10")) ("IsPieceAt" "Salta2Star" P1 (coord "H10")) ("IsPieceAt" "Salta3Star" P1 (coord "F10")) ("IsPieceAt" "Salta4Star" P1 (coord "D10")) ("IsPieceAt" "Salta5Star" P1 (coord "B10")) ("IsPieceAt" "Salta1Moon" P1 (coord "I9")) ("IsPieceAt" "Salta2Moon" P1 (coord "G9")) ("IsPieceAt" "Salta3Moon" P1 (coord "E9")) ("IsPieceAt" "Salta4Moon" P1 (coord "C9")) ("IsPieceAt" "Salta5Moon" P1 (coord "A9")) ("IsPieceAt" "Salta1Dot" P1 (coord "J8")) ("IsPieceAt" "Salta2Dot" P1 (coord "H8")) ("IsPieceAt" "Salta3Dot" P1 (coord "F8")) ("IsPieceAt" "Salta4Dot" P1 (coord "D8")) ("IsPieceAt" "Salta5Dot" P1 (coord "B8"))})) (define "HopSequence" ("Hop" #1 (then (if (can Move ("Hop" (last To))) (moveAgain))))) (define "Hop" (move Hop (from #1) Diagonal (between if:("IsEnemyAt" (between))) (to if:("IsEmptyAndNotVisited" (to))) #2)) (game "Salta" (players 2) (equipment { (board (square 10)) (piece "Salta1Dot" Each) (piece "Salta2Dot" Each) (piece "Salta3Dot" Each) (piece "Salta4Dot" Each) (piece "Salta5Dot" Each) (piece "Salta1Moon" Each) (piece "Salta2Moon" Each) (piece "Salta3Moon" Each) (piece "Salta4Moon" Each) (piece "Salta5Moon" Each) (piece "Salta1Star" Each) (piece "Salta2Star" Each) (piece "Salta3Star" Each) (piece "Salta4Star" Each) (piece "Salta5Star" Each)}) (rules (start { (place "Salta1Star1" coord:"A1") (place "Salta2Star1" coord:"C1") (place "Salta3Star1" coord:"E1") (place "Salta4Star1" coord:"G1") (place "Salta5Star1" coord:"I1") (place "Salta1Moon1" coord:"B2") (place "Salta2Moon1" coord:"D2") (place "Salta3Moon1" coord:"F2") (place "Salta4Moon1" coord:"H2") (place "Salta5Moon1" coord:"J2") (place "Salta1Dot1" coord:"A3") (place "Salta2Dot1" coord:"C3") (place "Salta3Dot1" coord:"E3") (place "Salta4Dot1" coord:"G3") (place "Salta5Dot1" coord:"I3") (place "Salta1Star2" coord:"J10") (place "Salta2Star2" coord:"H10") (place "Salta3Star2" coord:"F10") (place "Salta4Star2" coord:"D10") (place "Salta5Star2" coord:"B10") (place "Salta1Moon2" coord:"I9") (place "Salta2Moon2" coord:"G9") (place "Salta3Moon2" coord:"E9") (place "Salta4Moon2" coord:"C9") (place "Salta5Moon2" coord:"A9") (place "Salta1Dot2" coord:"J8") (place "Salta2Dot2" coord:"H8") (place "Salta3Dot2" coord:"F8") (place "Salta4Dot2" coord:"D8") (place "Salta5Dot2" coord:"B8")}) (play (if "SameTurn" ("HopSequence" (last To)) (priority { (forEach Piece ("HopSequence" (from))) (forEach Piece "StepDiagonalToEmpty")}))) (end { (if "GoalOfP1Filled" (result P1 Win)) (if "GoalOfP2Filled" (result P2 Win))}))) END |
Construct a Ludii game based on the following description
Each player has four pieces.
Players take turns moving a piece to an empty dot.
A player may capture an opponent’s piece by placing a piece on either side of an opponent’s piece. If a player moves their own piece between two of the opponent’s pieces, it is not captured.
A player wins by reducing the opponent to one piece.
The game is played according to the rules of the source.
###
| (game "Boseog Gonu" (players 2) (equipment { (board (remove (merge { (rectangle 3 3 diagonals:Alternating) (shift 0 -1 (rotate 180 (wedge 2))) (shift 0 2 (wedge 2)) (shift -1.5 0.5 (rotate 90 (wedge 2))) (shift 1.5 0.5 (rotate -90 (wedge 2)))}) edges:{ {{1 1} {0 0}} {{1 1} {2 2}} {{1 1} {2 0}} {{1 1} {0 2}}}) use:Vertex) (piece "Disc" Each ("StepToEmpty" ~ (then (custodial (from (last To)) (between (max 1) if:("IsEnemyAt" (between)) (apply (remove (between)))) (to if:(= (what at:(to)) (what at:(last To))))))))}) (rules (start { (place "Disc1" {"A3" "B3" "B4" "B2"}) (place "Disc2" {"D2" "D3" "E3" "D4"})}) (play (forEach Piece)) (end ("HavingLessPiecesLoss" Next 1)))) END |
Construct a Ludii game based on the following description
8x8 board. One player plays as one Shah, which can move like any of the other pieces. The other player has the usual complement of pieces, as in Chess. Pawns (x8): can move one space forward and capture one space forward diagonally; Rook (x2): can move any number of spaces orthogonally; Elephant (x2): can move any number of spaces diagonally; Horse (2): moves in any direction, one space orthogonally with one space forward diagonally; Vizier (x1): can move any number of spaces orthogonally or diagonally; Shah (x1): can move one space orthogonally or diagonally, but can also move like the horse on its first move, if it has not yet been checked. The pieces are arranged as in Chess, with the Vizier is place to the left of the Shah. Players capture pieces by moving onto a space occupied by an opponent's piece. When a pawn reaches the opposite edge of the board from where it started, it may be promoted to the more powerful piece that begins the game in that position, but only if one of these belonging to the player has already been captured. If this has not happened, the pawn cannot move to the final row. When a player can capture the opponent's Shah on the next turn, the Shah is in check, the opponent's next move must free the Shah from check. If the opponent cannot, it is checkmate and the player wins.
###
| (define "PromotedPiece" (if (and (is In (last To) (sites Corners)) (!= 2 (count Pieces Mover "Boat"))) (id "Boat" Mover) (if (and (or (= (column of:(last To)) 1) (= (column of:(last To)) 6)) (!= 2 (count Pieces Mover "Knight"))) (id "Knight" Mover) (if (and (or (= (column of:(last To)) 2) (= (column of:(last To)) 5)) (!= 2 (count Pieces Mover "Elephant"))) (id "Elephant" Mover) (if (and (= (column of:(last To)) 3) (!= 1 (count Pieces Mover "Queen"))) (id "Queen" Mover) Undefined))))) (define "RememberPieceHasMoved" (then (if (= (state at:(last To)) 1) "PieceHasMoved"))) (define "PieceHasMoved" (set State at:(last To) 0)) (define "HasNeverMoved" (= (state at:#1) 1)) (define "NextCanNotMoveToProtect" (not (can Move (do (forEach Piece Next) ifAfterwards:(not ("IsInCheck" #1 Next)))))) (game "Shatranj Diwana Shah" (players 2) (equipment { (board (square 8)) (piece "Pawn" P2 S (do (or { "StepForwardToEmpty" ("StepToEnemy" (directions {FR FL}))}) ifAfterwards:(if (is In (last To) (sites Mover "Promotion")) (!= Undefined ("PromotedPiece")) True) (then ("PromoteIfReach" (sites Mover "Promotion") "PromotedPiece")))) (piece "Boat" P2 ("SlideCapture" Orthogonal)) (piece "King_noCross" Each (if (is Mover P1) (or ("LeapCapture" "KnightWalk") ("SlideCapture")) (or ("StepToNotFriend") (if ("HasNeverMoved" (from)) ("LeapCapture" "KnightWalk")) "RememberPieceHasMoved"))) (piece "Elephant" P2 ("SlideCapture" Diagonal)) (piece "Knight" P2 ("LeapCapture" "KnightWalk")) (piece "Queen" P2 ("SlideCapture")) (regions "Promotion" P2 (sites Bottom))}) (rules (start { (place "Pawn2" (sites Row 6)) (place "King_noCross1" coord:"D1") (place "Boat2" {"A8" "H8"}) (place "Knight2" {"B8" "G8"}) (place "Elephant2" {"C8" "F8"}) (place "Queen2" coord:"D8") (place "King_noCross2" coord:"E8" state:1)}) (play (do (forEach Piece) ifAfterwards:(not ("IsInCheck" "King_noCross" Mover)) (then (if (and ("IsPieceAt" "King_noCross" P1 (last To)) ("HasNeverMoved" (where "King_noCross" P2))) (if ("IsInCheck" "King_noCross" P2) (set State at:(where "King_noCross" P2) 0)))))) (end (if (and ("IsInCheck" "King_noCross" Next) ("NextCanNotMoveToProtect" "King_noCross")) (result Mover Win))))) END |
Construct a Ludii game based on the following description
In the game, played on a grid of any size, two players move their pieces simultaneously, which leave a trail behind them. The first player to run into one of the trails or the edge of the board loses.
###
| (game "Tron" (players 2) (equipment { (board (square 10)) (piece "King" Each (move Step Orthogonal (to (apply (if (is Occupied (to)) (trigger "Collision" (mover))))) (then (add (piece (id "Square" Mover)) (to (last From)))))) (piece "Square" Each)}) (rules (start { (place "King1" coord:"E5") (place "King2" coord:"F6")}) (play (forEach Piece)) (end (if (is Triggered "Collision" Mover) (result Next Win))))) END |
Modify the Ludii game according to the following option changes:
The game involves 2 players. -> The game involves 3 players.
The track is composed of 20 spaces -> The track is composed of 25 spaces
(define "SetHyenaPlayer" (and (add (piece "Hyena") (to 0) stack:True) (set Var (id Mover)))) (define "HyenaPlayer" (var)) (define "SiteHyenaToMove" ("SiteToMoveOnTrack" from:(where "Hyena" Shared) (* 2 ("ThrowValue")))) (define "SiteToMove" (if (= (from) (handSite Mover)) ("SiteToMoveOnTrack" from:0 (- ("ThrowValue") 1)) ("SiteToMoveOnTrack" from:(from) ("ThrowValue")))) (define "SiteToMoveOnTrack" ("NextSiteOnTrack" #2 #1)) (define "ThrowValue" (mapEntry "Throw" (count Pips))) (game "Nama" (players 2) (equipment { (board (rectangle 20 1) (track "Track" {0..19} directed:True)) (hand Each) (hand Shared) (piece "Marker" Each (if ("IsOffBoard" ("SiteToMove")) (move Remove (from) level:(level) (then (if ("IsOffBoard" (where "Hyena" Shared)) ("SetHyenaPlayer")))) (move (from (from) level:(level)) (to ("SiteToMove")) stack:True))) (piece "Hyena" Shared) ("StickDice" 4) (map "Throw" {(pair 0 0) (pair 1 0) (pair 2 2) (pair 3 0) (pair 4 20)})}) (rules (start (place "Marker" "Hand")) (play ("RollMove" (if (< 0 ("ThrowValue")) (if (= ("HyenaPlayer") (id Mover)) (if ("IsOffBoard" ("SiteHyenaToMove")) (move Remove (where "Hyena" Shared) (then (forEach Site (sites Board) (if (is Occupied (site)) (remove (site) count:(size Stack at:(site))))))) (move (from (where "Hyena" Shared)) (to ("SiteHyenaToMove")) (then (forEach Value min:1 max:(- (* 2 ("ThrowValue")) 1) (if (is Occupied ("SiteToMoveOnTrack" from:(last From) (value))) (remove ("SiteToMoveOnTrack" from:(last From) (value)) count:(size Stack at:("SiteToMoveOnTrack" from:(last From) (value))))))))) (or (forEach Piece) (forEach Piece container:(mover))))))) (end { (forEach Player if:(and { (> ("HyenaPlayer") 0) (!= (player) ("HyenaPlayer")) ("IsOffBoard" (where "Hyena" Shared))}) (result Player Loss)) (if (and (= (id Mover) ("HyenaPlayer")) ("IsOffBoard" (where "Hyena" Shared))) (result Mover Win)) (forEach Player if:(and (!= (player) ("HyenaPlayer")) (no Pieces of:(player))) (result Player Loss))})))
###
| (define "SetHyenaPlayer" (and (add (piece "Hyena") (to 0) stack:True) (set Var (id Mover)))) (define "HyenaPlayer" (var)) (define "SiteHyenaToMove" ("SiteToMoveOnTrack" from:(where "Hyena" Shared) (* 2 ("ThrowValue")))) (define "SiteToMove" (if (= (from) (handSite Mover)) ("SiteToMoveOnTrack" from:0 (- ("ThrowValue") 1)) ("SiteToMoveOnTrack" from:(from) ("ThrowValue")))) (define "SiteToMoveOnTrack" ("NextSiteOnTrack" #2 #1)) (define "ThrowValue" (mapEntry "Throw" (count Pips))) (game "Nama" (players 3) (equipment { (board (rectangle 25 1) (track "Track" {0..24} directed:True)) (hand Each) (hand Shared) (piece "Marker" Each (if ("IsOffBoard" ("SiteToMove")) (move Remove (from) level:(level) (then (if ("IsOffBoard" (where "Hyena" Shared)) ("SetHyenaPlayer")))) (move (from (from) level:(level)) (to ("SiteToMove")) stack:True))) (piece "Hyena" Shared) ("StickDice" 4) (map "Throw" {(pair 0 0) (pair 1 0) (pair 2 2) (pair 3 0) (pair 4 20)})}) (rules (start (place "Marker" "Hand")) (play ("RollMove" (if (< 0 ("ThrowValue")) (if (= ("HyenaPlayer") (id Mover)) (if ("IsOffBoard" ("SiteHyenaToMove")) (move Remove (where "Hyena" Shared) (then (forEach Site (sites Board) (if (is Occupied (site)) (remove (site) count:(size Stack at:(site))))))) (move (from (where "Hyena" Shared)) (to ("SiteHyenaToMove")) (then (forEach Value min:1 max:(- (* 2 ("ThrowValue")) 1) (if (is Occupied ("SiteToMoveOnTrack" from:(last From) (value))) (remove ("SiteToMoveOnTrack" from:(last From) (value)) count:(size Stack at:("SiteToMoveOnTrack" from:(last From) (value))))))))) (or (forEach Piece) (forEach Piece container:(mover))))))) (end { (forEach Player if:(and { (> ("HyenaPlayer") 0) (!= (player) ("HyenaPlayer")) ("IsOffBoard" (where "Hyena" Shared))}) (result Player Loss)) (if (and (= (id Mover) ("HyenaPlayer")) ("IsOffBoard" (where "Hyena" Shared))) (result Mover Win)) (forEach Player if:(and (!= (player) ("HyenaPlayer")) (no Pieces of:(player))) (result Player Loss))}))) END |
Construct a Ludii game based on the following description
7x7 lines, forming a grid. 21 pieces per player. The pieces begin on the three rows closest to the player. Pieces move forward orthogonally or sideways, never backwards. A piece may capture an adjacent opponent's piece by hopping over it to an empty adjacent spot immediately on the opposite side of it along the lines of the board. Multiple captures are allowed. Captures can only be made in the forward orthogonal or sideways directions also. The player who captures all of their opponent's pieces or who blocks them from being able to move wins.
###
| (game "Tablo" ("TwoPlayersNorthSouth") (equipment { (board (square 7) use:Vertex) (piece "Marker" Each (or { ("StepToEmpty" (directions {Forward Rightward Leftward})) ("HopCapture" ~ (directions {Forward Rightward Leftward}) (then ("ReplayIfCanMove" ("HopCapture" (from (last To)) (directions {Forward Rightward Leftward})))))}))}) (rules (start { (place "Marker1" (expand (sites Bottom) steps:2)) (place "Marker2" (expand (sites Top) steps:2))}) (play (if ("SameTurn") (and ("HopCapture" (from (last To)) (directions {Forward Rightward Leftward}) (then ("ReplayIfCanMove" (("HopCapture" (from (last To)) (directions {Forward Rightward Leftward})))))) (move Pass)) (forEach Piece))) (end ("BlockWin")))) END |
Describe the mechanics of the following Ludii game
(define "UpdateCounterDoublePlay" (if (< (value Player Mover) (- (/ (count Pips) 2) 1)) (and (moveAgain) (if (< (value Player Mover) 0) (set Value Mover 1) (set Value Mover (+ 1 (value Player Mover))))) (set Value Mover 0))) (define "SetScoreOf" (score #1 (if (is Mover #1) (if (= ("NumPiece" #2) 15) 2 1) 0))) (define "NumPiece" (size Stack in:(sites Occupied by:#1))) (define "Bar" (mapEntry #1)) (define "AllPieceInOpponentSide" ("AllOwnedPiecesIn" (sites Mover "OppositeQuadrant"))) (define "NumSitesInFirstQuadrantWithMoreThan2Pieces" (count Sites in:(forEach (intersection (sites Occupied by:Mover) (sites Mover "Home")) if:(>= (size Stack at:(site)) 2)))) (define "PieceInOpponentQuadrantOrNoPieceInTheBoard" (or { (all Sites (difference (sites Board) "StartPos") if:(!= (who at:(site)) (mover))) (is Occupied ("Bar" (mover))) (< (size Stack at:("StartPos")) 14) (not (all Sites (sites Mover "OppositeQuadrant") if:(!= (who at:(site)) (mover))))})) (define "CanEscape" ("IsOffBoard" #1)) (define "AllPieceEscaped" (no Pieces Mover)) (define "RemoveAPiece" (move Remove (site))) (define "NextSiteFromDistDoubleDice" ("NextSiteOnTrack" (/ (count Pips) 2) from:#1)) (define "StartPos" ("NextSiteOnTrack" 1 from:("Bar" (mover)))) (define "NextSiteFrom" ("NextSiteOnTrack" (pips) from:#1)) (game "Jacquet de Versailles" (players 2) (equipment { ("BackgammonBoard" "BackgammonTracksSameDirectionOppositeCornersWithBars") (dice num:2) (piece "Disc" Each) (map {(pair 1 6) (pair 2 19)}) (regions "Home" P1 { 13..18}) (regions "Home" P2 { 12..7}) (regions "OppositeQuadrant" P1 { 0..5}) (regions "OppositeQuadrant" P2 { 20..25})}) (rules (start { (place Stack "Disc1" 13 count:15) (place Stack "Disc2" 12 count:15)}) (play (do ("RollEachNewTurnMove" (if (all DiceEqual) (forEach Site (sites Occupied by:Mover) (if (and ("CanEscape" ("NextSiteFromDistDoubleDice" (site))) ("AllPieceInOpponentSide")) ("RemoveAPiece") (if (or (!= (site) "StartPos") (and (= (site) "StartPos") ("PieceInOpponentQuadrantOrNoPieceInTheBoard"))) (move (from (site)) (to ("NextSiteFromDistDoubleDice" (site)) if:("NoEnemyOrOnlyOne" (to)) ("HittingCapture" ("Bar" (next))))))) (then ("UpdateCounterDoublePlay"))) (forEach Die if:("DieNotUsed") (forEach Site (sites Occupied by:Mover) (if (and ("CanEscape" ("NextSiteFrom" (site))) ("AllPieceInOpponentSide")) ("RemoveAPiece") (if (or (!= (site) "StartPos") (and (= (site) "StartPos") ("PieceInOpponentQuadrantOrNoPieceInTheBoard"))) (move (from (site)) (to ("NextSiteFrom" (site)) if:("NoEnemyOrOnlyOne" (to)) ("HittingCapture" ("Bar" (next)))))))) (then ("ReplayNotAllDiceUsed"))))) ifAfterwards:(<= ("NumSitesInFirstQuadrantWithMoreThan2Pieces") 2))) (end { (if ("AllPieceEscaped") (byScore { ("SetScoreOf" P1 P2) ("SetScoreOf" P2 P1)}))})))
###
| 2x12 board, divided in half, where the spaces are rendered as points. Fifteen pieces per player. Pieces begin on the leftmost point on their opponent's side of the board. 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. When doubles are thrown, the player may move the value of one of the die (n), n times (e.g., double sixes allows a player to move 6 six times, double twos allow a player to move 2 twice). Each player progresses in a clockwise direction around the board, to bear off upon reaching the final point on the opposite side of the board from which the player started. This first piece must reach the opposite quadrant of the board from where it started before the player may enter any other pieces. In the quadrant where the players enter their pieces, that player may only have two or more pieces on a point on a maximum of two points. When a piece lands on a point occupied by a single opponent's piece, The opponent's piece is removed from the board and must enter the board again. When all of the player's pieces have entered the opposite quadrant from the one in which they entered, they may begin to bear off. The first player to bear off all their pieces wins. It is considered a double win if the player bears off all their pieces before the opponent bears off any. END |
Construct a Ludii game based on the following description
Tumbleweed is played with stackable tokens on a hexhex board.
A stack is said to be seen from a hex when they are connected by a straight line, with no stacks in between.
The players take turns settling hexes by placing a stack of their tokens on a hex of their choice. The height of a new stack is equal to the number of friendly stacks seen from the settled hex. Removing a stack occupying a hex and re-settling it with a new stack is possible, only as long as the new stack is taller than the previous one. This works with opponent stacks (to capture), or your own stacks (to reinforce).
The board is initially empty, except for a central neutral (blue) two-stack. The first player sets up initial one-stacks: White and Red. The second player then chooses which side he wants to play, by clicking on a stone. Red goes first.
The game ends when no more moves can be made by either player, or after two successive passes. The player who occupies over half the board wins. The program automatically scores indirectly controlled territory. Played on a size 8 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 8)) (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 |
Describe the mechanics of the following Ludii game
(define "CapturedPiecesFollowCapturingPiece" (forEach Level (last From) FromTop (if ("CapturedPiece" (state at:(last From) level:(level))) (fromTo (from (last From) level:(level)) (to (last To)))))) (define "CapturedPiecesFollowCapturingPiece" (forEach Level (last From) FromTop (if ("CapturedPiece" (state at:(last From) level:(level))) (fromTo (from (last From) level:(level)) (to (last To)))))) (define "RebirthCapturingPiece" (add (piece (id "Marker" Mover)) (to (handSite Mover)))) (define "RemoveCapturedPieces" (forEach Level (last From) FromTop (if ("CapturedPiece" (state at:(last From) level:(level))) (remove (last From) level:(level))))) (define "EnterAPiece" (move (from (handSite Mover)) (to ("NextSiteOnTrack" (- "ThrowValue" 1) from:("EntryPoint" (mover)) "Track")))) (define "FreePiece" (= 0 #1)) (define "CapturedPiece" (= 2 #1)) (define "CapturingPiece" (= 1 #1)) (define "CaptureMove" (forEach Level (last To) FromTop (and (if (is Enemy (who at:(last To) level:(level))) ("SetCapturePiece" at:(last To) level:(level))) (if (is Friend (who at:(last To) level:(level))) ("SetCapturingPiece" at:(last To) level:(level)))))) (define "AtLeastAnEnemyPieceThere" (is In #1 (sites Occupied by:Enemy top:False))) (define "UnsetCapturingPieces" (forEach Level (last From) FromTop (if (is Friend (who at:(last From) level:(level))) ("UnsetCapturingPiece" at:(last From) level:(level))))) (define "UnsetCapturingPiece" (set State #1 #2 0)) (define "SetCapturingPiece" (set State #1 #2 1)) (define "SetCapturePiece" (set State #1 #2 2)) (define "EntryPoint" (mapEntry "Entry" (mover))) (define "ThrowValue" (mapEntry "Throw" (count Pips))) (game "Puluc" (players 2) (equipment { (board (rectangle 1 10) { (track "Track1" {0..8} loop:True P1) (track "Track2" {8..0} loop:True P2) (track "CaptureTrack1" {8..0} P1 directed:True) (track "CaptureTrack2" {0..8} P2 directed:True)} use:Edge) (piece "Marker" Each (or (if ("FreePiece" (state at:(from) level:(level))) (move (from (from) level:(level)) (to ("NextSiteOnTrack" ("ThrowValue") from:(from) "Track")) (then (if ("AtLeastAnEnemyPieceThere" (last To)) ("CaptureMove"))))) (if ("CapturingPiece" (state at:(from) level:(level))) (if ("IsNotOffBoard" ("NextSiteOnTrack" ("ThrowValue") from:(from) "CaptureTrack")) (move (from (from) level:(level)) (to ("NextSiteOnTrack" ("ThrowValue") from:(from) "CaptureTrack")) (then (and ("CapturedPiecesFollowCapturingPiece") ("UnsetCapturingPieces")))) (move Remove (from) level:(level) (then (and { ("UnsetCapturingPieces") ("RemoveCapturedPieces") ("RebirthCapturingPiece")}))))))) (regions "AllSites" (sites Board Vertex)) (map "Throw" {(pair 0 5) (pair 1 3) (pair 2 2) (pair 3 3) (pair 4 4)}) (map "Entry" { (pair 1 0) (pair 2 8)}) ("StickDice" 4) (hand Each)}) (rules (start { (place Stack "Marker1" (handSite P1) count:5) (place Stack "Marker2" (handSite P2) count:5)}) (play ("RollMove" (or { (if (is Occupied (handSite Mover)) ("EnterAPiece")) (forEach Piece)}) (then (if ("NewTurn") (moveAgain))))) (end { ("CaptureAll" P2) ("CaptureAll" P1)})))
###
| Ten corn kernels are placed in a line; the spaces between the kernels are the playing spaces. Four kernels of corn are used as dice, blackened on one side. The throws are as follows: Two of the same side up = 2, three of the same side up = 3; four black sides up = 4; four unblackened sides up = 5. Five pieces per player. Players take turns moving pieces according to the throws of the corn, with two throws per turn. When a player reaches the opposite end of the board, they move to the start and continue moving in the same direction. If a piece lands on a space occupied by an opponent's piece, the player then moves in the reverse direction, carrying the opponent's piece with it in an attempt to move past the starting points and off the board. Upon moving off the board, the opponent's piece is captured. The player then enters their piece again on their next turn. However, if the opponent lands on a piece carrying one of their pieces away, they then start carrying both of those pieces back to their starting point, freeing the captured piece and capturing the other player's piece. The player who captures all of the opponent's pieces wins. END |
Modify the Ludii game according to the following option changes:
A size 8 board is currently selected -> A size 7 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 8)) (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:(- 8 1) NNW)) (place "Disc1" (sites Around (centrePoint) distance:(- 8 1) E)) (place "Disc1" (sites Around (centrePoint) distance:(- 8 1) SSW)) (place "Disc2" (sites Around (centrePoint) distance:(- 8 1) NNE)) (place "Disc2" (sites Around (centrePoint) distance:(- 8 1) W)) (place "Disc2" (sites Around (centrePoint) distance:(- 8 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)))))
###
| (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 7)) (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:(- 7 1) NNW)) (place "Disc1" (sites Around (centrePoint) distance:(- 7 1) E)) (place "Disc1" (sites Around (centrePoint) distance:(- 7 1) SSW)) (place "Disc2" (sites Around (centrePoint) distance:(- 7 1) NNE)) (place "Disc2" (sites Around (centrePoint) distance:(- 7 1) W)) (place "Disc2" (sites Around (centrePoint) distance:(- 7 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 |
Modify the Ludii game according to the following option changes:
The game starts with 5 pieces by player. -> The game starts with 7 pieces by player.
(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:5)) 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))))
###
| (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:7)) 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
14x14 board. 28 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; Shahzada: moves diagonally or orthogonally any distance; Wazir: moves diagonally or orthogonally any distance; Raja: moves one space in any direction; Rani: moves one square in any direction; Fil, Ratha, Dahja, Ghora, Rukh. In the second row are fourteen 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 Raja can be captured on the opponent's next turn, it is in check. The Raja 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 (14x14)" (players 2) (equipment { (board (square 14)) ("ChessPawn" "Pawn") ("ChessRook" "Rook") ("ChessRook" "Commoner") ("ChessRook" "Wazir") ("ChessKing" "King_noCross") ("ChessKing" "Mann") ("ChessBishop" "Bishop_noCross") ("ChessKnight" "Knight") ("ChessQueen" "Queen") ("ChessQueen" "Amazon")}) (rules (start { (place "Pawn1" (sites Row 1)) (place "Pawn2" (sites Row 12)) (place "Rook1" {"A1" "N1"}) (place "Knight1" {"B1" "M1"}) (place "Commoner1" {"C1" "L1"}) (place "Wazir1" {"D1" "K1"}) (place "Bishop_noCross1" {"E1" "J1"}) (place "Amazon1" coord:"F1") (place "Queen1" coord:"G1") (place "King_noCross1" coord:"H1") (place "Mann1" coord:"I1") (place "Rook2" {"A14" "N14"}) (place "Knight2" {"B14" "M14"}) (place "Commoner2" {"C14" "L14"}) (place "Wazir2" {"D14" "K14"}) (place "Bishop_noCross2" {"E14" "J14"}) (place "Amazon2" coord:"I14") (place "Queen2" coord:"H14") (place "King_noCross2" coord:"G14") (place "Mann2" coord:"F14")}) (play (do (forEach Piece) ifAfterwards:(not ("IsInCheck" "King_noCross" Mover)))) (end ("Checkmate" "King_noCross")))) END |
Describe the mechanics of the following Ludii game
(define "CombinedGroupCounts" ( + { (* 10000 (count Groups Orthogonal #1)) (* 100 (- (count Groups Orthogonal #1) (count Groups Orthogonal #1 min:3))) (- (- (count Groups Orthogonal #1) (count Groups Orthogonal #1 min:5)) (- (count Groups Orthogonal #1) (count Groups Orthogonal #1 min:3)))})) (game "Hermit" (players 2) (equipment { (board (tri Hexagon 5) use:Vertex) (piece "Marker" Each) (piece "Marker" Neutral)}) (rules (start { (set Score P1 0) (set Score P2 0)}) (play (do (move Add (to (sites Empty))) ifAfterwards: (or { (= 1 (size Group at:(last To) Orthogonal)) (= 3 (size Group at:(last To) Orthogonal)) (= 5 (size Group at:(last To) Orthogonal))}) (then (addScore Mover (- ("CombinedGroupCounts" if:(= (who at:(to)) (mover))) (score Mover)))))) (end (if (all Passed) { (if (> ("CombinedGroupCounts" if:(= (who at:(to)) P1)) ("CombinedGroupCounts" if:(= (who at:(to)) P2))) (result P1 Win)) (if (< ("CombinedGroupCounts" if:(= (who at:(to)) P1)) ("CombinedGroupCounts" if:(= (who at:(to)) P2))) (result P2 Win))} (result Mover Win)))))
###
| Hermit is a two player abstract game in which players drop stones to create edgewise connected, owned groups of odd sizes 1, 3 and 5 exclusively.
The game ends when neither player can legally place a stone.
The player with the most groups on the board at game's end wins.
Ties are broken by the most groups of size 1 (hermits), then by the most groups of size 3, and finally, the last player to place a stone wins.
Scores are formatted 'aa1133', where aa = count of all groups, 11 = count of size 1 groups, and 33 = count of size 3 groups.
It is helpful to turn on 'Show Legal Moves' (Alt-M). Base 5 hexagonal board of triangles END |
Describe the mechanics of the following Ludii game
(define "FifteenFinal" (if (is Mover P1) (and ("IsFriendAt" 12) (= 15 (size Stack at:12))) (and ("IsFriendAt" 13) (= 15 (size Stack at:13))))) (define "SevenFiveThreeFinal" (if (is Mover P1) (and { ("IsFriendAt" 10) ("IsFriendAt" 11) ("IsFriendAt" 12) (= 3 (size Stack at:10)) (= 5 (size Stack at:11)) (= 7 (size Stack at:12))}) (and { ("IsFriendAt" 13) ("IsFriendAt" 14) ("IsFriendAt" 15) (= 7 (size Stack at:13)) (= 5 (size Stack at:14)) (= 3 (size Stack at:15))}))) (define "ThreeOnFiveFinal" (if (is Mover P1) (and { ("IsFriendAt" 8) ("IsFriendAt" 9) ("IsFriendAt" 10) ("IsFriendAt" 11) ("IsFriendAt" 12) (= 3 (size Stack at:8)) (= 3 (size Stack at:9)) (= 3 (size Stack at:10)) (= 3 (size Stack at:11)) (= 3 (size Stack at:12))}) (and { ("IsFriendAt" 13) ("IsFriendAt" 14) ("IsFriendAt" 15) ("IsFriendAt" 17) ("IsFriendAt" 18) (= 3 (size Stack at:13)) (= 3 (size Stack at:14)) (= 3 (size Stack at:15)) (= 3 (size Stack at:17)) (= 3 (size Stack at:18))}))) (define "FiveOnThreeFinal" (if (is Mover P1) (and { ("IsFriendAt" 10) ("IsFriendAt" 11) ("IsFriendAt" 12) (= 5 (size Stack at:10)) (= 5 (size Stack at:11)) (= 5 (size Stack at:12))}) (and { ("IsFriendAt" 13) ("IsFriendAt" 14) ("IsFriendAt" 15) (= 5 (size Stack at:13)) (= 5 (size Stack at:14)) (= 5 (size Stack at:15))}))) (define "AllPiecesInFinalQuadrant" ("AllOwnedPiecesIn" (sites Mover "FinalQuadrant"))) (define "NextSiteFrom" ("NextSiteOnTrack" #2 from:#1)) (game "Svensk Bradspel" (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 (if (= (value Player Mover) 1) True (is Empty (to))))) (apply (if ("IsEnemyAt" (to)) (fromTo (from (to)) (to (mapEntry "Bar" Next)))))))) (then (and ("ReplayNotAllDiceUsed") (if (and (= (last To) (mapEntry "12thPoint" Mover)) (!= 1 (value Player Mover))) (set Value Mover 1)))))) (regions "FinalQuadrant" P1 (sites {7..12})) (regions "FinalQuadrant" P2 (sites {13..18})) (regions "StartingSide" P1 (sites {25..20 18..14})) (regions "StartingSide" P2 (sites {0..5 7..11})) (map "12thPoint" {(pair P1 13) (pair P2 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") (if ("FiveOnThreeFinal" Mover) (result Mover Win)) (if ("ThreeOnFiveFinal" Mover) (result Mover Win)) (if ("SevenFiveThreeFinal" Mover) (result Mover Win)) (if ("FifteenFinal" Mover) (result Mover Win))})))
###
| 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 eleven points of the board, except for those pieces in the starting position, until one of the player's pieces has first landed on the twelfth point. However, a player may place two pieces on any point after the twelfth point, regardless of whether a piece has ever landed on the twelfth point. 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. To win, a player must place their pieces in one of the following winning positions: five pieces on each of the final three points; three pieces on the final five points; seven on the final point, five on the penultimate point, and three on the antepenultimate point; fifteen on the final point. If none of these positions are possible, the player must bear off all of their pieces once all of their pieces have reached the final six points. The first player to reach a winning position or to bear off all of their pieces wins. END |
Describe the mechanics of the following Ludii game
(define "Custodial" (custodial (from (last To)) Orthogonal (between (max 1) if:(= (what at:(between)) (id #1)) (apply (remove (between)))) (to if:("FriendOrCentre")))) (define "JarlButNotTheExpandedCentre" (and (= (what at:(between)) (id "Jarl2")) (and (!= (between) ("Castle")) (not (is In (between) (sites "OrthogonalSitesCentre")))))) (define "JarlAndExpandedCentre" (and (= (what at:(between)) (id "Jarl2")) (or (= (between) ("Castle")) (is In (between) (sites "OrthogonalSitesCentre"))))) (define "FriendOrCentre" (or ("IsFriendAt" (to)) (= (to) ("Castle")))) (define "CaptureJarl" (apply (trigger "Surrounded" P2))) (define "JarlWasCaptured" (is Triggered "Surrounded" P2)) (define "Castle" (centrePoint)) (define "Custodial" (custodial (from (last To)) Orthogonal (between (max 1) if:(= (what at:(between)) (id #1)) (apply (remove (between)))) (to if:("FriendOrCentre")))) (define "JarlButNotTheExpandedCentre" (and (= (what at:(between)) (id "Jarl2")) (and (!= (between) ("Castle")) (not (is In (between) (sites "OrthogonalSitesCentre")))))) (define "JarlAndExpandedCentre" (and (= (what at:(between)) (id "Jarl2")) (or (= (between) ("Castle")) (is In (between) (sites "OrthogonalSitesCentre"))))) (define "FriendOrCentre" (or ("IsFriendAt" (to)) (= (to) ("Castle")))) (define "CaptureJarl" (apply (trigger "Surrounded" P2))) (define "JarlWasCaptured" (is Triggered "Surrounded" P2)) (define "Castle" (centrePoint)) (define "NoRepetition" (meta (no Repeat))) (game "Poprad Game" (players 2) (equipment { (board (square 17)) (piece "Marker" Each (move Slide Orthogonal (then ("CustodialCapture" Orthogonal (max 1))))) (hand Each)}) (rules ("NoRepetition") (start (place "Marker" "Hand" count:144)) phases:{ (phase "Placement" (play (move (from (handSite Mover)) (to (difference (sites Board) (centrePoint)) if:(is Empty (to))) (then (if (and (is Occupied (handSite Mover)) ("NewTurn")) (moveAgain))))) (nextPhase Mover (is Empty (handSite Mover)) "Capture")) ("PhaseMovePiece" "Capture")} (end ("HavingLessPiecesLoss" Next 1))))
###
| 17x17 or 17x18 board. States can not be repeated. Kharebga rules applied to a 17x17 board. END |
Modify the Ludii game according to the following option changes:
The elephants can jump only diagonally. -> The elephants can move like a Silver in Shogi.
(game "Chaturanga" ("TwoPlayersNorthSouth") (equipment { (board (square 8)) ("ChessPawn" "Pawn" ~ (then ("ReplayInMovingOn" (sites Mover "Promotion")))) ("ChessRook" "Rook") ("ChessKing" "King_noCross") (piece "Elephant" Each (move Hop Diagonal (between if:True) (to if:(not ("IsFriendAt" (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 "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:"E8") (place "King_noCross2" coord:"D8")}) (play (if "SameTurn" (move Promote (last To) (piece "Ferz_noCross") Mover) (do (forEach Piece) ifAfterwards:(not ("IsInCheck" "King_noCross" Mover))))) (end { ("Checkmate" "King_noCross") ("MisereBlockWin") ("HavingLessPiecesLoss" Next 1)})))
###
| (game "Chaturanga" ("TwoPlayersNorthSouth") (equipment { (board (square 8)) ("ChessPawn" "Pawn" ~ (then ("ReplayInMovingOn" (sites Mover "Promotion")))) ("ChessRook" "Rook") ("ChessKing" "King_noCross") (piece "Elephant" Each ("StepToNotFriend" (directions {Forward BL BR FL FR}))) ("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 "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:"E8") (place "King_noCross2" coord:"D8")}) (play (if "SameTurn" (move Promote (last To) (piece "Ferz_noCross") Mover) (do (forEach Piece) ifAfterwards:(not ("IsInCheck" "King_noCross" Mover))))) (end { ("Checkmate" "King_noCross") ("MisereBlockWin") ("HavingLessPiecesLoss" Next 1)}))) END |
Construct a Ludii game based on the following description
Cross-shaped board, with two opposite arms bent at a right angle. Line cross each arm, creating 55 intersections where the pieces are placed. Two teams of one, two, or three people play, with each player controlling one piece. Four longitudinally split reed are used as dice, two are unmarked on the concave side which count as 1, and the other two are marked, and count as 15 and 20. The throws are as follows: All convex faces up = 10; all concave sides up = 5; one concave side up = the value of that side; two concave sides up = 2, three concave sides up =3, A player must throw 10 or more to enter the board. Once a piece is entered, the player throws three times consecutively. Each player owns one of the bent arms of the board, and the piece move anti-clockwise from the right hand end of the arm, to the exit at the left hand end of the arm, but not entering the opponent's arm. When a player lands on a space occupied by an opponent's piece, the opponent's piece is sent back to start. Pieces on the central spot (spot 25) are safe from being sent back. When a piece enters the player's arm again as they approach the goal, throws of 10, 15, and 20 count as 1. On the penultimate space, a throw of 2, 3, or 5 allows a piece to exit, but on the final space a throw of 1, 10, 15, or 20 is required. If playing on teams, a player who has reached the goal continues to throw and use those throws to move their teammates' pieces. The first team to remove all their pieces from the board wins. The game is played with 6 players.
###
| (define "SiteToMoveOnTrack" ("NextSiteOnTrack" #2 #1)) (define "ThrowValueEndTrack" (if (is In ("ThrowValue") (sites {1 10 15 20})) 1 ("ThrowValue"))) (define "ThrowValue" (mapEntry "Throw" (count Pips))) (game "Petol" (players 6) (equipment { (board (remove (merge { (shift 0 7 (scale 2 1 (rectangle 3 2))) (scale 2 1 (rectangle 8 2)) (shift 0 9 (scale 2 1 (rectangle 8 2))) (shift 4.5 1 (scale 2 1 (rectangle 6 2))) (shift -4.5 10 (scale 2 1 (rectangle 6 2))) (shift 4.5 6 (graph vertices:{ { 0 0} { 0 1} { 2 3} {2 0}} edges:{ {0 1} {1 2} {2 3} {3 0}})) (shift 2 7 (graph vertices:{ { 0 0} { 0 2} { 4.5 2} {2.5 0}} edges:{ {0 1} {1 2} {2 3} {3 0}})) (shift 0 7 (graph vertices:{ { 0 0} { 0 2} { -2.5 2} {-4.5 0}} edges:{ {0 1} {1 2} {2 3} {3 0}})) (shift -2.5 10 (graph vertices:{ { 0 0} { 0 -1} { -2 -3} {-2 0}} edges:{ {0 1} {1 2} {2 3} {3 0}}))}) edges:{{2 3}}) { (track "Track1" "56,S,E1,S,E,N,W,S7,W1,N,End" P1 directed:True) (track "Track2" "35,N,W1,N,W,S,E,N7,E1,S,End" P2 directed:True) (track "Track3" "56,S,E1,S,E,N,W,S7,W1,N,End" P3 directed:True) (track "Track4" "35,N,W1,N,W,S,E,N7,E1,S,End" P4 directed:True) (track "Track5" "56,S,E1,S,E,N,W,S7,W1,N,End" P5 directed:True) (track "Track6" "35,N,W1,N,W,S,E,N7,E1,S,End" P6 directed:True)} use:Vertex) (dice d:2 facesByDie:{{0 1} {0 1} {0 15} {0 20}} num:4) (piece "Marker" Each (if ("IsEndTrack" ("SiteToMoveOnTrack" from:(from) 1)) (if (or { (= 1 ("ThrowValue")) (= 10 ("ThrowValue")) (= 15 ("ThrowValue")) (= 20 ("ThrowValue"))}) (move Remove (from) level:(level))) (if ("IsEndTrack" ("SiteToMoveOnTrack" from:(from) 2)) (or (if (or { (= 2 ("ThrowValue")) (= 3 ("ThrowValue")) (= 5 ("ThrowValue"))}) (move Remove (from) level:(level))) (if (is In ("ThrowValue") (sites {1 10 15 20})) (move (from (from) level:(level)) (to ("SiteToMoveOnTrack" from:(from) 1))))) (if (is In (from) (sites Mover "EndTrack")) (move (from (from) level:(level)) (to ("SiteToMoveOnTrack" from:(from) ("ThrowValueEndTrack")) if:True)) (move (from (from) level:(level)) (to ("SiteToMoveOnTrack" from:(from) ("ThrowValue")) if:(not (and (is In (to) (sites "SafeSites")) ("IsEnemyAt" (to)))) ("HittingStackCapture" (handSite (who at:(to) level:(level)))))))))) (hand Each) (map "Throw" {(pair 0 10) (pair 37 5) (pair 1 1) (pair 15 15) (pair 20 20) (pair 2 2) (pair 16 2) (pair 21 2) (pair 35 2) (pair 17 3) (pair 22 3) (pair 36 3)}) (map "Entry" {(pair P1 56) (pair P2 35) (pair P3 56) (pair P4 35) (pair P5 56) (pair P6 35)}) (regions "SafeSites" (sites {2 3})) (regions "EndTrack" P1 (sites {60 47 49 51 53 55 57})) (regions "EndTrack" P2 (sites {58 44 42 40 38 36 34})) (regions "EndTrack" P3 (sites {60 47 49 51 53 55 57})) (regions "EndTrack" P4 (sites {58 44 42 40 38 36 34})) (regions "EndTrack" P5 (sites {60 47 49 51 53 55 57})) (regions "EndTrack" P6 (sites {58 44 42 40 38 36 34}))}) (rules (start { (set Team 1 {P1 P3 P5}) (set Team 2 {P2 P4 P6}) (place "Marker1" (handSite P1)) (place "Marker2" (handSite P2)) (place "Marker3" (handSite P3)) (place "Marker4" (handSite P4)) (place "Marker5" (handSite P5)) (place "Marker6" (handSite P6))}) (play ("RollMove" (or { (if (and (is Occupied (handSite Mover)) (<= 10 ("ThrowValue"))) (move (from (handSite Mover)) (to (mapEntry "Entry" Mover)) (then (and (moveAgain) (set Value Mover 0))))) (forEach Piece (then (if (and (< Undefined (value Player Mover)) (> 3 (value Player Mover))) (if (> 2 (value Player Mover)) (and (moveAgain) (set Value Mover (+ 1 (value Player Mover)))) (set Value Mover (+ 1 (value Player Mover))))))) (if (no Pieces Mover) (if (or {(is Mover P1) (is Mover P3) (is Mover P5)}) (or {(forEach Piece P1) (forEach Piece P3) (forEach Piece P5)}) (or {(forEach Piece P2) (forEach Piece P4) (forEach Piece P6)})))}))) (end ("EscapeTeamWin")))) END |
What does the following global Ludii definition do?
(define "OppositePit" (if (is Mover P1) (+ #1 "Columns") (- #1 "Columns")))
###
| Returns the index of the opposite pit on a mancala board. This ludemeplex is working only if the description is defining "Columns" as the number of holes of the board. END |
Construct a Ludii game based on the following description
The game is played on the board of Kensington. It follows the rules of Go except when a capture is made, the pieces captured are flipped.
###
| (define "CaptureSurroundedPiece" (enclose (from (last To)) Orthogonal (between if:("IsEnemyAt" (between)) (apply (and (remove (between)) (add (to (between)))))))) (game "Lotus" (players 2) (equipment { (board (rotate 90 (tiling T3464 2)) use:Vertex) (piece "Marker" Each)}) (rules (play (or (do (move Add (to (sites Empty)) (then "CaptureSurroundedPiece")) ifAfterwards:"HasFreedom") (move Pass (then (addScore Mover 1))))) (end (if (all Passed) (byScore { (score P1 (+ {(score P1) (size Territory P1) (count Sites in:(sites Occupied by:P1))})) (score P2 (+ {(score P2) (size Territory P2) (count Sites in:(sites Occupied by:P2))}))}))))) END |
Describe the mechanics of the following Ludii game
(define "Goal" 96) (game "Pachisi" (players 4) (equipment { ("PachisiBoard" { (track "Track1" "97,68,N,11,E,N,W,53,N,W,S,42,W,S,E,8,S,55,N8" P1 directed:True) (track "Track2" "98,46,W,53,N,W,S,42,W,S,E,8,S,E,N,11,E,34,W8" P2 directed:True) (track "Track3" "99,81,S,42,W,S,E,8,S,E,N,11,E,N,W,53,N,94,S8" P3 directed:True) (track "Track4" "100,4,E,8,S,E,N,11,E,N,W,53,N,W,S,42,W,19,E8" P4 directed:True)}) (hand Each) ("StickDice" 6) (map "Die" {(pair 0 25) (pair 1 10) (pair 2 2) (pair 3 3) (pair 4 4) (pair 5 5) (pair 6 6)}) (map "Entry" {(pair 1 68) (pair 2 46) (pair 3 81) (pair 4 4)}) (map "PreviousGoal" {(pair 1 9) (pair 2 27) (pair 3 52) (pair 4 26)}) (regions "Castle" {61 63 65 32 47 15 80 84 86 21 38 3}) (regions "Grace" {0 1 6}) (piece "Pawn" Each (if (or (= ("NextSiteOnTrack" (count Pips)) ("Goal")) (and (is In (count Pips) (sites "Grace")) (= (from) (mapEntry "PreviousGoal" (mover))))) (move Select (from) (to ("Goal")) (then (remove (last From)))) (if (and (not (= ("NextSiteOnTrack" (mapEntry "Die" (count Pips))) ("Goal"))) (not ("IsOffBoard" ("NextSiteOnTrack" (mapEntry "Die" (count Pips)))))) (move (from (from) level:(level)) (to ("NextSiteOnTrack" (mapEntry "Die" (count Pips))) (apply if:(or (not (is In ("NextSiteOnTrack" (mapEntry "Die" (count Pips))) (sites "castle"))) (and (is In ("NextSiteOnTrack" (mapEntry "Die" (count Pips))) (sites "Castle")) ("IsFriendAt" ("NextSiteOnTrack" (mapEntry "Die" (count Pips)))))) (if ("IsEnemyAt" (to)) (fromTo (from (to)) (to (handSite (who at:(to))))))))))))}) (rules (start { (place Stack "Pawn1" (handSite P1) count:4) (place Stack "Pawn2" (handSite P2) count:4) (place Stack "Pawn3" (handSite P3) count:4) (place Stack "Pawn4" (handSite P4) count:4) (set Team 1 {P1 P3}) (set Team 2 {P2 P4})}) phases:{ (phase "firstTurn" (play ("RollMove" (move (from (handSite (mover))) (to ("NextSiteOnTrack" (mapEntry "Die" (count Pips)) from:(handSite (mover))))))) (nextPhase (> (count Moves) 3) "Movement")) (phase "Movement" (play ("RollMove" (or { (forEach Piece) (if (and (is Occupied (handSite (mover))) (is In (count Pips) (sites "Grace"))) (move (from (handSite Mover) level:(topLevel at:(handSite (mover)))) (to (mapEntry "Entry" (mover))))) (move Pass)} (then (if (is In (count Pips) (sites "Grace")) (moveAgain)))))))} (end ("EscapeTeamWin"))))
###
| Four pieces per player. Play begins in the central row of each player's arm of the board. Values of the cowries are: 0=6, 1=10, 2=2, 3=3, 4=4, 5=25, 6=12. A roll of 25 adds an extra move of 1. This extra move can be assigned to any piece or allows the player to move a piece onto the board. Play proceeds in an anti-clockwise direction. Pieces on a space marked \ END |
Modify the Ludii game according to the following option changes:
The game has 8 players. -> The game has 10 players.
(games { (subgame "Aj Sayil" "Players/8" next:1) (subgame "Aj T'iwil" "Players/8" next:2) (subgame "Aj Sina'anil" "Players/8" next:3) (subgame "Aj Sakakil" "Players/8" next:4) (subgame "A K'aak'il" "Players/8")})
###
| (games { (subgame "Aj Sayil" "Players/10" next:1) (subgame "Aj T'iwil" "Players/10" next:2) (subgame "Aj Sina'anil" "Players/10" next:3) (subgame "Aj Sakakil" "Players/10" next:4) (subgame "A K'aak'il" "Players/10")}) END |
Construct a global Ludii definition which fulfills the following requirements.
Defines a graphics turtle walk to build a large T piece.
###
| (define "TWalk" { {F F F L F R R F F}}) END |
Describe the mechanics of the following Ludii game
(define "FromEdgeToEdge" (and ( ( (is In (site) (sites #1))) ( (= 0 (count Pieces All in:(sites LineOfSight at:(site) #2))))))) (define "DroppableFromDirection" (and ( (= 0 (count Pieces All in:(sites LineOfSight at:(site) #1))) (= 1 (count Pieces in:(sites Around (site) #2)))))) (game "Centrifugal Force" (players 2) (equipment { (board (square 13)) (piece "Cross" P1) (piece "Disc" P2) (piece "Square" Neutral)}) (rules (start { (place "Square0" coord:"A1") (place "Square0" coord:"M1") (place "Square0" coord:"M13") (place "Square0" coord:"A13")}) (play (move Add (to (forEach (sites Empty) if: (or ( (or { ("FromEdgeToEdge" Top S) ("FromEdgeToEdge" Bottom N) ("FromEdgeToEdge" Left E) ("FromEdgeToEdge" Right W)}) (or { ("DroppableFromDirection" N S) ("DroppableFromDirection" S N) ("DroppableFromDirection" W E) ("DroppableFromDirection" E W)}))))))) (end { (if (is Line 5) (result Mover Win)) (if (no Moves Next) (result All Draw))})))
###
| At the beginning of the game, the board is empty except for the the four edge cells, which are occupied by a square which belongs to neither player.
The first player plays with crosses, the second with circles.
Each player, on his turn, must place his marker on the grid onto an empty cell respecting the following rule:
the marker is dropped from one of the four sides of the board choosing a row or a column, and, proceeding in a straight line so that it goes inside of the board, it stops in front of the first obstacle (the border of the board, a marker of any of the two players or one of the four sqaures).
Pretty much the same as what happens in Connect4, except here there are four dropping directions.
To win the game you need to be the first to form an horizontal, vertical, or diagonal line of at least five of your markers.
If there are no available moves, the game ends in a draw. The game is played on a 13x13 board. Look and feel: Retro END |
Construct a Ludii game based on the following description
Forty stones, arranged in a circle, with a larger gap (called a door) after every tenth stone. Two or four players, each player playing with one piece. Each piece begins in one of the doors: north/winter is yellow, west/spring is blue, south/summer is red, east/autumn is white. North and west move anti-clockwise around the circle, south and east move clockwise. Three sticks, red on one side and black on the other, used as dice, the throws are as follows: three red = 10, three black = 5, two red and one black = 3, two black and one red = 2. A throw of 10 grants the player another throw. When a player lands on a spot occupied by an opponent, the opponent's piece is sent back to start. The first player to complete four circuits of the board wins. Circuits are usually counted with beans or corn. The game has 4 players.
###
| (define "MadeACompleteCircuit" (if (or (is Mover P1) (is Mover P2)) (is In (mapEntry "Start" Mover) (sites Track "TrackCCW" from:("NextSite" (last From) "TrackCCW") to:(last To))) (is In (mapEntry "Start" Mover) (sites Track "TrackCW" from:("NextSite" (last From) "TrackCW") to:(last To))))) (define "NextSite" ("NextSiteOnTrack" 1 from:#1 #2)) (define "Move" (move (from (from) level:(level)) (to ("NextSiteOnTrack" ("ThrowValue") #1) if:(not ("IsFriendAt" (to))) ("HittingCapture" (mapEntry "Start" (who at:(to))))))) (define "TrackMove" ("NextSiteOnTrack" ("ThrowValue") #1)) (define "ThrowValue" (mapEntry "Throw" (count Pips))) (game "Tasholiwe" (players 4) (equipment { ("FortyStonesWithFourGapsBoard" { (track "TrackCW" {39 35 33 31 29 27 25 23 21 19 38 17 15 13 11 9 7 5 3 1 37 0 2 4 6 8 10 12 14 16 36 18 20 22 24 26 28 30 32 34} loop:True) (track "TrackCCW" {39 34 32 30 28 26 24 22 20 18 36 16 14 12 10 8 6 4 2 0 37 1 3 5 7 9 11 13 15 17 38 19 21 23 25 27 29 31 33 35} loop:True)}) (map "Throw" {(pair 0 10) (pair 1 3) (pair 2 2) (pair 3 5)}) (map "Start" {(pair 1 39) (pair 2 36) (pair 3 37) (pair 4 38)}) (regions "AllSites" (sites Board Vertex)) (piece "Stick" Each) ("StickDice" 3) (hand Each)}) (rules (start { (place "Stick1" Edge (mapEntry "Start" P1)) (place "Stick2" Edge (mapEntry "Start" P2)) (place "Stick3" Edge (mapEntry "Start" P3)) (place "Stick4" Edge (mapEntry "Start" P4))}) (play ("RollMove" (if (or (is Mover P1) (is Mover P2)) (forEach Piece ("Move" "TrackCCW")) (forEach Piece ("Move" "TrackCW"))) (then (do (if ("MadeACompleteCircuit") (addScore Mover 1) (then (if (= (score Mover) 4) (remove (last To))))) next:(if (and (!= 4 (score Mover)) (= 10 ("ThrowValue"))) (moveAgain)))))) (end (if (>= (score Mover) 4) (result Mover Win))))) END |
Construct a Ludii game based on the following description
4x6-21 board; 8 is most common, 12, 15, and 18 are also popular. Two counters in each hole in the players' outer rows. Two holes in each player's outer row are selected as misoro. Typically, the left two holes are chosen. Sowing occurs in an anti-clockwise direction, only in the two rows belonging to the player. When the final counter lands in an occupied hole, these are picked up and sowing continues. If this final hole is one of the misoro, the player may choose to end their turn instead of continuing to sow. When the final counter lands in an empty hole in the inner row, any counters in the opposite hole in the opponent's inner row are captured. If there also are counters in the opposite hole in the opponent's outer row, these are also captured, but only if there was first a capture from the inner row hole. Players cannot sow from a hole with a single counter unless there are no holes with multiple counters. Single counters can only be sown into an empty hole. Play continues until one player has captured all of the opponent's counters, thus winning the game.
Players choose the misoro holes. 8 Holes per row.
###
| (define "NextHoleFrom" ("NextSiteOnTrack" 1 from:#1 #2)) (define "AHoleHasMoreThanOneCounter" (not (all Sites (forEach (sites Mover) if:(< 1 (count at:(site)))) if:(= 0 (count at:(site)))))) (define "LastHoleSowed" (sites {(var)})) (define "NoPiece" (all Sites (sites Player "Home") if:(= 0 (count at:(site))))) (define "Columns" 8) (game "Misoro Tsoro" (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 "Outer" P1 (sites Bottom)) (regions "Outer" P2 (sites Top)) (piece "Seed" Shared)}) (rules (start (set Count 2 to:(union (sites Top) (sites Bottom)))) phases:{ (phase "Misoro" (play (move Select (from (forEach (sites Mover "Outer") if:(= 0 (state at:(site))))) (then (set State at:(last To) (mover))))) (nextPhase (= 4 (count Turns)) "Playing")) (phase "Playing" (play (or (if (and (!= 0 (state at:(var))) ("SameTurn")) (move Pass)) (move Select (from (if ("SameTurn") "LastHoleSowed" (sites Mover "Home")) if:(if "AHoleHasMoreThanOneCounter" (> (count at:(from)) 1) (and (= (count at:(from)) 1) (= 0 (count at:("NextHoleFrom" (from) Mover)))))) (then (and (sow "Track" owner:(mover) apply:(if (= (count at:(to)) 1) (if (is In (to) (sites Mover "Inner")) (if (> (count at:("OppositePit" (to))) 0) (and (remove ("OppositePit" (to))) (if (> (count at:("OppositeOuterPit" (to))) 0) (remove ("OppositeOuterPit" (to))))))) (and (moveAgain) (set Var (to))))) (forEach Site (sites Board) (if (!= 0 (state at:(site))) (set State at:(site) (state at:(site)))))))))))} (end (forEach NonMover if:("NoPiece") (result Player Loss))))) END |
Construct a Ludii game based on the following description
2x6 board, with a store hole on either end. Four counters in each hole. Each player owns the six holes, three holes in each row, to their right. Sowing occurs in an anti-clockwise direction, and only in the holes belonging to the player. Play begins with a stylized opening move. The first player takes the counters from the holes in each of the row of holes closest to them, and places them in the central row of their holes in the further row. The counters from the hole next in the direction of sowing are then sown. The counters from the central hole in the further of the player's rows are then sown. When this is completed, the player takes the counters from the holes in the row closest to them, and holds them until the opponent performs the same sequence of moves on their side of the board. At this point, each player places the counters they are holding into any hole on the opponent's side of the board which contains more than one counter. Players then alternate turns sowing pieces around their holes of the board. Sowing always skips the hole from which sowing began. When the final counter of a sowing causes a hole to contain four counters, these counters are placed on any hole on the opponent's side of the board that contains more than one counter. When a player has only single seeds in their holes, and the opponent is about to place counters in the player's holes, the opponent moves one of the player's counters into another hole containing one counter, thus making two, and places the counters from the opponent's side are placed there. The player who is able to place all of their counters on the opponent's side of the board wins. The opening rules of the variant Lontu Holo.
###
| (define "OneSeedInEachHole" (all Sites (sites #1 "Home") if:(= 1 (count at:(site))))) (define "NoSeedInHome" (all Sites (sites #1 "Home") if:(is Empty (site)))) (define "NextHoleFrom" ("NextSiteOnTrack" #3 from:#1 #2)) (game "Lontu-Holo" (players 2) (equipment { (mancalaBoard 2 6 { (track "TrackCCW1" {1 2 3 9 8 7} loop:True P1) (track "TrackCCW2" {4 5 6 12 11 10} loop:True P2)}) (regions "Home" P1 (sites Track "TrackCCW1")) (regions "Home" P2 (sites Track "TrackCCW2")) (regions "TwoHolesClosestNotCentre" P1 (sites {1 3})) (regions "TwoHolesClosestNotCentre" P2 (sites {10 12})) (regions "TwoHolesFurtherNotCentre" P1 (sites {7 9})) (regions "TwoHolesFurtherNotCentre" P2 (sites {4 6})) (regions "LeftMostHoles" P1 (intersection (expand (sites Left)) (sites Track "TrackCCW1"))) (regions "LeftMostHoles" P2 (intersection (expand (sites Right)) (sites Track "TrackCCW2"))) (regions "RightMostHoles" P1 (intersection (sites Centre) (sites Track "TrackCCW1"))) (regions "RightMostHoles" P2 (intersection (sites Centre) (sites Track "TrackCCW2"))) (regions "ClosestRow" P1 (intersection (sites Bottom) (sites Track "TrackCCW1"))) (regions "ClosestRow" P2 (intersection (sites Top) (sites Track "TrackCCW2"))) (map "CentreFurtherRow" {(pair P1 8) (pair P2 5)}) (map "CentreClosestRow" {(pair P1 2) (pair P2 11)}) (map "RightFurtherRow" {(pair P1 9) (pair P2 4)}) (map "RightClosestRow" {(pair P1 3) (pair P2 10)}) (map "LeftFurtherRow" {(pair P1 7) (pair P2 6)}) (map "LeftClosestRow" {(pair P1 1) (pair P2 12)}) (piece "Seed" Shared) (map "Store" {(pair P1 FirstSite) (pair P2 LastSite)})}) (rules (start (set Count 4 to:(union (sites Bottom) (sites Top)))) phases:{ (phase "Opening1" (play (move (from (sites Mover "TwoHolesClosestNotCentre") if:(is Occupied (from))) (to (mapEntry "CentreFurtherRow" Mover)) count:(count at:(from)))) (nextPhase Mover (all Sites (sites Mover "TwoHolesClosestNotCentre") if:(is Empty (site))) "Opening2")) (phase "Opening2" (play (move Select (from ("NextHoleFrom" (mapEntry "CentreFurtherRow" Mover) "TrackCCW" 1)) (then (sow "TrackCCW" owner:(mover))))) (nextPhase Mover "Opening3")) (phase "Opening3" (play (move Select (from (mapEntry "CentreFurtherRow" Mover)) (then (sow "TrackCCW" owner:(mover))))) (nextPhase Mover "Opening4")) (phase "Opening4" (play (move (from (sites Mover "ClosestRow") if:(is Occupied (from))) (to (mapEntry "Store" Mover)) count:(count at:(from)))) (nextPhase Mover (all Sites (sites Mover "ClosestRow") if:(is Empty (site))) "Opening5")) (phase "Opening5" (play (move (from (mapEntry "Store" Mover)) (to (sites Mover "Home") if:(< 1 (count at:(to)))) count:1)) (nextPhase Mover (is Empty (mapEntry "Store" Mover)) "Sowing")) (phase "Sowing" (play (if ("SameTurn") (if ("OneSeedInEachHole" Next) (move (from (sites Next "Home")) (to (sites Next "Home") if:(!= (from) (to))) count:1 (then (moveAgain))) (move (from (var "Replay")) (to (sites Next "Home") if:(< 1 (count at:(to)))) count:1 (then (if (is Occupied (last From)) (moveAgain))))) (move Select (from (sites Mover "Home") if:(is Occupied (from))) (then (sow "TrackCCW" owner:(mover) apply:(if (= 4 (count at:(to))) (and (moveAgain) (set Var "Replay" (to))))))))) (end (if ("NoSeedInHome" Mover) (result Mover Win))))})) END |
Construct a Ludii game based on the following description
The objective of Cannon is to capture or shoot the opponent's Town.
The player also wins the game if his opponent doesn't have legal moves.
Players move alternately. On their first turns both players put a special piece called \
###
| (define "CannonShoot" (forEach Direction All (if (and { ("IsCannon") (is Empty ("AheadSite" steps:3))}) (if ("IsEnemyAt" ("AheadSite" steps:4)) (move Remove ("AheadSite" steps:4)) (if (and (is Empty ("AheadSite" steps:4)) ("IsEnemyAt" ("AheadSite" steps:5))) (move Remove ("AheadSite" steps:5))))))) (define "IsCannon" (and ("IsPieceAt" "Pawn" Mover (to)) ("IsPieceAt" "Pawn" Mover ("AheadSite" steps:2)))) (define "AheadSite" (ahead (from) #1 (directions Vertex from:(from) to:(to)))) (define "CannonMove" (move Hop All (between (exact 2) if:("IsPieceAt" "Pawn" Mover (between))) (to if:(is Empty (to))))) (define "RetreatMove" (if ("EnemyAround") (move Hop (directions Backwards of:All) (between if:(is Empty (between))) (to if:(is Empty (to)))))) (define "EnemyAround" (not (all Sites (sites Around (from) All) if:(not ("IsEnemyAt" (site)))))) (define "StepCapture" ("StepToEnemy" (directions {Forwards Rightward Leftward} of:All))) (define "StepToEmptyForwards" ("StepToEmpty" (directions Forwards of:All))) (game "Cannon" ("TwoPlayersNorthSouth") (equipment { (board (square 10) use:Vertex) (piece "Pawn" Each (or { ("StepToEmptyForwards") ("StepCapture") ("RetreatMove") ("CannonMove") ("CannonShoot")})) (piece "Town" Each) (hand Each) (regions "Home" P1 (sites Bottom)) (regions "Home" P2 (sites Top))}) (rules (start { (place "Town" "Hand") (place "Pawn1" (forEach (difference (expand (sites Row 2)) (sites Right)) if:(is Even (column of:(site))))) (place "Pawn2" (forEach (difference (expand (sites Row 7)) (sites Left)) if:(is Odd (column of:(site)))))}) phases:{ (phase "Placing" (play (move (from (handSite Mover)) (to (difference (sites Mover "Home") (sites Corners))))) (nextPhase Mover "Moving")) (phase "Moving" (play (forEach Piece)) (end (if (or ("IsOffBoard" (where "Town" Next)) (no Moves Next)) (result Mover Win))))})) 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, which begin on the rightmost point, with respect to the player, on the opposite side of the board from which they sit. 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. More than two pieces of the same player may not occupy a point on the starting side of the board. The player cannot move past the penultimate point on the opposite side of the board until five pieces have been moved from the starting point. A single opponent's piece may be removed from the board when a player's piece lands on it, and the opponent's piece must reenter the board. Pieces cannot move to a point occupied by two opponent's piece. A piece cannot reenter then board on a point occupied by another piece, whether belonging to the player or the opponent. When all of a player's pieces have reached the final quadrant of the board, the player may begin to remove them from the table. The player who bears off their pieces scores two points.
###
| (define "EnterPieces" (if (is Occupied (handSite Mover)) (forEach Die replayDouble:True if:("DieNotUsed") (move (from (handSite Mover)) (to ("NextSiteFrom" (mapEntry "Entry" Mover) (- (pips) 1)) if:(is Empty (to)))) (then ("ReplayNotAllDiceUsed"))))) (define "AllPiecesInFinalQuadrant" ("AllOwnedPiecesIn" (sites Mover "FinalQuadrant"))) (define "NextSiteFrom" ("NextSiteOnTrack" #2 from:#1)) (game "Kotra" (players 2) (equipment { ("BackgammonBoard" { (track "Track1" {12..7 5..0 13..18 20..25 End} P1 directed:True) (track "Track2" {13..18 20..25 12..7 5..0 End} P2 directed:True)}) (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 (> 2 (size Stack at:(to)))) (if (not (is In (to) (sites Mover "AfterPenultimate"))) True (>= 10 (count Pieces in:(sites {(handSite Mover) (mapEntry "Entry" Mover)}))))}) ("HittingCapture" (handSite Next))))) (then ("ReplayNotAllDiceUsed")))) (hand Each) (regions "FinalQuadrant" P1 (sites {20..25})) (regions "FinalQuadrant" P2 (sites {0..5})) (regions "StartingSide" P1 (sites {0..5 7..12})) (regions "StartingSide" P2 (sites {13..18 20..25})) (regions "AfterPenultimate" P1 (sites {25})) (regions "AfterPenultimate" P2 (sites {0})) (map "Entry" {(pair P1 12) (pair P2 13)})}) (rules (start { (place Stack "Disc1" 12 count:15) (place Stack "Disc2" 13 count:15)}) (play ("RollEachNewTurnMove" (or ("EnterPieces") (forEach Piece top:True)) (then (if (no Pieces Mover) (set Score Mover 2))))) (end ("EscapeWin")))) END |
Describe the mechanics of the following Ludii game
(define "RemoveKingIfCheckmate" (if (and (is Active #1) (not (is Mover #1))) (if (and ("IsInCheck" "King" #1) ("CanNotMove" #1 #2)) (remove (where (id "King" #1)))))) (define "EnPassant" (move Step (directions {FR FL}) (to if:"InLocationEnPassant") (then (remove (ahead (last To) Backward))))) (define "InLocationEnPassant" (and (is Pending) (= (to) (value Pending)))) (define "SetEnPassantLocation" (then (set Pending (ahead (last To) Backward)))) (define "BigCastlingVer" ("DecideToCastle" "King" N 2 "KingNotCheckedAndToEmpty" (then ("CastleRook" "RookLeft" S 3 True)))) (define "SmallCastlingVer" ("DecideToCastle" "King" S 2 "KingNotCheckedAndToEmpty" (then ("CastleRook" "RookRight" N 2 True)))) (define "BigCastlingHor" ("DecideToCastle" "King" W 2 "KingNotCheckedAndToEmpty" (then ("CastleRook" "RookLeft" E 3 True)))) (define "SmallCastlingHor" ("DecideToCastle" "King" E 2 "KingNotCheckedAndToEmpty" (then ("CastleRook" "RookRight" W 2 True)))) (define "CastleRook" (slide (from (mapEntry #1 (mover))) #2 (between (exact #3) if:#4) (to if:True (apply ("PieceHasMoved" (from)))))) (define "DecideToCastle" (move Slide (from (mapEntry #1 (mover))) #2 (between (exact #3) if:#4) (to if:True (apply ("PieceHasMoved" (from)))) #5)) (define "KingNotCheckedAndToEmpty" (and (is Empty (to)) (not ("IsInCheck" "King" Mover at:(to))))) (define "RememberPieceHasMoved" (then (if (= (state at:(last To)) 1) ("PieceHasMoved" (last To))))) (define "PieceHasMoved" (set State at:#1 0)) (define "HasNeverMoved" (= (state at:(mapEntry #1 (mover))) 1)) (define "CanNotMove" (not (can Move (do (and (forEach Piece #1) (set NextPlayer (player #2))) ifAfterwards:(not ("IsInCheck" "King" #1)))))) (game "Four-Player Chess" (players {(player N) (player S) (player E) (player W)}) (equipment { (board (merge (shift 0 3 (rectangle 8 14)) (shift 3 0 (rectangle 14 8)))) ("ChessPawn" "Pawn" (or (if (is In (from) (sites Start (piece (what at:(from))))) ("DoubleStepForwardToEmpty" "SetEnPassantLocation")) "EnPassant") (then (and (if (is In (last To) (sites Mover "Promotion")) (moveAgain)) (set Counter)))) ("ChessRook" "Rook" (then (set Counter)) ("RememberPieceHasMoved")) ("ChessKing" "King" (then (set Counter)) ("RememberPieceHasMoved")) ("ChessBishop" "Bishop" (then (set Counter))) ("ChessKnight" "Knight" (then (set Counter))) ("ChessQueen" "Queen" (then (set Counter))) (map "King" {(pair 1 "H1") (pair 2 "H14") (pair 3 "A7") (pair 4 "N7")}) (map "RookLeft" {(pair 1 "D1") (pair 2 "K14") (pair 3 "A11") (pair 4 "N4")}) (map "RookRight" {(pair 1 "K1") (pair 2 "D14") (pair 3 "A4") (pair 4 "N11")}) (regions "Promotion" P1 (sites Top)) (regions "Promotion" P2 (sites Bottom)) (regions "Promotion" P3 (sites Right)) (regions "Promotion" P4 (sites Left))}) (rules (start { (place "Pawn1" (sites Row 1)) (place "Pawn2" (sites Row 12)) (place "Pawn3" (sites Column 1)) (place "Pawn4" (sites Column 12)) (place "Rook1" {"D1" "K1"} state:1) (place "Knight1" {"E1" "J1"}) (place "Bishop1" {"F1" "I1"}) (place "Queen1" coord:"G1") (place "King1" coord:"H1" state:1) (place "Rook2" {"D14" "K14"} state:1) (place "Knight2" {"E14" "J14"}) (place "Bishop2" {"F14" "I14"}) (place "Queen2" coord:"G14") (place "King2" coord:"H14" state:1) (place "Rook3" {"A11" "A4"} state:1) (place "Knight3" {"A10" "A5"}) (place "Bishop3" {"A6" "A9"}) (place "Queen3" coord:"A8") (place "King3" coord:"A7" state:1) (place "Rook4" {"N4" "N11"} state:1) (place "Knight4" {"N5" "N10"}) (place "Bishop4" {"N6" "N9"}) (place "Queen4" coord:"N8") (place "King4" coord:"N7" state:1)}) (play (if "SameTurn" (move Promote (last To) (piece {"Queen" "Knight" "Bishop" "Rook"}) Mover) (do (or (forEach Piece) (if (and ("HasNeverMoved" "King") (not ("IsInCheck" "King" Mover))) (or { (if (and ("HasNeverMoved" "RookLeft") (can Move ("CastleRook" "RookLeft" E 3 (is Empty (to))))) "BigCastlingHor") (if (and ("HasNeverMoved" "RookRight") (can Move ("CastleRook" "RookRight" W 2 (is Empty (to))))) "SmallCastlingHor") (if (and ("HasNeverMoved" "RookLeft") (can Move ("CastleRook" "RookLeft" S 3 (is Empty (to))))) "BigCastlingVer") (if (and ("HasNeverMoved" "RookRight") (can Move ("CastleRook" "RookRight" N 2 (is Empty (to))))) "SmallCastlingVer")}))) ifAfterwards:(not ("IsInCheck" "King" Mover))) (then (and { ("RemoveKingIfCheckmate" P1 1) ("RemoveKingIfCheckmate" P2 2) ("RemoveKingIfCheckmate" P3 3) ("RemoveKingIfCheckmate" P4 4)})))) (end { (forEach NonMover if:("IsOffBoard" (where "King" Player)) (result Player Loss)) (if (and (<= (count Active) 2) (or (no Moves Mover) (= (counter) (* 50 (count Active))))) (result Mover Draw))})))
###
| Once a player is checkmated their king is removed, but all their other pieces remain on the board as neutral obstacles. Neutral pieces cannot help checkmate other players. If a player cannot make a move when there are more than two players remaining, they skip their turn rather than giving a stalemate. Four Players. END |
Modify the Ludii game according to the following option changes:
3 Players. -> 4 Players.
(define "CaptureAgain" (then (if (and (< (count MovesThisTurn) 6) (can Move ("Move" (from (last To))))) (moveAgain) (forEach Site (sites Board) (if (= 1 (state at:(site))) (set State at:(site) 0)))))) (define "Move" (move Hop #1 (between if:(and (is Occupied (between)) (!= 1 (state at:(between))))) (to if:(is Empty (to)) (apply (if (is Even (count MovesThisTurn)) (and { (remove (between)) (if (= (what at:(between)) (id "Marker" Shared)) (addScore Mover 1) (addScore Mover 2)) (forEach Site (sites Board) (if (= 1 (state at:(site))) (and (remove (site)) (if (= (what at:(site)) (id "Marker" Shared)) (addScore Mover 1) (addScore Mover 2)))))}) (set State at:(between) 1)))) #2)) (game "Pasang" (players 3) (equipment { (board (add (remove (square 11) vertices:{48 49 50 59 60 61 70 71 72}) edges:{ {0 12} {12 24} {24 36} {10 20} {20 30} {30 40} {75 87} {87 99} {99 111} {71 81} {81 91} {91 101}}) use:Vertex) (piece "Marker" Shared ("Move" (from) ("CaptureAgain"))) (piece "Disc" Shared ("Move" (from) ("CaptureAgain")))}) (rules (start { (place "Marker" (forEach (sites {0..47 56..63}) if:(is Even (site)))) (place "Disc" (forEach (sites {0..47 56..63}) if:(is Odd (site)))) (place "Marker" (forEach (sites {48..55 64..111}) if:(is Odd (site)))) (place "Disc" (forEach (sites {48..55 64..111}) if:(is Even (site))))}) phases:{ (phase "InitPhase" (play (move Remove (sites Corners) (then (set Score Mover 1)))) (nextPhase "MainPhase")) (phase "MainPhase" (play (if ("SameTurn") (and (move Pass (then (forEach Site (sites Board) (if (= 1 (state at:(site))) (set State at:(site) 0))))) ("Move" (from (last To)) ("CaptureAgain"))) (forEach Piece Shared))))} (end (if (no Moves Next) (byScore)))))
###
| (define "CaptureAgain" (then (if (and (< (count MovesThisTurn) 6) (can Move ("Move" (from (last To))))) (moveAgain) (forEach Site (sites Board) (if (= 1 (state at:(site))) (set State at:(site) 0)))))) (define "Move" (move Hop #1 (between if:(and (is Occupied (between)) (!= 1 (state at:(between))))) (to if:(is Empty (to)) (apply (if (is Even (count MovesThisTurn)) (and { (remove (between)) (if (= (what at:(between)) (id "Marker" Shared)) (addScore Mover 1) (addScore Mover 2)) (forEach Site (sites Board) (if (= 1 (state at:(site))) (and (remove (site)) (if (= (what at:(site)) (id "Marker" Shared)) (addScore Mover 1) (addScore Mover 2)))))}) (set State at:(between) 1)))) #2)) (game "Pasang" (players 4) (equipment { (board (add (remove (square 11) vertices:{48 49 50 59 60 61 70 71 72}) edges:{ {0 12} {12 24} {24 36} {10 20} {20 30} {30 40} {75 87} {87 99} {99 111} {71 81} {81 91} {91 101}}) use:Vertex) (piece "Marker" Shared ("Move" (from) ("CaptureAgain"))) (piece "Disc" Shared ("Move" (from) ("CaptureAgain")))}) (rules (start { (place "Marker" (forEach (sites {0..47 56..63}) if:(is Even (site)))) (place "Disc" (forEach (sites {0..47 56..63}) if:(is Odd (site)))) (place "Marker" (forEach (sites {48..55 64..111}) if:(is Odd (site)))) (place "Disc" (forEach (sites {48..55 64..111}) if:(is Even (site))))}) phases:{ (phase "InitPhase" (play (move Remove (sites Corners) (then (set Score Mover 1)))) (nextPhase "MainPhase")) (phase "MainPhase" (play (if ("SameTurn") (and (move Pass (then (forEach Site (sites Board) (if (= 1 (state at:(site))) (set State at:(site) 0))))) ("Move" (from (last To)) ("CaptureAgain"))) (forEach Piece Shared))))} (end (if (no Moves Next) (byScore))))) END |
Construct a Ludii game based on the following description
The board is drawn in the sand, with any large number of holes in a spiral pattern. The starting point is before the first hole in the outer ring of the spiral, and is made as a mound of sand; the goal is another mound of sand at the center of the spiral. Each player has one piece, which they place on the starting mound. Another piece, the hyena, also begins on the starting mound. Four throwing sticks, with a black side and a white side, used as dice. The values of the throws are as follows: four white sides = 20; three white sides = 5; two white sides = 0; one white sides = 9; all black sides = 80. Players throw, move, and throw again until they throw a 0. When a player reaches the goal, they then play as the hyena on their turn. When the hyena catches up to another player's piece, it drags the piece with it, until throwing a 0. When a 0 is thrown, the player moves back to the place where they were before the hyena dragged them, and must overtake the hyena in this turn. If the player cannot, they are removed from the game. If the player is overtaken by the hyena a second time, they are removed from the game. The game has 4 players.
###
| (define "MoveHyena" (move (from ("WhereHyena") level:("LevelHyena")) (to ("HyenaOnTrack" "Track" ("ThrowValue"))) (then (if (= (last To) ("Center")) (forEach Site (sites Track "Track" from:(last From) to:(last To)) (if (!= (site) (last To)) (forEach Level (site) FromTop (remove (site) level:(level))))) (forEach Site (sites Track "Track" from:(last From) to:(last To)) (if (!= (site) (last To)) (forEach Level (site) FromTop (fromTo (from (site) level:(level)) (to (last To) (apply (if (and (= 0 (state at:(site) level:(level))) (!= 0 (who at:(site) level:(level)))) (if (<= (site) (- (count Vertices) 1)) (set State at:(site) level:(level) (site)))))))))))))) (define "Center" 0) (define "LevelHyena" (where Level "Hyena" Neutral at:("WhereHyena"))) (define "WhereHyena" (if ("IsNotOffBoard" (where "Hyena" Neutral)) (where "Hyena" Neutral) (handSite P1))) (define "HyenaPhaseDone" (or (= ("WhereHyena") ("Center")) (and { (is Occupied ("Center")) (>= 1 (count Sites in:(difference (sites Occupied by:All) ("WhereHyena")))) ("IsSingletonStack" ("WhereHyena"))}))) (define "HyenaOnTrack" ("NextSiteOnTrack" #2 from:("WhereHyena") #1)) (define "SiteToMoveOnTrack" ("NextSiteOnTrack" #2 #1)) (define "NotThrow0" (!= ("ThrowValue") 0)) (define "ThrowValue" (mapEntry "Throw" (count Pips))) (game "Ishighan" (players 4) (equipment { (board (spiral turns:5 sites:86) { (track "Track" {86..0} directed:True)} use:Vertex) ("StickDice" 4) (map "Throw" {(pair 0 20) (pair 1 5) (pair 2 0) (pair 3 9) (pair 4 80)}) (piece "Stick" Each (if ("IsOffBoard" ("SiteToMoveOnTrack" "Track" ("ThrowValue"))) (move (from (from) level:(level)) (to 0) (then (if (= 1 (value Player Mover)) (forEach Site (sites Track "Track" from:(last From) to:(last To)) (forEach Level (site) FromTop (if ("IsPieceAt" "Hyena" Neutral (site) level:(level)) (set Value Mover 2))))))) (move (from (from) level:(level)) (to ("SiteToMoveOnTrack" "Track" ("ThrowValue")) if:True) (then (if (= 1 (value Player Mover)) (forEach Site (sites Track "Track" from:(last From) to:(last To)) (forEach Level (site) FromTop (if ("IsPieceAt" "Hyena" Neutral (site) level:(level)) (set Value Mover 2)))))))) maxState:85) (piece "Hyena" Neutral) (hand P1)}) (rules (start { (place Stack items:{"Stick4" "Stick3" "Stick2" "Stick1"} (handSite P1)) (place Stack "Hyena0" (handSite P1))}) (play ("RollMove" (if (= ("Center") (where "Stick" Mover)) (if ("NotThrow0") ("MoveHyena") (move Pass (then (forEach Site (sites Board) (forEach Level (site) FromTop (if (!= 0 (state at:(site) level:(level))) (if (< 0 (value Player (who at:(site) level:(level)))) (remove (site) level:(level)) (fromTo (from (site) level:(level)) (to (state at:(site) level:(level)) (apply (and (set State at:(site) level:(level) 0) (set Value (player (who at:(site) level:(level))) 1)))))))))))) (if ("NotThrow0") (or (forEach Piece) (forEach Piece container:1)) (move Pass (then (if (= 1 (value Player Mover)) (remove (where "Stick" Mover) level:(where Level "Stick" Neutral at:(where "Stick" Mover)))))))) (then (if ("NotThrow0") (moveAgain))))) (end { (forEach Player if:(no Pieces Player) (result Player Loss)) (forEach Player if:("HyenaPhaseDone") (result Player Win))}))) END |
Construct a Ludii game based on the following description
When a capture is made, the capturing piece is revealed to the opponent. If an orthogonal move is attempted to a spot with a hidden piece of the opponent, the move is not completed and the enemy piece is revealed. The goal is to reach the opposite side of the board like in Breakthrough.
###
| (define "RegionReached" (not (= (count Sites in:(sites Occupied by:Mover)) (count Sites in:(difference (sites Occupied by:Mover) (sites Next)))))) (define "Moves" (or { "StepForwardToEmpty" (move Step Forward (to if:(and ("IsEnemyAt" (to)) (is Hidden at:(to) to:Mover))) (then (fromTo (from (last To)) (to (last From)) (then (and { (add (piece (next)) (to (last To))) (set Hidden at:(last To) False to:Next) (set Hidden at:(last To) False to:Mover)}))))) (move Step (directions {FR FL}) (to if:(is Empty (to)) (apply (remove (to))))) (move Step (directions {FR FL}) (to if:("IsEnemyAt" (to)) (apply (remove (to)))) (then (set Hidden at:(last To) to:Next)))})) (game "Sneakthrough" (players 2) (equipment { (board (square 8)) (piece "Pawn" P1 N "Moves") (piece "Pawn" P2 S "Moves") (regions P2 (sites Top)) (regions P1 (sites Bottom))}) (rules (start { (place "Pawn1" (expand (sites Bottom))) (place "Pawn2" (expand (sites Top))) (set Hidden (difference (sites Board) (sites Occupied by:P1)) to:P1) (set Hidden (difference (sites Board) (sites Occupied by:P2)) to:P2)}) (play (forEach Piece)) (end (if "RegionReached" (result Mover Win))))) END |
Construct a Ludii game based on the following description
The board is initially empty. Each player chooses a colour: White or Black. White starts by placing a stone on a vacant square. Black does the same.
Players continue taking turns; however, your turn goes as follows: 1. Mark one of your exposed stones for removal from the board (i.e. it cannot be under an enemy stone). 2. Add one of your stones to the board. 3. Add another one of your stones to the board, at which point the marked stone is removed. The following rules constrain where you can add each stone: It must be a “knight’s move” away from the marked stone. That is to say, either 2 spaces vertically and 1 horizontally, or 2 spaces horizontally, and 1 vertically away from the marked stone. The space on which you place it must have none of your stones, and either: be vacant, or have an enemy stone, in which case you will place yours on top, creating a stack that you control. If, at the end of your opponent’s turn, you have at least 5 of your stones and/or stacks in the same rank, or in the same file, you win.
###
| (define "OpponentCount" (count Sites in:("OpponentSites" #1 #2))) (define "OpponentSites" (intersection (sites #1 #2) (sites Occupied by:Next container:"Board"))) (define "MoveSecondKnight" (move Add (to ("PossibleKnightSites" (var "CondemnedSite"))) stack:True (then (remove (var "CondemnedSite"))))) (define "MoveFirstKnight" (move Add (to ("PossibleKnightSites" (var "CondemnedSite"))) stack:True (then (do (set Pending) next:(moveAgain))))) (define "MoveCondemnPiece" (move Select (from if:(and ("IsTopLevel" (from)) (<= 2 (count Sites in:("PossibleKnightSites" (from)))))) (then (do (set Var "CondemnedSite" (last From)) next:(do (set State at:(var "CondemnedSite") ("CondemnedState")) next:(moveAgain)))))) (define "PossibleKnightSites" (sites To (move Leap (from #1) { { F F R F} { F F L F} { F R F F} { F L F F}} (to if:("CanPlaceKnight"))))) (define "CanPlaceKnight" (or (is Empty (to)) (and ("IsEnemyAt" (to)) ("IsEmptyOrSingletonStack" (to))))) (define "CondemnedState" 1) (game "Callanish" (players 2) (equipment { (board (square 9)) (piece "Disc" Each ("MoveCondemnPiece"))}) (rules phases: { (phase "Opening" (play (move Add (to (sites Empty)))) (nextPhase (>= (count Turns) 2) "Playing")) (phase "Playing" (play (if "SameTurn" (if (is Pending) ("MoveSecondKnight") ("MoveFirstKnight")) (forEach Piece))))} (end { (if (and (= (% (- (count Moves) 2) 3) 0) (or { (<= 5 ("OpponentCount" Row 0)) (<= 5 ("OpponentCount" Row 1)) (<= 5 ("OpponentCount" Row 2)) (<= 5 ("OpponentCount" Row 3)) (<= 5 ("OpponentCount" Row 4)) (<= 5 ("OpponentCount" Row 5)) (<= 5 ("OpponentCount" Row 6)) (<= 5 ("OpponentCount" Row 7)) (<= 5 ("OpponentCount" Row 8)) (<= 5 ("OpponentCount" Column 0)) (<= 5 ("OpponentCount" Column 1)) (<= 5 ("OpponentCount" Column 2)) (<= 5 ("OpponentCount" Column 3)) (<= 5 ("OpponentCount" Column 4)) (<= 5 ("OpponentCount" Column 5)) (<= 5 ("OpponentCount" Column 6)) (<= 5 ("OpponentCount" Column 7)) (<= 5 ("OpponentCount" Column 8))})) (result Mover Loss)) (if (no Moves Mover) (result Mover Loss))}))) END |
Construct a Ludii game based on the following description
2x12 board, divided in half, where the spaces are rendered as points. Fifteen pieces per player. Three six-sided dice. The points form a continuous track in a horseshoe shape; each player progresses in opposite directions, one from their bottom right to the top right, the other from their bottom left to their top left. Pieces begin on the board, each player with eight pieces on the sixth and seven on the seventh point of their track. 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 piece cannot move to a point that is occupied by more than one of the opponent's pieces. If a piece lands on a point occupied by a single piece belonging to the opponent, the opponent's piece is removed from the board and must enter again from the beginning of the player's track. A piece may be borne off the board when a throw is greater than the number of points left on the board. The first player to bear all of their pieces off the board wins.
###
| (define "CanEscape" ("IsOffBoard" #1)) (define "AllPieceEscaped" (no Pieces Mover)) (define "Bar" (mapEntry (mover))) (define "RemoveAPiece" (move Remove (site))) (define "NextSiteFromDist6" ("NextSiteOnTrack" 6 from:#1)) (define "NextSiteFrom" ("NextSiteOnTrack" (pips) from:#1)) (game "Provincial" (players 2) (equipment { ("BackgammonBoard" ("BackgammonTracksWithBar")) (dice num:3) (map {(pair 1 19) (pair 2 6)}) (piece "Disc" Each)}) (rules (start { (place Stack "Disc1" 7 count:8) (place Stack "Disc1" 5 count:7) (place Stack "Disc2" 20 count:8) (place Stack "Disc2" 18 count:7)}) (play ("RollEachNewTurnMove" (forEach Die if:("DieNotUsed") (forEach Site (sites Occupied by:Mover) (if ("CanEscape" ("NextSiteFrom" (site))) ("RemoveAPiece") (move (from (site)) (to ("NextSiteFrom" (site)) if:("NoEnemyOrOnlyOne" (to)) ("HittingCapture" ("Bar")))))) (then ("ReplayNotAllDiceUsed"))))) (end (if ("AllPieceEscaped") (result Mover Win))))) END |
Construct a Ludii game based on the following description
8x8 board. Twelve pieces per player. Pieces move diagonally one space forward, and can capture opponent's pieces by jumping them in a forward direction if they are adjacent. Capturing must happen if it is possible. Multiple captures are allowed. Once pieces reach the opposite side of the board from their starting position, they become kings and can move diagonally either forwards or backwards, and can capture by jumping over any number of pieces, any distance. The goal is to capture all of the opponent's pieces.
###
| (define "IsUnpromoted" ("IsPieceAt" "Counter" Mover (last To))) (game "Main Dam" ("TwoPlayersNorthSouth") ("DraughtsEquipment" (square 8)) (rules ("BlackCellsSetup" 3) (play (if "SameTurn" (if "IsUnpromoted" ("HopCapture" (from (last To)) (directions {FR FL}) (then ("PromoteIfReach" (sites Next) "DoubleCounter" ("ReplayIfCanMove" ("HopCapture" (from (last To)) (directions {FR FL})))))) ("HopDiagonalSequenceCaptureAgain" before:(count Rows) after:(count Rows))) (priority { (or (forEach Piece "Counter" ("HopCapture" (from) (directions {FR FL}) (then ("PromoteIfReach" (sites Next) "DoubleCounter" ("ReplayIfCanMove" ("HopCapture" (from (last To)) (directions {FR FL}))))))) (forEach Piece "DoubleCounter" ("HopDiagonalSequenceCapture" before:(count Rows) after:(count Rows)))) (or (forEach Piece "Counter" ("StepToEmpty" (directions {FR FL})) (then ("PromoteIfReach" (sites Next) "DoubleCounter"))) (forEach Piece "DoubleCounter" (move Slide Diagonal)))}))) (end ("BlockWin")))) END |
Describe the mechanics of the following Ludii game
(game "Hund efter Hare (Vendsyssel)" (players 2) (equipment { (board (add (merge { (add (remove (rectangle 1 7) vertices:{3}) edges:{{2 3}}) (scale 2 (shift 0.5 -0.5 (rectangle 1 3))) (scale 2 (shift 0.5 0.5 (rectangle 1 3)))}) edges:{ {0 9} {0 6} {11 5} {5 8} {1 6} {1 9} {4 11} {4 8} {9 2} {2 7} {6 2} {2 10} {10 3} {3 8} {7 3} {3 11}}) use:Vertex) (piece "Hare" P1 "StepToEmpty") (piece "Dog" P2 "StepToEmpty")}) (rules (start { (place "Hare1" coord:"B2") (place "Dog2" (sites {"A2" "B1" "B3"}))}) (play (forEach Piece)) (end { (if (no Moves P1) (result P2 Win))})))
###
| Three diamonds in a row, the central one connecting to the others one opposite corners. A horizontal line connects the top corners of the diamonds, another horizontal line connects the bottom corners of the diamonds, and a longer horizontal line connects all the middle corners. The outer two diamonds have vertical lines connecting their top and bottom corners. One player plays as three hounds, which begin on the outer corner and top and bottom corner of one of the end diamonds. The other player plays as one hare, which begins on the central point of the same diamond. Players alternate turns moving a piece to an empty adjacent spot along the lines of the board. The Hare moves first. The hounds win by blocking the hare from being able to move. The game has an ending condition only for P2. END |
Describe the mechanics of the following Ludii game
(define "SiteToMoveOnTrack" ("NextSiteOnTrack" #2 #1)) (define "ThrowValue" (if (= 1 (count Pips)) 1 (if (= 4 (count Pips)) 5 (if (= 0 (count Pips)) 10 (if (= 2 (count Pips)) (if (or (= 0 ("BlankDie1")) (= 0 ("BlankDie2"))) 2 35) (if (or (= 0 ("BlankDie1")) (= 0 ("BlankDie2"))) 3 (if (= 0 ("StripedDie")) 20 15))))))) (define "BlankDie2" (face 74)) (define "BlankDie1" (face 73)) (define "CrossHatchingDie" (face 72)) (define "StripedDie" (face 71)) (game "Kolica Atarakua" (players 2) (equipment { (board (add (merge { (rectangle 1 10) (shift 0 9 (rectangle 1 10)) (shift -1 -1 (square 2)) (shift 9 -1 (square 2)) (rectangle 10 1) (shift 9 0 (rectangle 10 1)) (shift -1 9 (square 2)) (shift 9 9 (square 2)) (shift 5 0 (rectangle 6 1)) (shift 0 5 (rectangle 1 6)) (shift 4 4 (rectangle 1 6)) (shift 4 4 (rectangle 6 1))}) vertices:{{1 1} {1 8} {8 1} {8 8} {4.5 4.5}}) { (track "Track1" "69,5,N,W,N,W,S,65,11,E,N,W,67,41,S,E,N,66,8,W,S,E,64,26,N4,E3,68,56" P1 directed:True) (track "Track2" "70,14,S,E,S,E,N,66,8,W,S,E,64,26,N,W,S,65,11,E,N,W,67,41,S4,W3,68,56" P2 directed:True)} use:Vertex) ("StickDice" 4) (piece "Marker" Each (if ("IsOffBoard" ("SiteToMoveOnTrack" from:(from) ("ThrowValue"))) (move Remove (from) level:(level)) (move (from (from) level:(level)) (to ("SiteToMoveOnTrack" from:(from) ("ThrowValue")) if:True ("HittingStackCapture" (handSite (who at:(to) level:(level))))) (then (if (is In (last To) (sites "RemoveSites")) (fromTo (from (last To)) (to (handSite (mover))))))))) (hand Each) (regions "RemoveSites" (sites {51 56}))}) (rules (start { (place Stack "Marker1" (handSite P1) count:4) (place Stack "Marker2" (handSite P2) count:4)}) (play ("RollMove" (or (forEach Piece) (forEach Piece container:(mover))))) (end ("EscapeWin"))))
###
| Two players. Four pieces per player, played with four stick dice. They are round on one side, flat on the other, and the round side of one has horizontal stripes, another has cross-hatching, the other two remaining blank. The throws are as follows: One flat side up = 1; two flat sides and at least one blank round side up = 2; two flat sides and both marked round sides up = 35; four flat sides up = 5; four round sides up = 10; three flat sides and one blank round side up = 3; three flat sides and cross-hatched round side up = 15; three flat sides and striped round side up = 20. The throw may only be applied to one piece. Pieces enter from the midpoint of the sides and proceed along the track in the middle, then back to the edge following that track and making a circuit of the board, returning back to the center when it has traveled along the entire perimeter. If a piece lands exactly on the points where the tracks cross in the center, the piece starts again from the beginning, but remains in the center of the board until it does so. The goal is for pieces to pass the points where the center tracks intersect after traveling all the way around the board with all four pieces. If a player lands on the same space as an opponent's piece, the opponent's piece must again start from the beginning. END |
Construct a Ludii game based on the following description
2x6 board with two stores. Five counters in each hole. Sowing occurs in an anti-clockwise direction. When the final counter lands in a hole in the opponent's row containing one or two counters, thus making it contain two or three counters, they are captured. Any other holes in the opponent's row which also contain two or three counters, in an unbroken sequence preceding the hole where the first capture was made, are captured. When a player sows around the board, the hole from which the counters were taken is left empty. Play ends when one player cannot play from their row, and players capture any remaining counters in their holes. The player with the most counters wins. The seeds have a normal size.
###
| (define "PiecesOwnedBy" (+ (count at:(mapEntry #1)) (count in:(sites #1)))) (define "Columns" 6) (game "Shono" (players 2) (equipment { (mancalaBoard 2 "Columns" (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 5 to:(sites Track))) (play (move Select (from (sites Mover) if:(< 0 (count at:(from)))) (then (sow if:(and (is In (to) (sites Next)) (or (= (count at:(to)) 2) (= (count at:(to)) 3))) apply:(fromTo (from (to)) (to (mapEntry (mover))) count:(count at:(to))) includeSelf:False backtracking:True)))) (end ("MancalaByScoreWhen" (no Moves Mover))))) END |
Construct a Ludii game based on the following description
The abstract strategy game Quoridor is surprisingly deep for its simple rules. The object of the game is to advance your pawn to the opposite edge of the board. On your turn you may either move your pawn or place a wall. You may hinder your opponent with wall placement, but not completely block them off. Meanwhile, they are trying to do the same to you. The first pawn to reach the opposite side wins. The game has 2 players
###
| (define "NumPlayers" 2) (define "SizePath" (count Steps (step Orthogonal (to if:(and (is Empty (to)) ("NoEdgeBetweenCells" (from) (to))))) (where "Pawn" #1) (sites #1))) (define "ReachedTarget" (and (is LastTo Cell) (is In (last To) (sites Mover)))) (define "NoEdgeBetweenCells" (all Sites (sites Occupied by:Shared on:Edge) if:(not (is In (site) ("EdgeInCommon" #1 #2))))) (define "EdgeInCommon" (intersection (sites Incident Edge of:Cell at:#1) (sites Incident Edge of:Cell at:#2))) (game "Quoridor" (players "NumPlayers") (equipment { (board (square 9)) (piece "Pawn" Each (or (move Step Orthogonal (to if:(and (is Empty (to)) ("NoEdgeBetweenCells" (from) (to))))) (move Hop Orthogonal (between if:("IsEnemyAt" (between))) (to if:(and { (is Empty (to)) ("NoEdgeBetweenCells" (from) (between)) ("NoEdgeBetweenCells" (between) (to))}))))) (piece "Rectangle" Shared) (hand Each) (regions P1 (sites Top)) (regions P2 (sites Bottom))}) (rules (start { (place "Rectangle" (handSite P1) count:10) (place "Rectangle" (handSite P2) count:10) (place "Pawn1" (intersection (sites Bottom) (sites Column (column of:(centrePoint))))) (place "Pawn2" (intersection (sites Top) (sites Column (column of:(centrePoint)))))}) (play (or (do (if (is Occupied (handSite Mover)) (move (from (handSite Mover)) (to Edge (difference (sites Empty Edge) (sites Outer Edge))))) ifAfterwards:(and { (!= Infinity ("SizePath" P1)) (!= Infinity ("SizePath" P2))})) (forEach Piece))) (end (if "ReachedTarget" (result Mover Win))))) END |
Describe the mechanics of the following Ludii game
(define "IsFirstCheck" (is Pending)) (define "SetFirstCheck" (set Pending)) (define "RememberKingMovedOrChecked" (set State at:#1 1)) (define "KingMovedOrCheckedBefore" (= 1 (state at:#1))) (define "RookMovedBefore" (= 1 (state at:#1))) (define "RememberRookMoved" (set State at:#1 1)) (define "KingSites" (sites {"E8" "D1"})) (define "SitesNextToKing" (sites {"C1" "E1" "D8" "F8"})) (game "Main Chator" ("TwoPlayersNorthSouth") (equipment { (board (square 8)) (piece "King_noCross" (or ("StepToNotFriend" ~ (then (if (not ("KingMovedOrCheckedBefore" (last To))) ("RememberKingMovedOrChecked" (last To))))) (if ("IsFirstCheck") (or { ("SlideCapture" ~ (between (exact 2))) ("LeapCapture" "KnightWalk") (if (is In (from) ("KingSites")) (or (if (and { (is Empty (ahead (from) steps:2 W)) ("IsPieceAt" "Rook" Mover (ahead (from) W)) (not ("RookMovedBefore" (ahead (from) W)))}) (move (from) (to (ahead (from) steps:2 W)))) (if (and { (is Empty (ahead (from) steps:2 E)) ("IsPieceAt" "Rook" Mover (ahead (from) E)) (not ("RookMovedBefore" (ahead (from) E)))}) (move (from) (to (ahead (from) steps:2 E))))))})))) ("ChessRook" "Rook" ~ (then (if (and (not ("RookMovedBefore" (last To))) (not (is In (last To) ("SitesNextToKing")))) ("RememberRookMoved" (last To))))) ("ChessBishop" "Bishop_noCross") ("ChessKnight" "Knight") (piece "Pawn" (if (= 1 (state at:(from))) ("StepToEmpty" (directions {Rightward Leftward}) (then (set State at:(last To) 2))) (if (= 2 (state at:(from))) ("StepToEmpty" (directions {BR BL Rightward Leftward}) (then (promote (last To) (piece "Queen") Mover))) (or { "StepForwardToEmpty" ("StepToEnemy" (directions {FR FL}))} (then (if (is In (last To) (sites Mover "Promotion")) (if (is In (last To) (sites Corners)) (promote (last To) (piece "Queen") Mover) (set State at:(last To) 1)))))))) ("ChessQueen" "Queen") (regions "Promotion" P1 (sites Top)) (regions "Promotion" P2 (sites Bottom))}) (rules (start { (place "Pawn1" (sites Row 1)) (place "Pawn2" (sites Row 6)) (place "Rook1" {"A1" "H1"}) (place "Knight1" {"B1" "G1"}) (place "Bishop_noCross1" {"C1" "F1"}) (place "Queen1" coord:"E1") (place "King_noCross1" coord:"D1") (place "Rook2" {"A8" "H8"}) (place "Knight2" {"B8" "G8"}) (place "Bishop_noCross2" {"C8" "F8"}) (place "Queen2" coord:"D8") (place "King_noCross2" coord:"E8")}) (play (do (forEach Piece) ifAfterwards:(not ("IsInCheck" "King_noCross" Mover)) (then (if ("IsInCheck" "King_noCross" Next) (if (not ("KingMovedOrCheckedBefore" (where "King_noCross" Next))) (and ("RememberKingMovedOrChecked" (where "King_noCross" Next)) ("SetFirstCheck"))))))) (end ("Checkmate" "King_noCross"))))
###
| Played on an 8x8 board with pieces with specialized moves. The pieces are as follows, and placed on the outer rank in the following order, starting from the left corner and moving in, with the placement mirrored on the right side (the Mautri is placed to the right of the Rajah): Tor (2): can move any number of spaces orthogonally; Kudah (2): moves in any direction, one space orthogonally with one space forward diagonally, jumping over any intervening pieces; Gajah (2): can move any number of spaces diagonally; Rajah (1): can move one space orthogonally or diagonally; Mautri (1): can move any number of spaces orthogonally or diagonally; Bidah (8), placed in front of the other pieces: can move one space forward, or one space diagonally to capture. The Bidah are placed on the second file. When first checked, the Rajah may move like a Kudah, or move two spaces in any direction. Players capture pieces by moving onto a space occupied by an opponent's piece. Castling may occur in two separate moves: the Tor moves next to the Rajah, and if the Rajah is checked, it may move to the other side of the Tor. Promotion of Bidahs occur when they reach the opposite edge of the board, but only immediately if they reach the Tor's square. Pawns reaching any other square must make two further moves before they can be promoted; the first must be a lateral orthogonal move, the second may be lateral orthogonal or diagonal. If the Rajah can be captured on the opponent's next turn, it is in check. The Rajah must not be in check at the end of the player's turn. If this is impossible, it is checkmate and the opponent wins. END |
Construct a Ludii game based on the following description
4x8 board, played only along the perimeter. One to four counters per hole. Any number of players, holes are distributed equally among the players. Sowing occurs in an anti-clockwise direction. Each player owns the holes in which their counters are located at the beginning of their turn, and they must sow from the leftmost hole. When a counter falls into a hole containing counters belonging to the opponent, this hole and the counters in it are captured by the player, but remain in place and in play. When a player has a single counter and empty holes in from of it, this counter leaps to the next hole occupied by the opponent. The player who captures all of the opponent's holes wins. 4 seeds per hole. The board is a 4x8.
###
| (define "LeftMost" (trackSite FirstSite from:(trackSite FirstSite if:(not (is Mover (who at:(to))))) if:(is Mover (who at:(to))))) (define "NumSeed" 4) (define "Columns" 8) (game "Quendo" (players 4) (equipment { (mancalaBoard 4 "Columns" store:None { (track "Track" "0,E,N,W,S2" loop:True)}) (piece "Seed" Each) (hand Each)}) (rules (start { (place "Seed1" (sites {0..4}) counts:{"NumSeed"}) (place "Seed2" (sites {5..7 15 23}) counts:{"NumSeed"}) (place "Seed3" (sites {31..27}) counts:{"NumSeed"}) (place "Seed4" (sites {26..24 16 8}) counts:{"NumSeed"})}) (play (if (!= 1 (count Pieces Mover)) (move Select (from ("LeftMost")) (then (sow sowEffect:(if (and (!= (mover) (what at:(to))) (is Occupied (to))) (and (remove (to) count:(count at:(to))) (add (piece (id "Seed" Mover)) (to (to)) count:(count at:(to)))))))) (move (from ("LeftMost")) (to (trackSite FirstSite from:(from) if:("IsEnemyAt" (to))) (apply (and (remove (to) count:(count at:(to))) (add (piece (id "Seed" Mover)) (to (to)) count:(count at:(to))))))))) (end (forEach NonMover if:(no Pieces Player) (result Player Loss))))) END |
Construct a Ludii game based on the following description
The dilemma is repeated 10 times:
- If the two players are cooperating (C), they get 6 points.
- If the two players are defecting (D), they get 2 points.
- If one player is cooperating (C) and the other is defecting (D), the first one gets 0 points and the second one gets 10 points.
###
| (define "DefectP2" (= 1 (var "Choice2"))) (define "CooperateP2" (= 0 (var "Choice2"))) (define "DefectP1" (= 1 (var "Choice1"))) (define "CooperateP1" (= 0 (var "Choice1"))) (define "P2IsDefecting" (set Var "Choice2" 1)) (define "P2IsCooperating" (set Var "Choice2" 0)) (define "P1IsDefecting" (set Var "Choice1" 1)) (define "P1IsCooperating" (set Var "Choice1" 0)) (game "Iterated Prisoners Dilemma" (players 2) (mode Simultaneous) (equipment { (board (square 2))}) (rules (play (or { (move Select (from 0) P1 (then ("P1IsCooperating"))) (move Select (from 1) P1 (then ("P1IsDefecting"))) (move Select (from 2) P2 (then ("P2IsCooperating"))) (move Select (from 3) P2 (then ("P2IsDefecting")))} (then (if (and ("CooperateP1") ("CooperateP2")) (and (addScore P1 3) (addScore P2 3)) (if (and ("DefectP1") ("DefectP2")) (and (addScore P1 1) (addScore P2 1)) (if (and ("CooperateP1") ("DefectP2")) (and (addScore P1 0) (addScore P2 5)) (and (addScore P1 5) (addScore P2 0))))) applyAfterAllMoves:True))) (end (if (= (counter) 8) (byScore))))) END |
Modify the Ludii game according to the following option changes:
The game is played on the Graph2. -> The game is played on the Graph3.
(game "SpanRups" (players 1) (equipment { (board (graph vertices:{ {1 0} {3 0} {5 0} {6 0} {7 0} {8 0} {10 0} {11 0} {12 0} {0 2} {3 2} {5 2} {8 2} {11 2} {2 3} {7 3} {1 4} {12 4} {2 5} {5 5} {8 5} {10 5} {2 7} {6 7} {10 7}{1 8} {4 9} {7 9} {10 9} {1 10} {5 10} {10 10} {1 12} {4 12} {7 12} {9 12}} edges:{ {0 10} {1 10} {2 11} {3 11} {4 12} {5 12} {6 13} {7 13} {8 13} {10 19} {16 10} {9 10} {11 19} {15 20} {12 20} {13 20} {13 17} {14 10} {18 23} {19 23} {20 23} {20 24} {21 20} {23 26} {22 26} {26 33} {26 32} {26 29} {26 25} {23 27} {27 34} {30 27} {27 35} {31 27} {27 28} {24 33} {2 3} {30 35} {34 31} {10 18} {28 34} {6 20} {27 24} {21 17} {23 31} {9 25} {20 31} {15 30} {32 22} {23 25} {19 26} {18 19} {0 16} {9 1} {1 11} {2 15} {5 11} {4 19} {12 21} {17 8}}) use:Edge) (piece "Marker" Each)}) (rules (play (move Add (to Edge (sites Empty Edge)))) (end { (if (no Moves Mover) (result Mover Loss)) (if (is SpanningTree Mover) (result Mover Win))})))
###
| (game "SpanRups" (players 1) (equipment { (board (graph vertices:{ {6 0} {5 5} {9 5} {0 7} {2 7} {7 7} {12 7} {14 7} {5 9} {9 9} {6 14}} edges:{ {0 1} {0 2} {0 3} {0 4} {0 5} {0 6} {0 7} {0 10} {3 4} {4 5} {5 6} {6 7} {1 4} {1 5} {2 5} {2 6} {4 8} {5 8} {5 9} {6 9} {3 10} {4 10} {8 10} {5 10} {9 10} {6 10} {7 10}}) use:Edge) (piece "Marker" Each)}) (rules (play (move Add (to Edge (sites Empty Edge)))) (end { (if (no Moves Mover) (result Mover Loss)) (if (is CaterpillarTree Mover) (result Mover Win))}))) END |
Modify the Ludii game according to the following option changes:
2 Tigers. -> 3 Tigers.
6 Goats. -> 7 Goats.
(game "Pulijudamu" (players 2) (equipment { (board (add (remove (merge (scale 1 2 (wedge 5 3)) (shift 0 2 (scale 8 2 (rectangle 3 2)))) edges:{{17 18} {15 16} {13 14}}) edges:{{13 7} {15 4} {17 1} {3 18} {6 16} {9 14}}) use:Vertex) (hand Each) (piece "Goat" P2 ("StepToEmpty")) (piece "Tiger" P1 (or ("StepToEmpty") ("HopCapture")))}) (rules (start { (place "Goat2" (handSite P2) count:6) (place "Tiger1" (handSite P1) count:2)}) phases:{ (phase "Opening" P1 (play (move (from (handSite Mover)) (to (if (= 0 (count Sites in:(intersection (sites Top) (sites Occupied by:Mover)))) (sites Top) (intersection (sites Empty) (sites {1 2 3})))) (then (if ("HandOccupied" Mover) (moveAgain))))) (nextPhase Mover ("HandEmpty" Mover) "Movement")) (phase "Opening" P2 (play (move (from (handSite Mover)) (to (sites Empty)))) (nextPhase Mover ("HandEmpty" Mover) "Movement")) ("PhaseMovePiece" "Movement")} (end ("NoMovesP1NoPiecesP2"))))
###
| (game "Pulijudamu" (players 2) (equipment { (board (add (remove (merge (scale 1 2 (wedge 5 3)) (shift 0 2 (scale 8 2 (rectangle 3 2)))) edges:{{17 18} {15 16} {13 14}}) edges:{{13 7} {15 4} {17 1} {3 18} {6 16} {9 14}}) use:Vertex) (hand Each) (piece "Goat" P2 ("StepToEmpty")) (piece "Tiger" P1 (or ("StepToEmpty") ("HopCapture")))}) (rules (start { (place "Goat2" (handSite P2) count:7) (place "Tiger1" (handSite P1) count:3)}) phases:{ (phase "Opening" P1 (play (move (from (handSite Mover)) (to (if (= 0 (count Sites in:(intersection (sites Top) (sites Occupied by:Mover)))) (sites Top) (intersection (sites Empty) (sites {1 2 3})))) (then (if ("HandOccupied" Mover) (moveAgain))))) (nextPhase Mover ("HandEmpty" Mover) "Movement")) (phase "Opening" P2 (play (move (from (handSite Mover)) (to (sites Empty)))) (nextPhase Mover ("HandEmpty" Mover) "Movement")) ("PhaseMovePiece" "Movement")} (end ("NoMovesP1NoPiecesP2")))) END |
Construct a Ludii game based on the following description
5x5 intersecting lines, with diagonals drawn in each quadrant. One player plays as four tigers, places on the four corners of the board. The other player plays as twenty goats, which are placed on the remaining points, leaving the central point open. Players alternate turns moving a piece to an empty adjacent point along the lines. The tigers may capture a goat by hopping over it to an empty adjacent spot immediately on the opposite side of the goat along the lines. The tigers win when they capture all of the goats; the goats win by blocking the tigers from being able to move.
###
| (game "Kulaochal" (players 2) (equipment { ("AlquerqueBoard" 5 5) (piece "Tiger" P1 (or ("StepToEmpty") ("HopCapture"))) (piece "Goat" P2 ("StepToEmpty"))}) (rules (start { (place "Tiger1" (sites Corners)) (place "Goat2" (difference (sites Board) (union (sites Corners) (sites Centre))))}) (play (forEach Piece)) (end ("NoMovesP1NoPiecesP2")))) END |
Construct a Ludii game based on the following description
Played on a 19x19 board. The board begins empty. One player plays as black, the other as white. The black player begins by placing a piece on one of the intersections on the board. Players alternate turns placing a piece on the board. A player may pass at any time. A piece or a group of pieces are captured when they are completely surrounded on all sides on adjacent intersections by the opposing player. Stones cannot be placed to recreate a previous position. The game ends when both players pass consecutively. Players total the number of intersections their pieces occupy or surround. The player with the highest total wins. The game is played on a 19x19 board
###
| (define "CaptureSurroundedPiece" (enclose (from (last To)) Orthogonal (between if:("IsEnemyAt" (between)) (apply (and (addScore Mover 1) (remove (between))))))) (game "Go" (players 2) (equipment { (board (square 19) use:Vertex) (piece "Marker" Each)}) (rules (meta (no Repeat)) (play (or (do (move Add (to (sites Empty)) (then "CaptureSurroundedPiece")) ifAfterwards:("HasFreedom" Orthogonal)) (move Pass))) (end (if (all Passed) (byScore { (score P1 (+ (score P1) (size Territory P1))) (score P2 (+ (score P2) (size Territory P2)))}))))) END |
Modify the Ludii game according to the following option changes:
Hex N / N-1 Grid -> Hex Grid - Standard
Order 3 board -> Order 5 board
(define "DoubleMove" (then (if (and (is Prev Next) (not (was Pass))) (moveAgain)))) (define "HexCell" (board (hex Hexagon 3) use:Cell)) (define "Hex2Limp" (board (hex (- 3 1) (+ 3 1)) use:Cell)) (define "HexLimp" (board (hex Limping (- 3 1)) use:Cell)) (define "BoardUsed" "HexLimp") (define "Connection" Orthogonal) (define "ScoreHalf" (forEach Piece (if (= (* 2 (count Pieces Mover in:(sites Around (from) Orthogonal))) (count Sites in:(sites Around (from) Orthogonal))) (set State at:(from) 1) (set State at:(from) 0)) (then (set Score Mover (count Sites in:(intersection (sites Occupied by:Mover) (sites State 1))))))) (define "Score3" (forEach Piece (if (= 3 (count Pieces Mover in:(sites Around (from) Orthogonal))) (set State at:(from) 1) (set State at:(from) 0)) (then (set Score Mover (count Sites in:(intersection (sites Occupied by:Mover) (sites State 1))))))) (game "Goldilocks Stones" (players 2) (equipment { "BoardUsed" (piece "Ball" P1) (piece "Ball" P2)}) (rules (start (set Score Each 0)) (play (or (move Pass) (move Add (piece (mover)) (to (sites Empty)) (then "ScoreHalf")))) (end (if (all Passed) { (if (= (score Mover) (score Next)) (result Mover Loss)) (if (!= (score Mover) (score Next)) (byScore))}))))
###
| (define "DoubleMove" (then (if (and (is Prev Next) (not (was Pass))) (moveAgain)))) (define "HexCell" (board (hex Hexagon 5) use:Cell)) (define "Hex2Limp" (board (hex (- 5 1) (+ 5 1)) use:Cell)) (define "HexLimp" (board (hex Limping (- 5 1)) use:Cell)) (define "BoardUsed" "HexCell") (define "Connection" Orthogonal) (define "ScoreHalf" (forEach Piece (if (= (* 2 (count Pieces Mover in:(sites Around (from) Orthogonal))) (count Sites in:(sites Around (from) Orthogonal))) (set State at:(from) 1) (set State at:(from) 0)) (then (set Score Mover (count Sites in:(intersection (sites Occupied by:Mover) (sites State 1))))))) (define "Score3" (forEach Piece (if (= 3 (count Pieces Mover in:(sites Around (from) Orthogonal))) (set State at:(from) 1) (set State at:(from) 0)) (then (set Score Mover (count Sites in:(intersection (sites Occupied by:Mover) (sites State 1))))))) (game "Goldilocks Stones" (players 2) (equipment { "BoardUsed" (piece "Ball" P1) (piece "Ball" P2)}) (rules (start (set Score Each 0)) (play (or (move Pass) (move Add (piece (mover)) (to (sites Empty)) (then "ScoreHalf")))) (end (if (all Passed) { (if (= (score Mover) (score Next)) (result Mover Loss)) (if (!= (score Mover) (score Next)) (byScore))})))) END |
Construct a global Ludii definition which fulfills the following requirements.
If the next player is checkmate, the mover is winning. This ludemeplex can be used only in an ending condition.
###
| (define "Checkmate" (if (and ("IsInCheck" #1 Next) (not (can Move (do (forEach Piece Next) ifAfterwards:(not ("IsInCheck" #1 Next)))))) (result Mover Win))) END |
Construct a Ludii game based on the following description
Three concentric squares, with lines connecting the corners and midpoints of the squares. Twelve pieces per player. In the first phase, players take turns placing pieces on an empty spot on the board. If they place three pieces so they are in a line, forming a \
###
| (game "Mlabalaba" (players 2) (equipment { (board (concentric Square rings:3 joinCorners:True) use:Vertex) (hand Each) (piece "Marker" Each (if (= 3 (count Pieces Mover)) (move (from (from)) (to (sites Empty))) ("StepToEmpty") (then ("ReplayIfLine3" Orthogonal))))}) (rules (start (place "Marker" "Hand" count:12)) phases:{ (phase "Placement" (play (if "SameTurn" ("RemoveAnyEnemyPieceNotInLine3" Orthogonal) (move (from (handSite Mover)) (to (sites Empty)) (then ("ReplayIfLine3" Orthogonal))))) (nextPhase Mover ("HandEmpty" Mover) "Movement")) (phase "Movement" (play (if "SameTurn" ("RemoveAnyEnemyPieceNotInLine3" Orthogonal) (forEach Piece))))} (end (forEach NonMover if:(= 2 (count Pieces Player)) (result Player Loss))))) END |
Modify the Ludii game according to the following option changes:
The game is played with 2 players. -> The game is played with 3 players.
(define "AllReachedCenter" (= 2 (count Pieces Mover in:(sites Centre)))) (define "Move" (or (if (and { (is Occupied (handSite Mover)) (all DiceEqual) (= 2 (value Player Mover))}) (move (from (handSite Mover)) (to (mapEntry "Entry" Mover)) (then (and (moveAgain) (set Var "Double" 1))))) (forEach Piece))) (define "SiteToMoveOnTrack" ("NextSiteOnTrack" #2 #1)) (define "ThrowValue" (count Pips)) (game "Saturankam" (players 2) (equipment { (board (square 9) { (track "Track1" "81,4,E,N,W,S,E1,N7,E6,S6,W5,N5,E4,S4,W3,N3,E2,S2,W1,N1" P1 directed:True) (track "Track2" "83,36,S,E,N,W,S1,E7,S6,W6,N5,E5,S4,W4,N3,E3,S2,W2,N1,E1" P2 directed:True)}) (dice d:4 faces:{1 3 4 6} num:2) (piece "Marker" Each (if (and (or { (= ("SiteToMoveOnTrack" from:(from) 1) (centrePoint)) (= ("SiteToMoveOnTrack" from:(from) 3) (centrePoint)) (= ("SiteToMoveOnTrack" from:(from) 4) (centrePoint))}) (= (value Player Mover) ("ThrowValue"))) (if (and (all DiceEqual) (= ("SiteToMoveOnTrack" from:(from) (/ ("ThrowValue") 2)) (centrePoint))) (move (from (from)) (to (centrePoint)) (then (and (moveAgain) (set Var "Double" 1))))) (forEach Value min:1 max:(value Player Mover) (move (from (from) level:(level)) (to ("SiteToMoveOnTrack" from:(from) (value)) if:True (apply (and (if (and (not (is In (to) (sites "SafeSites"))) ("IsEnemyAt" (to))) (forEach Level (to) FromTop (fromTo (from (to) level:(level)) (to (handSite (who at:(to) level:(level))))))) (if (< 0 (- (value Player Mover) (value))) (and (moveAgain) (set Value Mover (- (value Player Mover) (value)))) (and (set Value Mover 0) (if (all DiceEqual) (and (moveAgain) (set Var "Double" 1)))))))))))) (hand Each) (regions "SafeSites" (sites {4 44 76 36 40})) (map "Entry" {(pair P1 4) (pair P2 76)})}) (rules (start { (place Stack "Marker1" 4 count:2) (place Stack "Marker2" 76 count:2)}) (play (if (or (= 1 (var "Double")) ("NewTurn")) ("RollMove" (move Pass (then (and { (set Value Mover ("ThrowValue")) (if (= 1 (var "Double")) (set Var "Double" 0)) (moveAgain)})))) (if (can Move ("Move")) ("Move") (move Pass (then (and (set Var "Double" 0) (set Value Mover 0))))))) (end (if ("AllReachedCenter") (result Mover Win)))))
###
| (define "AllReachedCenter" (= 2 (count Pieces Mover in:(sites Centre)))) (define "Move" (or (if (and { (is Occupied (handSite Mover)) (all DiceEqual) (= 2 (value Player Mover))}) (move (from (handSite Mover)) (to (mapEntry "Entry" Mover)) (then (and (moveAgain) (set Var "Double" 1))))) (forEach Piece))) (define "SiteToMoveOnTrack" ("NextSiteOnTrack" #2 #1)) (define "ThrowValue" (count Pips)) (game "Saturankam" (players 3) (equipment { (board (square 9) { (track "Track1" "81,4,E,N,W,S,E1,N7,E6,S6,W5,N5,E4,S4,W3,N3,E2,S2,W1,N1" P1 directed:True) (track "Track2" "83,36,S,E,N,W,S1,E7,S6,W6,N5,E5,S4,W4,N3,E3,S2,W2,N1,E1" P2 directed:True) (track "Track3" "83,76,W,S,E,N,W1,S7,W6,N6,E5,S5,W4,N4,E3,S3,W2,N2,E1,S1" P3 directed:True)}) (dice d:4 faces:{1 3 4 6} num:2) (piece "Marker" Each (if (and (or { (= ("SiteToMoveOnTrack" from:(from) 1) (centrePoint)) (= ("SiteToMoveOnTrack" from:(from) 3) (centrePoint)) (= ("SiteToMoveOnTrack" from:(from) 4) (centrePoint))}) (= (value Player Mover) ("ThrowValue"))) (if (and (all DiceEqual) (= ("SiteToMoveOnTrack" from:(from) (/ ("ThrowValue") 2)) (centrePoint))) (move (from (from)) (to (centrePoint)) (then (and (moveAgain) (set Var "Double" 1))))) (forEach Value min:1 max:(value Player Mover) (move (from (from) level:(level)) (to ("SiteToMoveOnTrack" from:(from) (value)) if:True (apply (and (if (and (not (is In (to) (sites "SafeSites"))) ("IsEnemyAt" (to))) (forEach Level (to) FromTop (fromTo (from (to) level:(level)) (to (handSite (who at:(to) level:(level))))))) (if (< 0 (- (value Player Mover) (value))) (and (moveAgain) (set Value Mover (- (value Player Mover) (value)))) (and (set Value Mover 0) (if (all DiceEqual) (and (moveAgain) (set Var "Double" 1)))))))))))) (hand Each) (regions "SafeSites" (sites {4 44 76 36 40})) (map "Entry" {(pair P1 4) (pair P2 36) (pair P3 76)})}) (rules (start { (place Stack "Marker1" 4 count:2) (place Stack "Marker2" 36 count:2) (place Stack "Marker3" 76 count:2)}) (play (if (or (= 1 (var "Double")) ("NewTurn")) ("RollMove" (move Pass (then (and { (set Value Mover ("ThrowValue")) (if (= 1 (var "Double")) (set Var "Double" 0)) (moveAgain)})))) (if (can Move ("Move")) ("Move") (move Pass (then (and (set Var "Double" 0) (set Value Mover 0))))))) (end (if ("AllReachedCenter") (result Mover Win))))) END |
Construct a Ludii game based on the following description
Two rows of six holes with stores on either end. Four counters in each hole. Players sow in an anti-clockwise direction. When the last counter falls into a hole, and it now contains two or three counters, these are captured. The game is played with 2 players.
###
| (define "NextHole" ("NextSiteOnTrack" 1 from:(to) #1)) (define "PiecesHandOwnedBy" (+ (count in:(sites #1)) (count Cell at:(handSite #1)))) (define "PiecesOwnedBy" (+ (count in:(sites #1)) (count at:(mapEntry #1)))) (game "Kpo" (players 2) (equipment { (mancalaBoard 2 6 (track "Track" "1,E,N,W" loop:True)) (piece "Seed" Shared) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (map {(pair P1 FirstSite) (pair P2 LastSite)})}) (rules (start (set Count 4 to:(sites Track))) (play (move Select (from (sites Mover) if:(> (count at:(from)) 0)) (then (sow apply:(if (or (= (count at:(to)) 2) (= (count at:(to)) 3)) (fromTo (from (to)) (to (mapEntry Mover)) count:(count at:(to)))))))) (end ("MancalaByScoreWhen" (no Moves Next))))) END |
Modify the Ludii game according to the following option changes:
Triangle-Square Grid -> Triangle-Square Omni-Grid
Order 3 board -> Order 5 board
(define "Icosahedron" (board (add (remove (tri Limping 4) vertices:{0 1 3 4 5 6 7 8 9 10 11 13 15 17 18 19 20 23 24 25 26 27 31 32 34 35 36 37 39 40 42 43 44 45 46 47}) edges:{ {0 1} {0 2} {0 3} {0 9} {0 10} {1 2} {1 4} {1 6} {6 11} {7 11} {8 11} {1 9} {2 3} {3 5} {3 8} {3 10} {6 9} {8 10} {9 10} {9 11} {10 11}}) use:Vertex)) (define "HexCell" (board (hex Hexagon 3) use:Cell)) (define "HexHex" (board (tri Hexagon 3) use:Vertex)) (define "TriSquare" (board (tiling T33434 (- 3 2)) use:Vertex)) (define "HexLimpCell" (board (hex Limping (- 3 1)) use:Cell)) (define "HexLimp" (board (tri Limping (- 3 1)) use:Vertex)) (define "SquareGrid" (board (square 3) use:Vertex)) (define "BoardUsed" "TriSquare") (define "Connection" Orthogonal) (game "Claustro" (players 2) (equipment { "BoardUsed" (piece "Ball" P1) (piece "Ball" P2)}) (rules (start (set Score Each 0)) (play (move Add (piece (mover)) (to (sites Empty) if:(<= 0 (- (count Pieces Next in:(sites Around (to) Orthogonal)) (count Pieces Mover in:(sites Around (to) Orthogonal))))) (then (if (not (all Sites (sites Occupied by:Mover) if:(can Move (step (from (site)) Orthogonal (to if:(is Empty (to))))))) (trigger "End" Mover) (if (not (all Sites (sites Occupied by:Next) if:(can Move (step (from (site)) Orthogonal (to if:(is Empty (to))))))) (trigger "End" Next)))))) (end (if (or (is Triggered "End" Mover) (is Triggered "End" Next)) (if (is Triggered "End" Mover) (result Mover Loss)) (result Mover Win)))))
###
| (define "Icosahedron" (board (add (remove (tri Limping 4) vertices:{0 1 3 4 5 6 7 8 9 10 11 13 15 17 18 19 20 23 24 25 26 27 31 32 34 35 36 37 39 40 42 43 44 45 46 47}) edges:{ {0 1} {0 2} {0 3} {0 9} {0 10} {1 2} {1 4} {1 6} {6 11} {7 11} {8 11} {1 9} {2 3} {3 5} {3 8} {3 10} {6 9} {8 10} {9 10} {9 11} {10 11}}) use:Vertex)) (define "HexCell" (board (hex Hexagon 5) use:Cell)) (define "HexHex" (board (tri Hexagon 5) use:Vertex)) (define "TriSquare" (board (tiling T33434 (- 5 2)) use:Vertex)) (define "HexLimpCell" (board (hex Limping (- 5 1)) use:Cell)) (define "HexLimp" (board (tri Limping (- 5 1)) use:Vertex)) (define "SquareGrid" (board (square 5) use:Vertex)) (define "BoardUsed" "TriSquare") (define "Connection" All) (game "Claustro" (players 2) (equipment { "BoardUsed" (piece "Ball" P1) (piece "Ball" P2)}) (rules (start (set Score Each 0)) (play (move Add (piece (mover)) (to (sites Empty) if:(<= 0 (- (count Pieces Next in:(sites Around (to) All)) (count Pieces Mover in:(sites Around (to) All))))) (then (if (not (all Sites (sites Occupied by:Mover) if:(can Move (step (from (site)) All (to if:(is Empty (to))))))) (trigger "End" Mover) (if (not (all Sites (sites Occupied by:Next) if:(can Move (step (from (site)) All (to if:(is Empty (to))))))) (trigger "End" Next)))))) (end (if (or (is Triggered "End" Mover) (is Triggered "End" Next)) (if (is Triggered "End" Mover) (result Mover Loss)) (result Mover Win))))) END |
Construct a Ludii game based on the following description
Four pieces are the sheep; they are placed on the dark squares along one side of the board. one piece is the wolf; it is placed on any dark square on the side opposite the sheep. The goal of the wolf is to reach one of the sheep's original spaces, the sheep's goal is to block the wolf from doing so. Sheep move diagonally forward one square, the wolf moves diagonally forward or backward one square.
###
| (game "Wolf and Sheep" (players 2) (equipment { (board (square 8)) (piece "Sheep" P1 N ("StepToEmpty" (directions {FR FL}))) (piece "Wolf" P2 "StepDiagonalToEmpty")}) (rules (start { (place "Wolf2" {"D8"}) (place "Sheep1" {"A1" "C1" "E1" "G1"})}) (play (forEach Piece)) (end { (if (and (no Moves P2) (is Mover P2)) (result P1 Win)) (if (is In (where "Wolf" P2) (sites Bottom)) (result P2 Win))}))) END |
Construct a Ludii game based on the following description
A triangle, with two lines drawn from the apex to the base. A rectangle is drawn across the triangle, and another line connecting the midpoints of the short sides of the rectangle. One player plays as three tigers, the other as seventeen people. One tiger begins on the apex of the triangle and the other two may be placed anywhere. Players alternate turns, with the person playing as the people first placing a person on the board, and then one of the tigers moving to an empty adjacent spot along the lines of the board. When all of the people have been placed, the people move on the board in the same fashion. The tigers may capture one of the people by jumping over it to an empty adjacent spot immediately on the opposite side of one of the people along the lines of the board. The tigers win when they capture enough people so that the people cannot block the tiger, the people win when they can block the tiger from being able to move.
###
| (game "Mysore Tiger Game (Three Tigers)" (players 2) (equipment { (board (add (remove (merge (shift 0 2 (scale 8 2 (rectangle 3 2))) (scale 1 2 (wedge 5 4))) edges:{ {0 1} {2 3} {4 5}}) edges:{ {0 15} {18 1} {2 11} {14 3} {4 7} {10 5}}) use:Vertex) (hand Each) (piece "Human" P2 ("StepToEmpty")) (piece "Tiger" P1 (or ("StepToEmpty") ("HopCapture")))}) (rules (start { (place "Human2" (handSite P2) count:17) (place "Tiger1" (sites Top)) (place "Tiger1" (handSite P1) count:2)}) phases:{ (phase "Opening" P1 (play (move (from (handSite Mover)) (to (sites Empty)) (then (if ("HandOccupied" Mover) (moveAgain))))) (nextPhase Mover ("HandEmpty" Mover) "Movement")) (phase "Opening" P2 (play (move (from (handSite Mover)) (to (sites Empty)))) (nextPhase Mover ("HandEmpty" Mover) "Movement")) ("PhaseMovePiece" "Movement")} (end ("NoMovesP1NoPiecesP2")))) END |
Construct a Ludii game based on the following description
Played on a 6x6 board with corner loops. Each player has 12 pieces. Play is made on the intersections of the lines. pieces are captured by moving via the outer loops and occupying a space held by another player. The goal is to capture all of the opponent's pieces. If no further captures are possible, the player with the most remaining pieces wins. The pieces can step to an empty site. The pieces can slide to capture. The mover win if the next player does not have any piece. The game is played on the Awithlaknan Mosona board.
###
| (define "NPiecesOnTrack" (end (forEach Track if:(> #1 (count Pieces Mover in:(sites Track))) (result Mover Loss)))) (define "NoCaptureProposal" 101) (define "SlideToCapture" (move Slide "AllTracks" (between if:(or (= (between) (from)) (is Empty (between)))) (to if:("IsEnemyAt" (to)) (apply if:False (remove (to)))) (then (set Counter)))) (game "Surakarta" (players 2) (equipment { (surakartaBoard (square 6)) (piece "Marker" Each (or { (move Step All (to if:(is Empty (to)))) ("SlideToCapture")}))}) (rules (start { (place "Marker1" (expand (sites Bottom))) (place "Marker2" (expand (sites Top)))}) (play (if (is Proposed "End") (or (move Vote "End") (move Vote "No" (then (set Counter)))) (or (if (>= (counter) "NoCaptureProposal") (move Propose "End" (then (vote "End")))) (forEach Piece)))) (end { (if (is Decided "End") (byScore { (score P1 (count Pieces P1)) (score P2 (count Pieces P2))})) ("CaptureAll" Next)}))) END |
Construct a Ludii game based on the following description
2x6 board. Play begins with four counters in each hole. Players begin the game simultaneously, sowing according to the rules below, until one player drops their final counter into an empty hole. A player picks up the contents of any of their holes and sowing them in an anti-clockwise direction, picking up the contents of the last hole in which his counters fall, and continuing sowing. This continues until the last counter falls in an empty hole. Then it is the other player's turn. A hole is captured when the last ball is dropped into an opponent's hole containing three counters, making it four. A player cannot then take from one of these holes that they have captured. Therefore, the player cannot begin a turn from their own captured hole nor can they continue sowing from it. If the last counter of a sowing falls into an opponent's captured hole, nothing happens on the first instance, but every time after that, one of those counters are removed from the board and placed in the store, and the sowing continues with the contents of any of the player's holes. Ownership of a hole continues even if it becomes empty. When a player cannot move (i.e., there are no counters in their holes except any that are in captured holes), the opponent continues to move until the player is able to move. Play continues until all counters are either placed in the store or in captured holes and thus cannot be moved. Players then count their pieces by placing four in each hole, and the player who has more than their original number takes ownership of one of the opponent's holes for every four counters more than the original number that have been taken. If no player took four more than the original, the player with three extra gets the hole, if each player has two extra the weaker player is given the two extra counters. Play then begins again as before. The game ends when one player owns all of the counters, and thus all of the holes.
###
| (define "SitesMarkedBy" (forEach (sites Board) if:(= #1 (state at:(site))))) (define "RememberOwnedHolesRandom" (if (< 50 (value Random (range 1 100))) (remember Value "OwnedP1" #1) (remember Value "OwnedP2" #1))) (define "RightMostEmpty" (trackSite FirstSite "TrackCW" from:(mapEntry "RightMost" Mover) if:(is Empty (to)))) (define "OnlyPiecesInMarked" (all Sites (forEach (sites Board) if:(= 0 (state at:(site)))) if:(= 0 (count at:(site))))) (define "RemmemberCanCaptureHoles" (if (is Mover P1) (remember Value "CanCaptureP1" #1) (remember Value "CanCaptureP2" #1))) (define "CanCaptureHoles" (if (is Mover P1) (sites (values Remembered "CanCaptureP1")) (sites (values Remembered "CanCaptureP2")))) (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")))) (game "Mewegae" (players 2) (equipment { (mancalaBoard 2 6 store:None { (track "TrackCCW" "0,E,N,W" loop:True) (track "TrackCW" "5,W,N,E" loop:True)}) (piece "Seed" Shared) (hand Each) (regions P1 (sites Bottom)) (regions P2 (sites Top)) (map "RightMost" {(pair P1 5) (pair P2 6)})}) (rules (start { (set RememberValue "OwnedP1" (sites Bottom)) (set RememberValue "OwnedP2" (sites Top)) (set Count 4 to:(sites Track))}) phases:{ (phase "Sowing" (play (or { (move Select (from (if ("SameTurn") (sites {(var "Replay")}) ("OwnedHoles")) if:(and (< 0 (count at:(from))) (= 0 (state at:(from))))) (then (sow "TrackCCW" apply:(if (and (= 0 (state at:(to))) (= 4 (count at:(to)))) (set State at:(to) (mover)) (if (< 1 (count at:(to))) (if (= 0 (state at:(to))) (and (moveAgain) (set Var "Replay" (to))) (if (!= (mover) (state at:(to))) (if (is In (to) ("CanCaptureHoles")) (and (fromTo (from (to)) (to (handSite Mover)) count:1) (set State at:(to) (state at:(to)))) ("RemmemberCanCaptureHoles" (to))))))))))} (then (if ("OnlyPiecesInMarked") (and { (forEach Site ("SitesMarkedBy" 1) (fromTo (from (site)) (to (handSite P1)) count:(count at:(site)))) (forEach Site ("SitesMarkedBy" 2) (fromTo (from (site)) (to (handSite P2)) count:(count at:(site)))) (forget Value "OwnedP1" All) (forget Value "OwnedP2" All) (forget Value "CanCaptureP1" All) (forget Value "CanCaptureP2" All) (set Var "Round" (+ 1 (var "Round")))}))))) (end (if ("NoPieceOnBoard") { (if (>= 1 (count Cell at:(handSite P1))) (result P2 Win)) (if (>= 1 (count Cell at:(handSite P2))) (result P1 Win))})) (nextPhase ("NoPieceOnBoard") "BetweenRounds")) (phase "BetweenRounds" (play (if (<= 4 (count Cell at:(handSite Mover))) (move (from (handSite Mover)) (to ("RightMostEmpty")) count:4 (then (and { ("RemmemberOwnedHoles" (last To)) (if (<= 4 (count Cell at:(handSite Mover))) (moveAgain) (if (= 3 (count Cell at:(handSite Mover))) (and { (fromTo (from (handSite Mover)) (to ("RightMostEmpty")) count:3) (fromTo (from (handSite Next)) (to ("RightMostEmpty")) count:1) ("RemmemberOwnedHoles" ("RightMostEmpty"))}) (if (= 2 (count Cell at:(handSite Mover))) (and { (fromTo (from (handSite Mover)) (to ("RightMostEmpty")) count:2) (fromTo (from (handSite Next)) (to ("RightMostEmpty")) count:2) ("RememberOwnedHolesRandom" ("RightMostEmpty"))}))))}))) (then (if (and (is Empty (handSite P1)) (is Empty (handSite P2))) (and (if (is Even (var "Round")) (set NextPlayer (player 2)) (set NextPlayer (player 1))) (set Pending)))))) (nextPhase (and (is Empty (handSite P1)) (is Empty (handSite P2))) "Sowing"))})) END |
Modify the Ludii game according to the following option changes:
Board & size: Hexhex (12) with edges alternating 2 and 3 -> Board & size: Hexhex (18) with edges alternating 2 and 4
(define "HopEnemy" (forEach Piece (move Hop (between if:(is Within (id "Fan" Neutral) at:(between)) (apply (and (remove (between)) (add (piece (id "Disc" Mover)) (to (between)))))) (to if:(and (is Empty (to)) ("MoveAllowed"))) (then (and ("UpdateScore" Mover) ("UpdateScore" Next)))) Mover)) (define "HopNeutral" (forEach Piece (move Hop (between if:(is Next (who at:(between))) (apply (and (remove (between)) (add (piece (id "Fan" Neutral)) (to (between)))))) (to if:(and (is Empty (to)) ("MoveAllowed"))) (then (and ("UpdateScore" Mover) ("UpdateScore" Next)))) Mover)) (define "StepMove" (forEach Piece (move Step (to (sites Around (from)) if:(and (is Empty (to)) ("MoveAllowed"))) (then ("UpdateScore" Mover))) Mover)) (define "Placement" (move Add (piece (id "Disc" Mover)) (to (sites Empty) if:"NonAdjacent"))) (define "UpdateScore" (set Score #1 (/ (+ (results from:(sites Occupied by:#1) to:(sites Around (from) if:(is #1 (who at:(to)))) 1)) 2))) (define "Option2" (not (is Within (id "Disc" Mover) in:(sites LineOfSight Piece at:(to))))) (define "NonAdjacent" (not (is Within (id "Disc" Mover) in:(sites Around (to))))) (define "MoveAllowed" (< ("Unfriendlies" (to)) ("Unfriendlies" (from)))) (define "Unfriendlies" (count Sites in:(intersection (sites Around #1) (union (sites Occupied by:Next) (sites Occupied by:Neutral))))) (define "TieBreaker" (count Pieces #1)) (game "Refugia" (players 2) (equipment { (board (hex {2 3 2 3 2})) (piece "Disc" P1) (piece "Disc" P2) (piece "Fan" Neutral)}) (rules (start (set Score Each 0)) (play (or { ("StepMove") ("HopEnemy") ("HopNeutral") ("Placement") (move Pass)})) (end (if (all Passed) { (if (> (score Mover) (score Next)) (result Mover Win)) (if (< (score Mover) (score Next)) (result Next Win)) (if (> ("TieBreaker" Mover) ("TieBreaker" Next)) (result Mover Win)) (if (< ("TieBreaker" Mover) ("TieBreaker" Next)) (result Next Win))} (result Next Win)))))
###
| (define "HopEnemy" (forEach Piece (move Hop (between if:(is Within (id "Fan" Neutral) at:(between)) (apply (and (remove (between)) (add (piece (id "Disc" Mover)) (to (between)))))) (to if:(and (is Empty (to)) ("MoveAllowed"))) (then (and ("UpdateScore" Mover) ("UpdateScore" Next)))) Mover)) (define "HopNeutral" (forEach Piece (move Hop (between if:(is Next (who at:(between))) (apply (and (remove (between)) (add (piece (id "Fan" Neutral)) (to (between)))))) (to if:(and (is Empty (to)) ("MoveAllowed"))) (then (and ("UpdateScore" Mover) ("UpdateScore" Next)))) Mover)) (define "StepMove" (forEach Piece (move Step (to (sites Around (from)) if:(and (is Empty (to)) ("MoveAllowed"))) (then ("UpdateScore" Mover))) Mover)) (define "Placement" (move Add (piece (id "Disc" Mover)) (to (sites Empty) if:"NonAdjacent"))) (define "UpdateScore" (set Score #1 (/ (+ (results from:(sites Occupied by:#1) to:(sites Around (from) if:(is #1 (who at:(to)))) 1)) 2))) (define "Option2" (not (is Within (id "Disc" Mover) in:(sites LineOfSight Piece at:(to))))) (define "NonAdjacent" (not (is Within (id "Disc" Mover) in:(sites Around (to))))) (define "MoveAllowed" (< ("Unfriendlies" (to)) ("Unfriendlies" (from)))) (define "Unfriendlies" (count Sites in:(intersection (sites Around #1) (union (sites Occupied by:Next) (sites Occupied by:Neutral))))) (define "TieBreaker" (count Pieces #1)) (game "Refugia" (players 2) (equipment { (board (hex {2 4 2 4 2})) (piece "Disc" P1) (piece "Disc" P2) (piece "Fan" Neutral)}) (rules (start (set Score Each 0)) (play (or { ("StepMove") ("HopEnemy") ("HopNeutral") ("Placement") (move Pass)})) (end (if (all Passed) { (if (> (score Mover) (score Next)) (result Mover Win)) (if (< (score Mover) (score Next)) (result Next Win)) (if (> ("TieBreaker" Mover) ("TieBreaker" Next)) (result Mover Win)) (if (< ("TieBreaker" Mover) ("TieBreaker" Next)) (result Next Win))} (result Next Win))))) END |
Modify the Ludii game according to the following option changes:
Board & size: Equiversi Hexhex with edges alternating 3 and 5 -> Board & size: Hexhex with edges alternating 4 and 5
(define "Tri78Bug" (tri {7 8 7 10 6})) (define "Tri57Bug" (tri {5 7 5 8 5})) (define "Tri56Bug" (tri {5 6 5 7 5})) (define "Tri46Bug" (tri {4 6 4 7 4})) (define "EndCondition" (no Moves Mover)) (define "Sites2Capture" ("TriangleSites" (sites Occupied by:Next) (sites Occupied by:Next) { (value Player (mover))})) (define "OutstandingCaptures" (< 0 (size Array (array "Sites2Capture")))) (define "TriangleSites" (union { ("Due2Step" {F} #1 #2 #3) ("Due2Step" {F R F} #1 #2 #3) ("Due2Step" {F F} #1 #2 #3) ("Due2Step" {F R F F} #1 #2 #3) ("Due2Step" {F F R F} #1 #2 #3) ("Due2Step" {F F R F F} #1 #2 #3) ("Due2Step" {F F F} #1 #2 #3) ("Due2Step" {F R F F F} #1 #2 #3) ("Due2Step" {F F F R F} #1 #2 #3) ("Due2Step" {F F R F F F} #1 #2 #3) ("Due2Step" {F F F R F F} #1 #2 #3) ("Due2Step" {F F F F} #1 #2 #3) ("Due2Step" {F F F R F F F} #1 #2 #3) ("Due2Step" {F R F F F F} #1 #2 #3) ("Due2Step" {F F F F R F} #1 #2 #3) ("Due2Step" {F F F F R F F} #1 #2 #3) ("Due2Step" {F F R F F F F} #1 #2 #3) ("Due2Step" {F F F F F} #1 #2 #3) ("Due2Step" {F F F R F F F F} #1 #2 #3) ("Due2Step" {F F F F R F F F} #1 #2 #3) ("Due2Step" {F F F F F R F} #1 #2 #3) ("Due2Step" {F R F F F F F} #1 #2 #3)})) (define "Due2Step" (intersection (sites Board) (sites (results from:#2 to:(intersection (sites (from) { #1} rotations:True) #3) (if (!= 0 (size Array (intersection (intersection (array (sites (from) { #1} rotations:True)) (array (sites (to) { #1} rotations:True))) (array #4)))) (from) -1))))) (game "Tri-It-Out" (players 2) (equipment { (board (tri {3 5 3 5 3}) use:Vertex) (piece "Counter" Each)}) (rules (meta (no Repeat PositionalInTurn)) (start { (set Score Each 0)}) (play (if (is Pending) (move Remove (sites Pending) (then (and (set Value Mover Infinity) (moveAgain)))) (move Add (to (difference (sites Empty) ("TriangleSites" (sites Empty) (sites Occupied by:P1) (sites Occupied by:P2))) (apply (set Value Mover (to)))) (then (if "OutstandingCaptures" (and (set Pending "Sites2Capture") (moveAgain))))) (then (set Score P1 (- (count Pieces P1)) (then (set Score P2 (- (count Pieces P2)))))))) (end { (if (and { (no Moves Next) False}) (result Mover Loss)) (if (and (no Moves Next) (= (count Pieces P1) (count Pieces P2))) (result Mover Loss)) (if (and (no Moves Next) (!= (count Pieces P1) (count Pieces P2))) (byScore))})))
###
| (define "Tri78Bug" (tri {7 8 7 10 6})) (define "Tri57Bug" (tri {5 7 5 8 5})) (define "Tri56Bug" (tri {5 6 5 7 5})) (define "Tri46Bug" (tri {4 6 4 7 4})) (define "EndCondition" (no Moves Mover)) (define "Sites2Capture" ("TriangleSites" (sites Occupied by:Next) (sites Occupied by:Next) { (value Player (mover))})) (define "OutstandingCaptures" (< 0 (size Array (array "Sites2Capture")))) (define "TriangleSites" (union { ("Due2Step" {F} #1 #2 #3) ("Due2Step" {F R F} #1 #2 #3) ("Due2Step" {F F} #1 #2 #3) ("Due2Step" {F R F F} #1 #2 #3) ("Due2Step" {F F R F} #1 #2 #3) ("Due2Step" {F F R F F} #1 #2 #3) ("Due2Step" {F F F} #1 #2 #3) ("Due2Step" {F R F F F} #1 #2 #3) ("Due2Step" {F F F R F} #1 #2 #3) ("Due2Step" {F F R F F F} #1 #2 #3) ("Due2Step" {F F F R F F} #1 #2 #3) ("Due2Step" {F F F F} #1 #2 #3) ("Due2Step" {F F F R F F F} #1 #2 #3) ("Due2Step" {F R F F F F} #1 #2 #3) ("Due2Step" {F F F F R F} #1 #2 #3) ("Due2Step" {F F F F R F F} #1 #2 #3) ("Due2Step" {F F R F F F F} #1 #2 #3) ("Due2Step" {F F F F F} #1 #2 #3) ("Due2Step" {F F F R F F F F} #1 #2 #3) ("Due2Step" {F F F F R F F F} #1 #2 #3) ("Due2Step" {F F F F F R F} #1 #2 #3) ("Due2Step" {F R F F F F F} #1 #2 #3)})) (define "Due2Step" (intersection (sites Board) (sites (results from:#2 to:(intersection (sites (from) { #1} rotations:True) #3) (if (!= 0 (size Array (intersection (intersection (array (sites (from) { #1} rotations:True)) (array (sites (to) { #1} rotations:True))) (array #4)))) (from) -1))))) (game "Tri-It-Out" (players 2) (equipment { (board (tri {4 5 4 5 4}) use:Vertex) (piece "Counter" Each)}) (rules (meta (no Repeat PositionalInTurn)) (start { (set Score Each 0)}) (play (if (is Pending) (move Remove (sites Pending) (then (and (set Value Mover Infinity) (moveAgain)))) (move Add (to (difference (sites Empty) ("TriangleSites" (sites Empty) (sites Occupied by:P1) (sites Occupied by:P2))) (apply (set Value Mover (to)))) (then (if "OutstandingCaptures" (and (set Pending "Sites2Capture") (moveAgain))))) (then (set Score P1 (- (count Pieces P1)) (then (set Score P2 (- (count Pieces P2)))))))) (end { (if (and { (no Moves Next) False}) (result Mover Loss)) (if (and (no Moves Next) (= (count Pieces P1) (count Pieces P2))) (result Mover Loss)) (if (and (no Moves Next) (!= (count Pieces P1) (count Pieces P2))) (byScore))}))) END |
Modify the Ludii game according to the following option changes:
The game uses square tiles -> The game uses triangle tiles
(define "NumTiles" 24) (game "Andantino" (players 2) (equipment { (boardless Square) (tile "Square" Each numSides:4)}) (rules (start { (place "Square1" (centrePoint)) (place "Square2" (ahead (centrePoint) E))}) (play (move Add (to (sites Playable) if:(<= 2 (count Sites in:(sites Around (to) NotEmpty)))))) (end { (if (or (is Loop surround:Next) (is Line 5)) (result Mover Win)) (if (= (count Moves) (* (count Players) "NumTiles")) (result Mover Draw))})))
###
| (define "NumTiles" 24) (game "Andantino" (players 2) (equipment { (boardless Triangular) (tile "Triangle" Each numSides:3)}) (rules (start { (place "Triangle1" (centrePoint)) (place "Triangle2" (ahead (centrePoint) E))}) (play (move Add (to (sites Playable) if:(<= 2 (count Sites in:(sites Around (to) NotEmpty)))))) (end { (if (or (is Loop surround:Next) (is Line 5)) (result Mover Win)) (if (= (count Moves) (* (count Players) "NumTiles")) (result Mover Draw))}))) END |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.