A boat moves at 3m/s in still water across a river 100m wide that flows at 2m/s. Which way should it point? You will make the program try every heading, and find the quickest crossing and the heading that lands it straight opposite.
The idea. For a heading ϕ upstream from the line straight across,
vacross=vbcosϕ
vdown=vr−vbsinϕ
The time is vacrossd, and the drift is vdown× the time.
Your tasks.
Find the time and the drift for every heading in the list.
Find the heading that gives the shortest time.
Find the heading that gives the drift closest to zero.
Do the tasks in the editor first, and run the checker after each one. Its hints help when a check fails. When you are ready, compare your code with this solution.