The bat's only sense of the cave is its own chirp bouncing back. Every pulse casts a fan of 7 sample directions; each returns after a real round-trip time Δt = 2d/c (c = 343 m/s, the true speed of sound in air), from which the bat recovers the same distance it started with: d = c·Δt/2. The heading you see is computed from those recovered distances only — steering away from directions with a short return time (an obstacle close ahead) and toward a locked-on echo that keeps closing.
f_echo = f0 · (c+v_target)(c+v_bat) / [(c−v_bat)(c−v_target)]
v_bat and v_target are the radial (closing) velocity components along the line of sight. This is the exact non-relativistic two-hop Doppler shift for a moving source and a moving reflector — the mechanism a real bat uses to judge how fast prey is closing without ever "seeing" it. Two more real effects are modeled: higher chirp frequencies scatter more strongly off small prey (Rayleigh scattering, roughly ∝ (radius/wavelength)²) but attenuate faster with range in air, so raising the frequency trades detection range for the ability to resolve small moths — and a higher pulse rate (a real bat's "terminal buzz") updates the bat's picture of the cave more often, letting it react faster and thread narrower gaps.