20
0
Background
Today (or Yesterday)'s is (or was) 11/23 or Fibonacci day! What better way to celebrate than to make a fibonacci cake?
Examples
3
ii
i_i_ii_i_i
8
ii
ii
ii
ii
ii
ii
ii
ii
i ii i
i ii i
i ii i
i ii i
i ii i
i i ii i i
i i ii i i
i i ii i i
i i i ii i i i
i i i ii i i i
i i i i ii i i i i
i i i i i ii i i i i i
i_i_i_i_i_i_i_ii_i_i_i_i_i_i_i
Challenge
You're not really making a cake, just the candles because I can't ascii-art a cake
To make the cake you must first get the first n
fibonacci numbers sorted ascending. The candle (i
)'s height is determined by value of the current fibonacci number. The candles are separated by an underscore (_
).
The cake should be symmetrical. So the candles should then be flipped and concatenated.
Example Construction
Input: 6
First 6 Fibonacci Numbers: 1, 1, 2, 3, 5, 8
Candle heights:
i
i
i
i i
i i
i i i
i i i i
i i i i i i
-----------
1 1 2 3 5 8
Output would be:
ii
ii
ii
i ii i
i ii i
i i ii i i
i i i ii i i i
i_i_i_i_i_ii_i_i_i_i_i
Reference Fibonacci Numbers
For reference, here are the first 15 fibonacci numbers. In this challenge, you'll be starting at 1
.
1,1,2,3,5,8,13,21,34,55,89,144,233,377,610
9I regret to inform the West Coast of the United States that for most of the world, 11/23 is over or almost over :( This has just turned from [tag:code-golf] to [tag:fastest-code] – cat – 2015-11-24T03:01:23.313
1@sysreq That's okay, they just need to travel to the west coast (instantly), and then they can enjoy Fibonacci day for a last 5 hours (7 for hawaii) :p – Downgoat – 2015-11-24T03:05:21.387
Travel thousands of miles instantly?
bash: beam-me-up: command not found
– cat – 2015-11-24T03:08:01.690Must we print all the leading whitespace to make it line up or can we just print, in effect, the tallest lines first descending? – cat – 2015-11-24T03:23:21.320
@sysreq No, candles must be printed in ascending order as specified. This wouldn't be too much harder as all I think it would be is a
" ".repeat(n*2)
. – Downgoat – 2015-11-24T03:35:25.490Trivial, indeed, for Python and Javascript – cat – 2015-11-24T03:36:54.810
6This challenge is going to be legendary in 43 years (11/23/58). – Arcturus – 2015-11-24T04:43:21.263
9In 43 years the mm/dd/yy date format will be history. All intelligent beings will have switched to yyyy/mm/dd... :-P – None – 2015-11-24T05:18:13.367
1@sysreq Posting golfed answers in verbose languages is very much encouraged. Of course, you're not competing with Pyth, but you can compete with other answers in the same language or in languages of comparable verbosity. – Martin Ender – 2015-11-24T09:33:54.770
@yeti
/
is an inferior separator for that. – SuperJedi224 – 2015-11-24T14:33:37.690What is the minimum value of n? – Dennis – 2015-11-24T16:56:10.357
@Dennis you can assume the minimum value is 1 and the input is always an integer. You don't need to handle invalid inputs – Downgoat – 2015-11-24T16:57:25.180
OK, 1 is going to be a special case... Is superflous whitespace (e.g., leading blank lines) alllowed? – Dennis – 2015-11-24T16:58:34.597
@Dennis Yes, as long as it doesn't interfere with the relative position of the candles. – Downgoat – 2015-11-24T17:01:29.343