Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,44 @@
F perta(atomic)
-V
NOBLES = [2, 10, 18, 36, 54, 86, 118]
INTERTWINED = [0, 0, 0, 0, 0, 57, 89]
INTERTWINING_SIZE = 14
LINE_WIDTH = 18
V prev_noble = 0
V row = 0
Int col
L(noble) NOBLES
row = L.index
I atomic <= noble
V nb_elem = noble - prev_noble
V rank = atomic - prev_noble
I INTERTWINED[row] & atomic C INTERTWINED[row] .. INTERTWINED[row] + INTERTWINING_SIZE
row += 2
col = rank + 1
E
V nb_empty = LINE_WIDTH - nb_elem
V inside_left_element_rank = I noble > 2 {2} E 1
col = rank + (I rank > inside_left_element_rank {nb_empty} E 0)
L.break
prev_noble = noble
R (row + 1, col)
V TESTS = [
(1, (1, 1)),
(2, (1, 18)),
(29, (4,11)),
(42, (5, 6)),
(58, (8, 5)),
(59, (8, 6)),
(57, (8, 4)),
(71, (8, 18)),
(72, (6, 4)),
(89, (9, 4)),
(90, (9, 5)),
(103, (9, 18)),
]
L(input, out) TESTS
V found = perta(input)
print(TEST:#3 -> .format(input)String(found)(I found != out { ; ERROR: expected out} E ))