- Rust (latest stable version) - (https://rustup.rs/)
- wasm-pack - Install with:
cargo install wasm-pack
-
WebAssembly module:
wasm-pack build --target web
-
Local web server:
python -m http.server 8000
http://localhost:8000in your browser.
- Board: 4 quadrants, each divided into 6 lines.
- Dice: 2 dice with values 1-6.
- Pieces: 30 checkers total - 15 white and 15 black.
- Top: Lines 13 with 2 black, line 24 with 3 black. Lines 15 and 19 with 2 white each, and lines 18 and 20 with 3 white each.
- Bottom: Lines 1 with 2 black, line 12 with 3 white. Lines 3 and 7 with 2 black each, and lines 6 and 8 with 3 black each.
Dice Rolling:
- To determine which player goes first, each player throws 1 dice and whoever scores higher goes first.
- The value on each dice is the number of lines each checker can move.
- White pieces move from board top right (13-18) to top left (19-24) to bottom left (12-7) to bottom right (6-1).
- Black pieces move from board bottom right (1-6) to bottom left (7-12) to top left (24-19) to top right (18-13).
Moves:
- When a player rolled x on 1st dice and y on 2nd dice, they may move one checker x spaces, and another checker y spaces.
- Or move one checker x spaces onto an open line, and then move that same checker another y spaces onto an open line.
- If only one move is possible and the other is not then the player must make that one move.
- If neither moves are possible, then the player skips their turn.
Occupancy:
- 6 checkers of a player can be present on a single line.
- If a line is occupied by 2 or more checkers of a player, the opponent is not allowed to land on it.
- If a single checker is present on a line, then it can be hit by an opponent's checker and removed off the board onto the center bar.
- Checkers can be hit onto the bar even inside home quadrant.
- Player with checkers on the bar must move them back into the game first.
- Checker on the bar lands onto the line equal to the number of one of the dice rolls, as long as that line is unoccupied or has exactly 1 opponent checker (which can be hit).
- The player may not move any other pieces, until all of the checkers on the bar have been reentered back into the game.
- 1st player with 15 checkers arrived in home quadrant.
- "Nard" or "Nardshir": The name derives from Persian "nard" (wooden block/checker) and "shir" (lion), possibly referring to the board's design or pieces.
- Literary: Appears in Persian poetry and literature.
- Religious: Zoroastrian texts mention the game, sometimes with symbolic interpretations.
- Crusades: European contact with the Middle East introduced the game to Europe.
- "Tables" Games: Became popular as "tables" or "tabula" in medieval Europe. Gradually evolved into modern backgammon with rule modifications.
- Continuity: Nard remains popular in Iran, Afghanistan, and Central Asia. Maintains game rules distinct from Western backgammon.
The board design reflects Zoroastrian cosmological & theological symbolism:
-
4 Quadrants: The board is divided into 4 quadrants, because there are 4 elements from which everything was created.
-
6 Lines per Quadrant: Each quadrant is divided into 6 lines, because first Ahura Mazda created 6 spirits (manifestations), or goddesses.
-
2 Dice: 2 separate dice are used, one to represent revolution of the firmament and one to represent the revolution of the constellations.
-
Opposite Movement: The checkers move in opposite direction from each other, since the white ones represent Ahura Mazda, the good god, who is opposed by Ahriman, the evil god, in all of his doings, represented by the black checkers.
.
├── Cargo.toml # Rust project configuration (Backend) (Config)
├── Cargo.lock # Rust dependency lock file (Backend) (Config)
├── package.json # Node.js module type (Frontend) (Config)
├── index.html # HTML entry point (Frontend) (Static / Markup)
├── index.js # Minimal JavaScript UI layer (Frontend) (Source / Script)
├── style.css # Global styles (Frontend) (Static / Styles)
├── src/
│ └── lib.rs # Rust game engine (WebAssembly) (Backend) (Source / Library)
│ ├── GameState # Core game state management
│ ├── Move validation # All game rules & logic
│ ├── Status messages # Game status & UI text
│ └── Win conditions # Victory detection
├── pkg/ # wasm-pack generated (Backend)
│ ├── nard.js # WASM bindings (Backend) (Source / Module)
│ ├── nard_bg.wasm # Compiled WebAssembly (Backend) (Source / Library)
│ ├── nard.d.ts # TypeScript definitions (Backend) (Source / Module)
│ ├── nard_bg.wasm.d.ts # WASM TypeScript definitions (Backend) (Source / Module)
│ ├── package.json # WASM package metadata (Backend) (Config)
│ └── README.md # WASM package documentation (Backend) (Static / Documentation)
└── README.md # This file