Challenge 3: Fibonacci Spiral

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:

  1. Turn each Fibonacci number N into a square. So 3 becomes a 3x3 square, for example.
  2. 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.)

The Challenge

  1. Draw your own sketch on graph paper of the first few squares, labeling two corners of each square with their coordinates.
  2. Turn those first few squares into code, using the coordinates you derived from the graph paper.
  3. 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.)
  4. 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.