A paper and Python simulation applying the law of refraction and principle of least time to find the most time-efficient position for a lifeguard to jump into the water to save a drowning person using realistic values.
Every Python file uses sympy
simulation.py
uses pygame
heatmap.py
uses seaborn
The Python files in this repository are the files used to generate the graphs used in the paper and are not of much use on their own. simulation.py
is a simulation that visualises the straight path and lifeguard's path to the target with user-specified conditions. Click anywhere in the water region to set the target location and use w
and s
to move the lifeguard farther or closer to the waterfront, respectively. There is a bug in sympy
that makes it fail to find any valid solutions when the target is close to the left edge of the screen.