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