Comments on Fibonascii Squares
Post
Fibonascii Squares
The Challenge
Your job is to, given input positive non-zero integer
Rules
Input:
- Input will be an integer
such that .
Output:
-
Output will be an ASCII representation of the tiled Fibonacci squares, up until the
th Fibonacci number. -
For Fibonacci number
, its respective square will be characters tall and characters wide. -
Squares must be tiled so as to match the arrangement shown in the examples below. However, the output may be mirrored or rotated by multiples of
as desired. The orientation may be changed based on the input. -
This challenge does include
as a member of the Fibonacci sequence, so bear that in mind. -
For cases where
is (and hence there aren't any squares to create), you may either output any number of whitespace characters or output nothing at all. -
Each square in the output must be represented by a grid made up of a unique ASCII character. For the characters forming your squares, you may use either the alphabet (either uppercase or lowercase, starting at
a
) or the digits 0-9 (starting at0
). You may reuse characters once you reach the end of the character sequence. You must use at least five unique characters. -
This is a code-golf challenge, so the code with the fewest bytes wins!
Examples
Here is an image of the proper way to tile Fibonacci squares:
Image source: Wikipedia
Example 1
Input:
6
Output:
DDDCC
DDDCC
DDDAB
EEEEE
EEEEE
EEEEE
EEEEE
EEEEE
Explanation: The input is A
and B
, respectively. The third square is C
, and so on until we reach the fifth square.
Example 2
Input:
1
Output:
Explanation: The input is
Example 3
Input:
3
Output:
AB
Explanation:
The input is A
, the second by B
.
2 comment threads