I have recently thought of a wonderful relatively old mobile game, called Tower Bloxx. Alhough I'm not really old myself, but it reminded me of childhood and school :)
So this my challenge is a kind of a reference to that good game!
I have (hopefully) looked into any tower question on PPCG and this won't be a dupe.
Definition
Given N
- number of blocks, build a tower of N blocks with the following pattern. The horizontal coordinate is changed with every block.
In order to avoid misinterpretations, here's the "table" of correlations between the n-th block and its horizontal coordinate.
There're no random things there, the coordinate for each block is strictly defined.
These horizontal coordinates are all listed relative to the first block and they are in fact just for readability of the following test cases.
N X (coord)
------
1 0
2 2
3 -2
4 0
5 -2
6 2
7 goto N=1
On top of the last block, you must smash a roof.
Input
Positive integer (N
).
Output:
N
blocks stacked on top of each other and the roof. Each block is horizontally moved compared to the first block (to either -2, 0, or 2 points), as described in the table.
The block structure:
*********
* ----- *
* | | *
* | | *
* ----- *
*********
Once they are stacked together, the top of the lower block intersects with the bottom of the higher block:
*********
* ----- *
* | | *
* | | *
* ----- *
***********
* ----- *
* | | *
* | | *
* ----- *
*********
The roof that should be stacked on top of the last, n-th block is:
*
***
** **
** **
The block with the roof atop looks like this:
*
***
** **
** **
*********
* ----- *
* | | *
* | | *
* ----- *
*********
Test cases below.
Input: 1
. Output:
*
***
** **
** **
*********
* ----- *
* | | *
* | | *
* ----- *
*********
Input: 2
. Output:
*
***
** **
** **
*********
* ----- *
* | | *
* | | *
* ----- *
***********
* ----- *
* | | *
* | | *
* ----- *
*********
Input: 3
. Output:
*
***
** **
** **
*********
* ----- *
* | | *
* | | *
* ----- *
*************
* ----- *
* | | *
* | | *
* ----- *
***********
* ----- *
* | | *
* | | *
* ----- *
*********
Input: 4
. Output:
*
***
** **
** **
*********
* ----- *
* | | *
* | | *
* ----- *
***********
* ----- *
* | | *
* | | *
* ----- *
*************
* ----- *
* | | *
* | | *
* ----- *
***********
* ----- *
* | | *
* | | *
* ----- *
*********
Input: 10
. Output:
*
***
** **
** **
*********
* ----- *
* | | *
* | | *
* ----- *
***********
* ----- *
* | | *
* | | *
* ----- *
*************
* ----- *
* | | *
* | | *
* ----- *
***********
* ----- *
* | | *
* | | *
* ----- *
***********
* ----- *
* | | *
* | | *
* ----- *
*************
* ----- *
* | | *
* | | *
* ----- *
***********
* ----- *
* | | *
* | | *
* ----- *
***********
* ----- *
* | | *
* | | *
* ----- *
*************
* ----- *
* | | *
* | | *
* ----- *
***********
* ----- *
* | | *
* | | *
* ----- *
*********
Scoring
Code golf, shortest wins!
Trailing invisible stuff is allowed.