Skip to content

Map Rules

Map rules define the minimum structure required before movement, collision, and raycasting can safely use the parsed grid.

Map rules

A map is accepted only when symbols, spawn, and enclosure are all valid

Validation protects movement and raycasting by rejecting malformed map geometry before runtime graphics initialization.

01
Allowed symbols

All other characters are rejected by map character validation; bonus builds extend this alphabet with bonus tile symbols.

10NSEWspace
02
Single player spawn

Exactly one orientation marker is required.

NSEWcount == 1
03
Closed playable area

Open cells must never leak to void, spaces, or missing row columns, and unreachable open pockets are rejected.

BFSvoid checkrow length safereachable open cells
!
spaces and short rows are void

Irregular maps are valid only when BFS cannot escape through implicit void.

valid closed map
11111
10N01
10001
11111
invalid leak
11111
10N01
100
11111
04
project-specific behavior

These rules match the parser and validation contract used by this repository.

Mandatory vs bonus alphabet shared validator, bonus tiles only in bonus build
Non-rectangular maps accepted if closure is valid
Empty lines before map block allowed
Empty lines inside map block rejected
Out-of-bounds or short row access treated as ' ' void
interactive map validator

Try map integrity cases: symbols, spawn count, empty lines, BFS closure, and reachability.

Enter a map and validate it.
validate_map(...) success invariant

One spawn, allowed symbols, no leak to void, no unreachable open area, and a structurally valid map block.

  • only allowed symbols are accepted
  • exactly one player spawn is required: N, S, E, or W
  • the playable area must be fully closed
  • all open cells must remain reachable from the player spawn
  • spaces and missing cells in short rows are treated as void/outside cells
  • the mandatory build accepts the mandatory alphabet; bonus builds extend that shared validation with bonus tile symbols
  • non-rectangular maps are accepted only if closure is still valid
  • empty lines before map start are allowed
  • empty lines inside the map block are rejected
  • validation fails before MLX initialization when map integrity checks fail