I've been itching for us to tackle this particular puzzle, and with the subject arising in Hazel's project, it's time to make it a class challenge. If you haven't yet, go through her latest draft to see what the spiral is.
As for how it's made, it's pretty simple and elegant algorithm, and a wonderful visualization:
- Turn each Fibonacci number N into a square. So 3 becomes a 3x3 square, for example.
- Arrange the squares so that each one shows that it is the sum of the previous ones. (Click on the image to the right to see.)
- Draw your own sketch on graph paper of the first few squares, labeling two corners of each square with their coordinates.
- Turn those first few squares into code, using the coordinates you derived from the graph paper.
- Put your coordinates into a table. Include in the table the size of the square. Study the table. Do you see a relationship that describes how the coordinates evolve as the squares get bigger and bigger? (Feel free to discuss this step in #coding.)
- If you think you can see the relationship, alter your code so that it draws the ever-expanding squares inside a loop, with zero hard-coded values...just a few variables that change each time through the loop.
That last step is HARD. Don't get discouraged, and discuss it in #coding. As long as you haven't actually solved it yourself, feel free to post code for everybody to discuss. Just try to not give too much away.