This challenge is simple. Given a number, output a ascii-art representation of the number, using the Mayan Base-20 numeral system.
What is the Mayan system?
The Mayans used base 20 to store numbers, so the first position was the 1
s place, the next the 20
s place, then the 400
s, etc.
So Mayan number 1
is 1
in base 10, but 10
is actually 20
in base 10, 207
is 807
in base 10, etc..
And they represented their numbers as pictographs, with a special symbol for 0
.
-------------------
| | | | |
| | | | |
|-------------------|
| |
| |
-------------------
That was their zero. (at least the half picascii half my artisticness ascii art version)
That is a real picture of the mayan zero symbol.1
This was their five:
--------------------------------
| |
--------------------------------
And a 4:
---- ---- ---- ----
| | | | | | | |
| | | | | | | |
---- ---- ---- ----
Finally, to put it together:
---- ---- ----
| | | | | |
| | | | | |
---- ---- ----
--------------------------------
| |
--------------------------------
--------------------------------
| |
--------------------------------
So they have x//5
bars, and x%5
dots on top of the bars. And if x=0
, they use the shell/loaf instead of a blank space.
For more images, try the Wikimedia Commons page of Maya number images.
But this is only for numbers up to 19
. We aren't allowed to have more than 4
bars and 4
dots in a single 'story'... So we go up!
The output for 20 is:
----
| |
| |
----
-------------------
| | | | |
| | | | |
|-------------------|
| |
| |
-------------------
Note this would normally be invalid, because is has a 1
and a 0
at the same time. But the 3
(note that, your answer needs at least 3) newlines before the 0
mean a new place value.
The bottom story has dots, meaning 1
, and bars meaning 5
. But it actually has dots meaning 20^0
and bars meaning 20^0 * 5
.
Each story goes up a power. The second story dots mean 20
(20^1
) and 100
(20^1 * 5
).
So the number 506
can be represented as:
----
| |
| |
----
--------------------------------
| |
--------------------------------
----
| |
| |
----
--------------------------------
| |
--------------------------------
This is (20^0) * 1 + (20^0 * 5) * 1 + (20^1 * 5) * 1 + (20^2) * 1 = 1 + 5 + 100 + 400 = 506
.
Your mission, should you choose not or choose to (it doesn't matter), is to output a ascii art representation of the base-10 number.
Other Rules:
- Leading/trailing space is okay, as long as the dots, bars, and shells are intact.
- The bars, dots, and shells must be exactly what the test cases have. No resizing.
- Leading '0's are okay. (leading shells on the output)
- You don't have to have exactly 3 newlines between each place value or story, just at least 3.
Test Cases:
15
--------------------------------
| |
--------------------------------
--------------------------------
| |
--------------------------------
--------------------------------
| |
--------------------------------
12
---- ----
| | | |
| | | |
---- ----
--------------------------------
| |
--------------------------------
--------------------------------
| |
--------------------------------
4
---- ---- ---- ----
| | | | | | | |
| | | | | | | |
---- ---- ---- ----
0
-------------------
| | | | |
| | | | |
|-------------------|
| |
| |
-------------------
24
----
| |
| |
----
---- ---- ---- ----
| | | | | | | |
| | | | | | | |
---- ---- ---- ----
33
----
| |
| |
----
---- ---- ----
| | | | | |
| | | | | |
---- ---- ----
--------------------------------
| |
--------------------------------
--------------------------------
| |
--------------------------------
20
----
| |
| |
----
-------------------
| | | | |
| | | | |
|-------------------|
| |
| |
-------------------
1: They also used the heads of gods for the symbols, but for this challenge the shell/bread/zelda chest will be used.
but for this challenge the shell/bread will be used.
. Not shell, not bread. LOZ link to the past chest. \$\endgroup\$