## Planning for a complex program (ZigZagLakes)

 Be sure you read the zig zag lake problem description first. Watch the video to see how the program starts
1. Questions:
1. Does the position of the first flower change on any of the islands?
(Notice that the first net is always directly below the first flower on the top left)
2. Will the second Jeroo always have enough flowers to break through all the nets?
• Analysis: Look at the islands and be sure you understand what is different for each island.
1. The first Jeroo starts at position (1,0), facing east, with no flowers. Where is that?
2. After the first Jeroo picks all the flowers in the row that is ahead of it, how does it know which way to turn to find more flowers?
3. How does one Jeroo give all of its flowers to another Jeroo?
4. After all of the flowers are gone, where will the gaps in the nets be?
5. Is the first net (in the bottom right corner) always in the same location on each island?
6. In the end, all the nets and all the flowers will be gone.

• Break the problem description down into sections like this: (high level algorithm)
• The first Jeroo should follow the trail of flowers around the lakes, going from the northwest to the southeast, picking each flower it finds along the way. It should stop after all flowers have been picked and pass them to the second Jeroo. The second Jeroo should then follow the trail of nets from the southeast to the northwest. This Jeroo will disable each net as it comes to it by tossing a flower on it, stopping at the shore. At the end of the program, the first Jeroo and second Jeroo should each do a spin (360-degree turn) to celebrate what they have accomplished.
• Break the large parts into more detailed parts
pickFlowers giveFlowers disableNets dance
1. do you need to find the flowers first?
2. keep doing this:
3. pick a row
4. decide which way to turn
1. do you need to find the other jeroo first?
2. keep giving flowers as long as the first jeroo still has some
1. do you need to find the nets first?
2. keep doing this:
3. pick a row
4. decide which way to turn or if you should hop ahead
1. do you need to know which way each Jeroo will be facing?
2. Turn 4 times
3. how can the same method work for both Jeroos without repeated code?
• Have you solved some of these before? Can some methods be used for both Jeroos? Should some methods be broken up into smaller methods?