## Square spiral

Since we want to draw the spiral using ascii characters we need to draw it in one pass. Now imagin a grid n*n, for each cell (x,y) in the grid we need to decide wheter to fill the cell, or to leave it blank. To do so we simply find the coordinates (cornerx,cornery) of each corner along a diagonal and the length of each side that springs from that corner and see if our coordinates (x,y) are contained in that side.

Here is a sample output (the output may appear distorted if you don’t use monospace font):

@@@@@@@@@@@@@@@@
@
@@@@@@@@@@@@@ @
@           @ @
@ @@@@@@@@@ @ @
@ @       @ @ @
@ @ @@@@@ @ @ @
@ @ @   @ @ @ @
@ @ @ @ @ @ @ @
@ @ @ @@@ @ @ @
@ @ @     @ @ @
@ @ @@@@@@@ @ @
@ @         @ @
@ @@@@@@@@@@@ @
@             @
@@@@@@@@@@@@@@@