Initial commit, with rules 0.5 and basic bots

This commit is contained in:
2026-09-26 16:01:46 +02:00
commit 0aaf113fc3
32 changed files with 4206 additions and 0 deletions
+97
View File
@@ -0,0 +1,97 @@
# Board format
The board is authored as **one 8x8 quadrant** (`board/quadrant.txt`, the top-left corner of
the board). The tooling rotates it 90° clockwise three times to build the full 16x16 board,
so every corner is identical by construction.
```
uv run dojo board validate # check board/quadrant.txt against the rules
uv run dojo board render -o board/board.txt # write the full board (generated, never edit)
```
Exit codes: `0` OK (warnings allowed), `1` design errors, `2` format errors or missing file.
## Notation
Classic ASCII maze notation. Each cell is 3 characters wide with its code in the middle;
walls sit between cells.
```
+---+---+---+
| S S | . |
+ +---+ +
| S 1 ? |
+---+---+---+
```
| Element | Walled | Open |
|---|---|---|
| Corner | `+` (always) | — |
| Between two rows | `---` | three blanks |
| Between two columns | `\|` | one blank |
- Lines starting with `#` and blank lines are ignored.
- Trailing blanks may be stripped by your editor; a missing character at the end of a line
reads as open.
- The quadrant file is 17 lines of 33 characters.
## Cell codes
| Code | Meaning |
|---|---|
| `S` | Safe Room |
| `D` | Central Dojo |
| `.` | Tatami |
| `A` | Allenamento |
| `F` | Fatica |
| `?` | Nebbia del Dojo |
| `P` | Passo Falso |
| `K` | Sfida |
| `1`–`9` | Tunnel; the two cells with the same digit are a pair |
## Quadrant rules (format errors — the board cannot be built)
- Exactly 8x8 cells, only the codes above.
- **Top and left borders** are the outer border of the board: fully walled.
- **Right and bottom borders are seams** shared with the neighbouring quadrants. Rotation maps
the bottom seam onto the right seam, so the right border at row *i* must equal the bottom
border at column *i*.
- `D` cells are exactly rows 6–7, columns 6–7 (the quadrant's share of the 4x4 Dojo).
- Each tunnel digit appears on exactly two cells.
Rows and columns are 0-based, top-left is `(0, 0)`. On the full board, quadrants are numbered
clockwise: 0 top-left, 1 top-right, 2 bottom-right, 3 bottom-left.
## Tunnel links — `board/legend.toml` (optional)
The CLI reads `legend.toml` from the quadrant's folder automatically (override with
`--legend`). By default a tunnel pair links its two cells inside the same quadrant. To link across
quadrants, give the digit a `quadrant_offset`:
```toml
[tunnels.3]
quadrant_offset = 1
```
Call `a` and `b` the two cells of the digit in reading order (row by row, left to right).
With offset `o`, `a` in quadrant *k* is linked to `b` in quadrant *k + o*. Offsets are 0–3.
## Design checks (`validate` errors and warnings)
Errors:
- a wall inside the Dojo;
- a quadrant without a Dojo entrance, or an entrance opening straight into a Safe Room;
- a Safe Room that does not contain its board corner, is not connected, does not have exactly
2 exits, or has both exits on the same side;
- a Safe Room that is a shortcut (walking through it is shorter than walking around it
between its two exits);
- any square that cannot be walked to from a Safe Room (tunnels not counted, Dojo impassable).
Warnings:
- Safe Room size other than 3x3;
- Tatami share outside 30–40% of playable squares.
The report also lists the square mix, number of tunnel pairs and Dojo entrances, and the
shortest walk from each Safe Room into the Dojo.
+33
View File
@@ -0,0 +1,33 @@
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
| S S S | . 1 ? F A | A . 2 P . | S S S |
+ + + + +---+ +---+ + +---+---+---+ + + + +
| S S S . | A . A | P | 1 | A . A | . S S S |
+ + + + + + + + + + + + + + + + +
| S S S | ? | . ? . | 2 | . . ? . . | S S S |
+---+ +---+ + + + + + + + + + +---+ +---+
| . . . . A F A | . F | A . A | . ? . . |
+ +---+ +---+---+---+ + + + +---+---+ +---+---+ +
| P | A . A | . ? . | F | F . A . | A . A | 1 |
+ + + + + + +---+ + +---+---+ + + + + +
| 2 | . ? . | A | A . ? A K A ? | F ? . ? |
+ + + + + + + +---+---+---+ + + + + + +
| . | A . A . | K | D D D D . | . A . A | F |
+ +---+ +---+ + + + + + + +---+---+---+---+ +
| A 1 . F F A | D D D D | ? F . 2 P A |
+---+---+---+ +---+ + + + + + +---+ +---+---+---+
| A P 2 . F ? | D D D D | A F F . 1 A |
+ +---+---+---+---+ + + + + + + +---+ +---+ +
| F | A . A . | . D D D D | K | . A . A | . |
+ + + + + + +---+---+---+ + + + + + + +
| ? . ? F | ? A K A ? . A | A | . ? . | 2 |
+ + + + + +---+---+ + +---+ + + + + + +
| 1 | A . A | . A . F | F | . ? . | A . A | P |
+ +---+---+ +---+---+ + + + +---+---+---+ +---+ +
| . . ? . | A . A | F . | A F A . . . . |
+---+ +---+ + + + + + + + + + +---+ +---+
| S S S | . . ? . . | 2 | . ? . | ? | S S S |
+ + + + + + + + + + + + + + + + +
| S S S . | A . A | 1 | P | A . A | . S S S |
+ + + + +---+---+---+ + +---+ +---+ + + + +
| S S S | . P 2 . A | A F ? 1 . | S S S |
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
+9
View File
@@ -0,0 +1,9 @@
# Tunnel links across quadrants. Format: board/FORMAT.md
# Tunnel 1: north corridor <-> west corridor of the next quadrant (clockwise).
[tunnels.1]
quadrant_offset = 1
# Tunnel 2: east corridor <-> west corridor of the opposite quadrant.
[tunnels.2]
quadrant_offset = 2
+20
View File
@@ -0,0 +1,20 @@
# Quadrant 0 (top-left). Rotated 3x into the full board. Format: board/FORMAT.md
# Draft 1: north/east/west corridors, two 3x3 training rooms (rows 1-3 and rows 4-6),
# middle corridor, ring around the Dojo shared with the neighbouring quadrants.
+---+---+---+---+---+---+---+---+
| S S S | . 1 ? F A |
+ + + + +---+ +---+ +
| S S S . | A . A | P |
+ + + + + + + + +
| S S S | ? | . ? . | 2 |
+---+ +---+ + + + + +
| . . . . A F A | .
+ +---+ +---+---+---+ + +
| P | A . A | . ? . | F |
+ + + + + + +---+ +
| 2 | . ? . | A | A . ?
+ + + + + + + +---+
| . | A . A . | K | D D
+ +---+ +---+ + + + +
| A 1 . F F A | D D
+---+---+---+ +---+ + + +