my version of @dis.sociat.ing's dollcode algorithm in python

Initial commit

digibruja 698a6a75

+70
+10
.gitignore
··· 1 + # Python-generated files 2 + __pycache__/ 3 + *.py[oc] 4 + build/ 5 + dist/ 6 + wheels/ 7 + *.egg-info 8 + 9 + # Virtual environments 10 + .venv
+1
.python-version
··· 1 + 3.13
+3
README.md
··· 1 + # dollcode 2 + 3 + port of @dis.sociat.ing's [dollcode](https://noe.sh/dollcode/) to python. prints to terminal.
+35
main.py
··· 1 + import argparse 2 + 3 + parser = argparse.ArgumentParser(description="converts base-10 number into dollcode") 4 + parser.add_argument("number", type=int, help="number to convert") 5 + args = parser.parse_args() 6 + 7 + char = ("▌", "▖", "▘") 8 + 9 + 10 + def dollcode(num: int): 11 + output = [] 12 + window = num 13 + limit = 1000 14 + 15 + while limit > 0 and window > 0: 16 + mod = window % 3 17 + 18 + if mod == 0: 19 + window = (window - 3) // 3 20 + else: 21 + window = (window - mod) // 3 22 + 23 + output.insert(0, char[mod]) 24 + limit -= 1 25 + 26 + return output 27 + 28 + 29 + def main(): 30 + print("Hello from dollcode!") 31 + print(dollcode(args.number)) 32 + 33 + 34 + if __name__ == "__main__": 35 + main()
+13
pyproject.toml
··· 1 + [project] 2 + name = "dollcode" 3 + version = "0.1.0" 4 + description = "converts base-10 number into dollcode" 5 + readme = "README.md" 6 + requires-python = ">=3.13" 7 + dependencies = [] 8 + [tool.basedpyright] 9 + venvPath = "." 10 + venv = ".venv" 11 + reportUnusedCallResult = false 12 + reportAny = false 13 + reportUnknownMemberType = false
+8
uv.lock
··· 1 + version = 1 2 + revision = 3 3 + requires-python = ">=3.13" 4 + 5 + [[package]] 6 + name = "dollcode" 7 + version = "0.1.0" 8 + source = { virtual = "." }