42
3
A simple one today. Write the shortest program that draws a "sawtooth alphabet" given a positive integer for the height. You must write the name of your programming language when you come to the letter it starts with.
For example, if your language is Python and the input is 1
the output should be:
ABCDEFGHIJKLMNOPythonQRSTUVWXYZ
If the input is 2
the output should be:
B D F H J L N Python R T V X Z
A C E G I K M O Q S U W Y
If the input is 4
the output should be:
D J Python V
C E I K O Q U W
B F H L N R T X Z
A G M S Y
Notes
A
always starts at the bottom left.- Input can be via stdin or function call or similar. Output to stdout.
- Input above
26
doesn't need to work. - No trailing spaces.
9Are programming languages with one letter names allowed? (C, J, K, etc.) – isaacg – 2014-07-28T06:15:33.027
@isaacg Sure. I'd imagine it might be easier in them. – Calvin's Hobbies – 2014-07-28T06:16:27.147
1Can the input simply be expected to be stored in a variable? – Martin Ender – 2014-07-28T10:17:06.197
@MartinBüttner Yes, that's fine. – Calvin's Hobbies – 2014-07-28T15:54:23.940
How do answers deal with reduced terminal spaces (in other words, what can I do if the screen can't handle the width or height of the sawtooth)? – Doktoro Reichard – 2014-07-28T19:23:21.540
@DoktoroReichard Is there relly a terminal that can't fit 26 characters? No matter what, the output should still be the same as it would be when displayed on a large terminal. Its not your problem if a small terminal can't display it properly. – Calvin's Hobbies – 2014-07-28T19:46:50.807
13Btw, this isn't a sawtooth wave, this is a triangle wave :P – qwr – 2014-07-29T01:04:10.577
@qwr ...dang it – Calvin's Hobbies – 2014-07-29T01:12:12.397
For one letter languages you could have used something like: Ah, Bee, Cee, Dee, Ee, Eff … Eks, Why, Zed. – kay - SE is evil – 2014-07-29T21:37:12.447