Given an integer x, output a spiral design that has that many lines in it. For example:
x = 5 ***** ....* ***.* *...* ***** x= 11 *********** ..........* *********.* *.......*.* *.*****.*.* *.*...*.*.* *.*.***.*.* *.*.....*.* *.*******.* *.........* ***********
Comments:
Anonymous - 10 years, 5 months ago
I did it :D.. was a harder one tbh.. nvm here is a haskell solution
print list ist just there to show the printed list
now i can finally go to bed :D
reply permalink
mf - 10 years, 5 months ago
another Haskell solution
reply permalink
David - 10 years, 5 months ago
I have spent way too much time messing around with this...
reply permalink
David - 10 years, 4 months ago
I haven't touched this in most of the past week. I think I'll just post the crap I have at this point. No debug cleanup even.
It has a but with the last turn being right next to a previous line if the size is inconvenient. I had intended to make a more generic function for advancing in the current direction to save on if/else cases, but got busy.
reply permalink