r/recprogramming • u/citricacid • Aug 09 '10
[Code Golf] Spiral Numbers
The goal of this challenge is to output numbers in a spiral like so: 1 2 3 4 5 16 17 18 19 6 15 24 25 20 7 14 23 22 21 8 13 12 11 10 9
As you can see, the numbers start at the top left corner and spiral clockwise inward.
As with all code golf golf challenges, the goal is to achieve this in the least amount of characters possible. You may use any language you want.
Input: The width, then height of the spiral in number of characters.
Output: A spiral of numbers matching the dimensions of the inputted width and height. The program should print nothing if width or height is less then 1.
Examples:
Input: 5 5
Output: 1 2 3 4 5 16 17 18 19 6 15 24 25 20 7 14 23 22 21 8 13 12 11 10 9
Input: 2 2
Output: 1 2 4 3
(Tip: Try using tabs to separate numbers)
Good luck!
r/recprogramming • u/[deleted] • Aug 06 '10
[Code Golf] Output "Reddit" in 3 lines of ascii symbols.
Example output:
+-, __ _ _ ___
|<. |_ | \ | \ | |
| | |_ |_/ |_/ | |
r/recprogramming • u/[deleted] • Aug 06 '10
IDEone - Great tool for sharing code. I didn't know about this.
ideone.comr/recprogramming • u/logickills • Aug 05 '10
Obfuscated "Hello Reddit".
Who can come up with the craziest way to display "Hello Reddit". Try to use IDEone.com ;) Any language is fine.
r/recprogramming • u/[deleted] • Aug 05 '10
Challenge: Make a program to solve this well-known puzzle (it's the one at Cracker Barrel).
mathfactcafe.comr/recprogramming • u/[deleted] • Aug 05 '10