Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
74
Task/Mayan-numerals/11l/mayan-numerals.11l
Normal file
74
Task/Mayan-numerals/11l/mayan-numerals.11l
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
-V
|
||||
UL = ‘╔’
|
||||
UC = ‘╦’
|
||||
UR = ‘╗’
|
||||
LL = ‘╚’
|
||||
LC = ‘╩’
|
||||
LR = ‘╝’
|
||||
HB = ‘═’
|
||||
VB = ‘║’
|
||||
|
||||
Mayan = [‘ ’,
|
||||
‘ ∙ ’,
|
||||
‘ ∙∙ ’,
|
||||
‘∙∙∙ ’,
|
||||
‘∙∙∙∙’]
|
||||
|
||||
M0 = ‘ @ ’
|
||||
M5 = ‘────’
|
||||
|
||||
F toBase20(=n)
|
||||
V result = [n % 20]
|
||||
n I/= 20
|
||||
L n != 0
|
||||
result [+]= n % 20
|
||||
n I/= 20
|
||||
R reversed(result)
|
||||
|
||||
F toMayanNumeral(=d)
|
||||
V result = [Mayan[0], Mayan[0], Mayan[0], Mayan[0]]
|
||||
I d == 0
|
||||
result[3] = :M0
|
||||
R result
|
||||
|
||||
L(i) (3..0).step(-1)
|
||||
I d >= 5
|
||||
result[i] = :M5
|
||||
d -= 5
|
||||
E
|
||||
result[i] = Mayan[d]
|
||||
L.break
|
||||
|
||||
R result
|
||||
|
||||
F draw(mayans)
|
||||
V idx = mayans.len - 1
|
||||
|
||||
print(:UL, end' ‘’)
|
||||
L(i) 0 .. idx
|
||||
print(:HB * 4, end' ‘’)
|
||||
I i < idx
|
||||
print(:UC, end' ‘’)
|
||||
E
|
||||
print(:UR)
|
||||
|
||||
L(i) 1..4
|
||||
print(:VB, end' ‘’)
|
||||
L(j) 0 .. idx
|
||||
print(mayans[j][i - 1]‘’:VB, end' ‘’)
|
||||
print()
|
||||
|
||||
print(:LL, end' ‘’)
|
||||
L(i) 0 .. idx
|
||||
print(:HB * 4, end' ‘’)
|
||||
I i < idx
|
||||
print(:LC, end' ‘’)
|
||||
E
|
||||
print(:LR)
|
||||
|
||||
L(n) [4005, 8017, 326205, 886205, 1081439556]
|
||||
print(‘Converting ’n‘ to Mayan:’)
|
||||
V digits = toBase20(n)
|
||||
V mayans = digits.map(d -> toMayanNumeral(d))
|
||||
draw(mayans)
|
||||
print()
|
||||
Loading…
Add table
Add a link
Reference in a new issue