GeoCitesSites.com

Problem # 8 : Spiral constellations

Write a sub-routine SPIRAL(N) which generates a square spiral of N stars on a cleared screen. Any two arms of the spiral should have only one star in common. The difference between the length (in stars) of any two touching arms of the spiral should be exactly one.

The first arm of the spiral of length 2 should go from the screen position (40 12) to (41 12). All further turns should be counter clock-wise (90 degrees).

N can range between 2 - 200.

Sample Output
SPIRAL(10) should produce the following pattern :-

[Sample Output]

and SPIRAL(72) should produce :-

[Sample Output]

Previous Problem
Return to problems at The Vault
(Back to problems at The Vault )
Next Problem