The other day, my son asked me to build him a staircase using Lego-ish blocks. And I came up with something like this:
Then my kid asked me for a program using the least number of bytes that generated a similar staircase in a computer screen. I am not that good at code-golf, so I need your help. I need a program that:
- Receives a positive integer with the number of levels the staircase needs to have.
- Outputs a drawing of a staircase, with the pattern you see in the image.
The output will be in text format but the bricks can be distinguished one from another. For instance, you may use the '█' character as half a block and paint it in any color you want, or just choose any character of your choice.
Restrictions:
- Blocks need to be of three different colors, which will be used as long as possible (if input is 1 or 2 there are not enough blocks to use all three colors). If you want, you may use the '░▒▓' characters, for instance, or just select three different characters.
- No two blocks of the same color or pattern can be side to side in a single row.
My son does not really care about trailing spaces or new lines as long as a staircase is drawn.
Examples (sorry for the bad choice of characters):
Input: 1
Output:
██
Input: 2
Output:
██
▓▓
Input: 3
Output:
██
▓▓
██░░
Input: 5
Output:
██
██
██░░
██░░
██░░▓▓