Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AllReachable ¶
AllReachable reports whether every cell in cells is reachable on an already-built flow field.
Types ¶
type Field ¶
Field is a reverse-BFS flow field toward one or more exit cells.
For each reachable walkable tile, Next points one step closer to an exit. Exit cells point at themselves. Unreachable cells have no next step.
When several downhill neighbors share the same Dist, Next prefers moving down (increasing Y) before sideways — so creeps drop straight toward a bottom exit strip when the maze opens up.
func RebuildFromExits ¶ added in v0.0.2
RebuildFromExits computes a flow field toward any of the given exit cells (multi-source reverse BFS). Cost is O(width*height).
func (*Field) Direction ¶
Direction returns a unit vector from cell (x, y) toward its next step. At an exit, or when unreachable, ok is false and dx, dy are 0.