Mayan numerals: Difference between revisions
Content added Content deleted
m (→{{header|jq}}: simplify) |
Drkameleon (talk | contribs) (added Arturo) |
||
Line 796: | Line 796: | ||
|style="width:3em;vertical-align:bottom;"|Θ |
|style="width:3em;vertical-align:bottom;"|Θ |
||
|} |
|} |
||
=={{header|Arturo}}== |
|||
<syntaxhighlight lang="arturo">UL: "╔" |
|||
UC: "╦" |
|||
UR: "╗" |
|||
LL: "╚" |
|||
LC: "╩" |
|||
LR: "╝" |
|||
HB: "═" |
|||
VB: "║" |
|||
Mayan: [" ", " ∙ ", " ∙∙ ", "∙∙∙ ", "∙∙∙∙"] |
|||
M0: " Θ " |
|||
M5: "────" |
|||
toMayan: function [digit][ |
|||
result: array.of:4 Mayan\0 |
|||
if digit = 0 [ |
|||
result\3: M0 |
|||
return result |
|||
] |
|||
d: digit |
|||
loop 3..0 'i [ |
|||
if? d >= 5 [ |
|||
result\[i]: M5 |
|||
d: d - 5 |
|||
] |
|||
else [ |
|||
result\[i]: Mayan\[d] |
|||
break |
|||
] |
|||
] |
|||
return result |
|||
] |
|||
draw: function [mayans][ |
|||
idx: dec size mayans |
|||
prints UL |
|||
loop 0..idx 'i [ |
|||
loop 0..3 'j [ |
|||
prints HB |
|||
] |
|||
prints (i < idx)? -> UC -> UR ++ `\n` |
|||
] |
|||
loop 1..4 'i [ |
|||
prints VB |
|||
loop 0..idx 'j -> |
|||
prints mayans\[j]\[dec i] ++ VB |
|||
print "" |
|||
] |
|||
prints LL |
|||
loop 0..idx 'i [ |
|||
loop 0..3 'j -> |
|||
prints HB |
|||
prints (i < idx)? -> LC -> LR ++ `\n` |
|||
] |
|||
] |
|||
loop [4005, 8017, 326205, 886205, 1081439556] 'n [ |
|||
print ["Converting" n "to Mayan:"] |
|||
digs: digits.base:20 n |
|||
mayans: map digs => toMayan |
|||
draw mayans |
|||
print "" |
|||
]</syntaxhighlight> |
|||
{{out}} |
|||
<pre>Converting 4005 to Mayan: |
|||
╔════╦════╦════╗ |
|||
║ ║ ║ ║ |
|||
║ ║ ║ ║ |
|||
║────║ ║ ║ |
|||
║────║ Θ ║────║ |
|||
╚════╩════╩════╝ |
|||
Converting 8017 to Mayan: |
|||
╔════╦════╦════╦════╗ |
|||
║ ║ ║ ║ ∙∙ ║ |
|||
║ ║ ║ ║────║ |
|||
║ ║ ║ ║────║ |
|||
║ ∙ ║ Θ ║ Θ ║────║ |
|||
╚════╩════╩════╩════╝ |
|||
Converting 326205 to Mayan: |
|||
╔════╦════╦════╦════╦════╗ |
|||
║ ║ ║ ║ ║ ║ |
|||
║ ║ ║────║ ║ ║ |
|||
║ ║ ║────║────║ ║ |
|||
║ ∙∙ ║ Θ ║────║────║────║ |
|||
╚════╩════╩════╩════╩════╝ |
|||
Converting 886205 to Mayan: |
|||
╔════╦════╦════╦════╦════╗ |
|||
║ ║ ║ ║ ║ ║ |
|||
║ ║ ║────║ ║ ║ |
|||
║ ║────║────║────║ ║ |
|||
║────║────║────║────║────║ |
|||
╚════╩════╩════╩════╩════╝ |
|||
Converting 1081439556 to Mayan: |
|||
╔════╦════╦════╦════╦════╦════╦════╗ |
|||
║ ∙ ║ ∙∙ ║∙∙∙ ║∙∙∙∙║∙∙∙ ║ ∙∙ ║ ∙ ║ |
|||
║────║────║────║────║────║────║────║ |
|||
║────║────║────║────║────║────║────║ |
|||
║────║────║────║────║────║────║────║ |
|||
╚════╩════╩════╩════╩════╩════╩════╝</pre> |
|||
=={{header|AutoHotkey}}== |
=={{header|AutoHotkey}}== |