(define "NextSiteFrom"
(trackSite Move
from:#1
steps:#2
)
)
(define "DieNotUsed" (!= (pips) 0))
(define "NotEnemyOrOnlyOne"
(or
(and
(is Enemy (who at:(to)))
(= (topLevel at:(to)) 0)
)
(not (is Enemy (who at:(to))))
)
)
(define "EnterPieces"
(if (is Occupied (mapEntry "Bar" Mover))
(forEach Die
if:("DieNotUsed")
(move
(from (mapEntry "Bar" Mover))
(to
("NextSiteFrom" (mapEntry "Bar" Mover) (pips))
if:(< (size Stack at:(to)) 2)
(apply
(if (is Enemy (who at:(to)))
(fromTo
(from (to))
(to (mapEntry "Bar" Next))
)
)
)
)
)
(then
(if (not (all DiceUsed))
(moveAgain)
)
)
)
)
)
(define "AllPiecesInFinalQuadrant"
(no Pieces Mover in:(difference (sites Board) (sites Mover "FinalQuadrant")))
)
//------------------------------------------------------------------------------
(game "Nard"
(players 2)
(equipment {
(board (rectangle 2 13)
{
(track "Track1" {6 12..7 5..0 13..18 20..25 End} P1 directed:True)
(track "Track2" {19 25..20 18..13 0..5 7..12 End} P2 directed:True)
}
use:Vertex
)
(dice d:6 num:2)
(map "Bar" {(pair P1 6) (pair P2 19)})
(regions "FinalQuadrant" P1 (sites {20..25}))
(regions "FinalQuadrant" P2 (sites {7..12}))
(piece "Disc" Each
(forEach Die
if:("DieNotUsed")
(if (= End ("NextSiteFrom" (from) (pips)))
(if ("AllPiecesInFinalQuadrant")
(move Remove (from))
)
(move
(from (from))
(to
("NextSiteFrom" (from) (pips))
if:("NotEnemyOrOnlyOne")
(apply
(if (is Enemy (who at:(to)))
(fromTo
(from (to))
(to (mapEntry "Bar" Next))
)
)
)
)
)
)
(then
(if (not (all DiceUsed))
(moveAgain)
)
)
)
)
})
(rules
(start {
(place Stack "Disc1" 7 count:5) (place Stack "Disc1" 4 count:3)
(place Stack "Disc1" 13 count:5) (place Stack "Disc1" 25 count:2)
(place Stack "Disc2" 20 count:5) (place Stack "Disc2" 17 count:3)
(place Stack "Disc2" 0 count:5) (place Stack "Disc2" 12 count:2)
})
(play
(do (if (not "SameTurn") (roll))
next:(priority {
("EnterPieces")
(if (is Empty (mapEntry "Bar" Mover)) (max Distance (forEach Piece top:True)))
})
(then
(if (no Pieces Mover)
(if (no Pieces Enemy in:(sites Mover "FinalQuadrant")) (addScore Mover 1) (addScore Mover 2))
)
)
)
)
(end (if (no Pieces Mover) (result Mover Win)))
)
)
//------------------------------------------------------------------------------
(metadata
(info
{
(description "Nard is a race game from Persia, documented since at least 600 CE. It is thought to be an ancestor to Backgammon and other games, like Japanese Ban-Sugoroku.")
(rules "The game is played on a board with twelve points on either side. The points form a continuous track in a horseshoe shape; each player progresses in opposite directions (one from their bottom right to the top right, the other from their bottom left to their top left). Each player has 15 pieces. The starting position is as such, numbering the points from the origin of each player's track: Point six: five pieces. Point 8: three pieces. Point 13: five pieces. Point 24: two pieces. Players move according to the number on each die by moving one piece the number on one die and another the number on the other die, or by moving one piece twice (once for each die). Players cannot end their move on a point with multiple opposing pieces. If a player ends the turn on a point with one opposing piece, that piece is placed in the middle of the board (not on a point) and must reenter the board according to the next die roll, counting the origin point as a move of one. They cannot reenter on a point with two or more pieces. No other pieces can move until all of the pieces belonging to that player are removed from the center. When all of a player's pieces are on their final 6 points, they may start removing pieces from the board. They can do so by rolling a 6 to move from the 6th point, and so on down to 1. Players must use all available moves presented by the dice. The first player to remove all of their pieces wins. The winner gains one point, or two points if the opponent has pieces in their starting quadrant.
")
(source "Himly 1879: 679-681.")
(version "1.3.0")
(classification "board/race/escape")
(credit "Eric Piette")
(origin "This game was played in Persia, around 1879.")
}
)
(graphics {
(board Style backgammon)
(stackType Backgammon)
})
)