We are currently working on new rules for what content should and shouldn't be allowed on this website, and are looking for feedback! See Esolang:2026 topicality proposal to view and give feedback on the current draft.

Alexandrian Streetsweeper

From Esolang
Jump to navigation Jump to search

An Alexandiran Streetsweeper is a machine for registering a dictionary to a heptavintimal registry


machine

python machine

import math

def S_orig(c):
    i = ord(c) - 65
    if i < 1:
        return (i, i+1)
    return (1, 9999)

def refine(word, radix):
    lo, hi = 0.0, float(radix)
    for c in word:
        a, b = S_orig(c)
        w = hi - lo
        lo = lo + w * (a / 9999)
        hi = lo + w * ((b - a) / 9999)
    return lo, hi

HEPT = "0ABCDEFGHIJKLMNOPQRSTUVWXYZ"

def to_heptavintimal(n):
    n = abs(n) % 19683
    if n == 0:
        return "0"
    digits = []
    while n > 0:
        n, r = divmod(n, 27)
        digits.append(HEPT[r])
    return "".join(reversed(digits))

def analyze(word):
    print("WORD:", word)
    print()

    last_hept = None

    # positive sweep: 19683 → 0
    for r in range(19683, -1, -1):
        lo, hi = refine(word, r)
        hept = to_heptavintimal(int(abs(lo)))
        if hept != last_hept:
            print(f"radix-{r}: {hept}")
            last_hept = hept

    # negative sweep: -1 → -99991
    for r in range(-1, -99992, -1):
        lo, hi = refine(word, r)
        hept = to_heptavintimal(int(abs(lo)))
        if hept != last_hept:
            print(f"radix-{r}: {hept}")
            last_hept = hept

analyze("!")

examples

"Fuck"

WORD: Fuck

radix-19683: G
radix-17500: F
radix-15000: E
radix-12500: D
radix-10000: C
radix-7500: B
radix-5000: A
radix-2500: 0
radix--2501: A
radix--5001: B
radix--7501: C
radix--10001: D
radix--12501: E
radix--15001: F
radix--17501: G
radix--20002: H
radix--22502: I
radix--25002: J
radix--27502: K
radix--30002: L
radix--32502: M
radix--35002: N
radix--37502: O
radix--40003: P
radix--42503: Q
radix--45003: R
radix--47503: S
radix--50003: T
radix--52503: U
radix--55003: V
radix--57503: W
radix--60004: X
radix--62504: Y
radix--65004: Z
radix--67504: A0
radix--70004: AA
radix--72504: AB
radix--75004: AC
radix--77504: AD
radix--80005: AE
radix--82505: AF
radix--85005: AG
radix--87505: AH
radix--90005: AI
radix--92505: AJ
radix--95005: AK
radix--97505: AL

See also