Background
Polyagony is a family of hypothetical esolangs where the source code is laid out on a specifically shaped board before running it. It's similar to Hexagony, but various uniform tilings can be used instead of a simple hexagon. The shape of the board and the tiling used is defined by the "mode".
Mode 3/3,6 is a triangular board filled with (3,6)2 tiling. The boards of sizes 1, 2, and 3 look like the following:
* * *
* * * * * *
* * * *
* * * * * * * *
* * *
* * * * * *
In general, the board of size n
can be formed by adding two rows under the board of size n-1
, where the two new rows are formed by putting n
copies of small triangles side by side. So the size 4 can be generated from size 3 as follows:
*
* *
* *
* * * *
* * *
* * * * * *
1 2 3 4
1 1 2 2 3 3 4 4
Given a source code of length n, the size of the board is determined first, and then each character in the code is sequentially placed on each asterisk from top to bottom, left to right. The rest is filled with no-ops (dots, as in Hexagony).
The board size is chosen so that it is the smallest board that can fit the entirety of the source code. For example, abcdefghi
would be placed as
a
b c
d e
f g h i
and abcdefghij
as
a
b c
d e
f g h i
j . .
. . . . . .
The minimum board size is 1. If the source code is empty, the laid out result must be a triangle of three no-ops:
.
. .
Challenge
In order to simplify the challenge a bit, let's assume the source code is just a string of asterisks (*
). Given the length of such a program as input, output the laid out result.
The output can be as a single string or a sequence of lines. Trailing whitespaces on each line or after the entire output are OK.
Standard code-golf rules apply. The shortest code in bytes wins.
Test cases
The expected outputs for the inputs 0 (three no-ops), 3, 9, and 18 (full triangles of asterisks) are already given above.
Input: 2
Output:
*
* .
Input: 4
Output:
*
* *
* .
. . . .
Input: 7
Output:
*
* *
* *
* * . .
Input: 17
Output:
*
* *
* *
* * * *
* * *
* * * * * .