AP CSA FRQ Guide
2005 FRQ 3: ZigZagFish
Select alternating forward-diagonal moves for a fish, keep its heading after successful moves, and reverse its heading without changing the intended diagonal side when blocked.
Legacy Marine Biology Movement State22 minute targetMarine Biology Simulationstateinheritancelocationslegacy
Skills Tested
What this FRQ is really practicing
Marine Biology Simulationstateinheritancelocationslegacy
Review these topics before attempting the problem.
Starter Approach
How to begin with your own plan
- 1Part A: use willZigRight to choose the forward-right or forward-left diagonal, returning that location only when it is valid and empty.
- 2When blocked, return the current location without changing any fish state in nextLocation.
- 3Part B: move to the selected diagonal location when possible, preserve the heading, and toggle willZigRight after the successful move.
- 4If blocked, remain in place and reverse the heading while keeping the same intended diagonal side for the next attempt.
Attempt the problem before opening the solution.
Common Mistakes
Mistakes to watch for while writing
Changing state while only selecting the next location.
Turning the fish after a successful diagonal move.
Toggling the diagonal side after a blocked attempt instead of retaining it.
Self Check
Review questions before you submit
Uses the stored diagonal-side state.
The first attempted diagonal is forward-right; successful moves alternate the side.
Checks that a candidate location is empty.
Validate the candidate before checking occupancy and return the current location when blocked.
Uses nextLocation to determine the attempted move.
Separate destination selection from movement and state updates.
Toggles the diagonal-side state after moving.
Do not toggle the side when the fish is blocked and only reverses its heading.
Practice Links
