Files
agentic-labs-challenge-subm…/underdepths/logs/phase2_fov.log
T
2026-08-12 18:44:04 +02:00

19 lines
1.8 KiB
Plaintext

FOV is complete and both assertions pass:
- **PASS: FOV: walled-in player occluded (sees 9 tiles, none past ring)**
- **PASS: FOV: open field sees 197 tiles within radius**
The only failure is `import ai.behaviors / entities.enemy` — that's the AI module owned by another worker, which the task explicitly says may still fail ("just ensure FOV passes"). A* and combat also pass since those workers already shipped.
## Summary
Created **`engine/fov.py`** only, implementing `compute_fov(width, height, tiles, ox, oy, radius=8) -> set[tuple[int,int]]` via **Björn Bergström recursive shadowcasting** over 8 octants, from scratch with no libraries and no pygame.
Key implementation details:
- **8 octants** driven by the standard `_OCTANTS` multiplier table; each octant scanned by a recursive `cast_light` tracking a slope window `[start, end]`.
- **Walls block beyond**: when a wall follows open floor, a child scan is spawned for the slope band past it; the wall run is marked `blocked`. The critical `if blocked: break` after each row stops the scan once a whole row sits in shadow — this is what makes the walled-in ring fully occlude (sees exactly origin + 8 walls).
- **Wall-adjacency rule**: a single additive post-pass lights any wall 8-adjacent to a visible floor tile (room boundaries always show).
- **Origin always visible**, and every returned tile satisfies `dx²+dy² ≤ radius²` (Euclidean, hence also within the Chebyshev bound).
- **Pure**: only reads `tiles[y][x]` (wall = `== 0`); all bookkeeping is in a local `set`. Out-of-bounds is treated as solid rock. The self-check even verifies `tiles` is byte-for-byte unchanged.
- A `__main__` self-check exercises the walled-in, open-field, and wall-pillar cases (the latter confirming a pillar hides the floor directly behind it but reveals the floor beside-behind it).