Introduction
Introduction Statistics Contact Development Disclaimer Help
int2cunei - annna - Annna the nice friendly bot.
git clone git://bitreich.org/annna/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws6…
Log
Files
Refs
Tags
README
---
int2cunei (2264B)
---
1 #!/usr/bin/env python
2 # coding=utf-8
3 #
4 # Idea from: https://trinket.io/python/3023f6104c42
5 #
6
7 import os
8 import sys
9 import getopt
10 import math
11
12 def usage(app):
13 app = os.path.basename(app)
14 print("usage: %s [-h] int" % (app), file=sys.stderr)
15 sys.exit(1)
16
17 def main(args):
18 try:
19 opts, largs = getopt.getopt(args[1:], "h")
20 except getopt.GetoptError as err:
21 print(str(err))
22 usage(args[0])
23
24 for o, a in opts:
25 if o == "-h":
26 usage(args[0])
27 else:
28 assert False, "unhandled option"
29
30 if len(largs) < 1:
31 usage(args[0])
32
33 inint = int(largs[0])
34
35 symbol_list=['-',"𒐕"]
36 symbol_list.append("𒐖")
37 symbol_list.append("𒐗")
38 symbol_list.append("𒐘")
39 symbol_list.append("𒐙")
40 symbol_list.append("𒐚")
41 symbol_list.append("𒑂")
42 symbol_list.append("𒑄")
43 symbol_list.append("𒑆")
44 symbol_list.append("𒌋")
45 for i in range(1,10):
46 symbol_list.append(symbol_list[10]+symbol_list[i])
47 symbol_list.append(symbol_list[10]+symbol_list[10])
48 for i in range(1,10):
49 symbol_list.append(symbol_list[20]+symbol_list[i])
50 symbol_list.append(symbol_list[10]+symbol_list[10]+symbol_list[10])
51 for i in range(1,10):
52 symbol_list.append(symbol_list[30]+symbol_list[i])
53 symbol_list.append("𒑩")
54 for i in range(1,10):
55 symbol_list.append(symbol_list[40]+symbol_list[i])
56 symbol_list.append("𒑪")
57 for i in range(1,10):
58 symbol_list.append(symbol_list[50]+symbol_list[i])
59
60 def numberToBase(n, b):
61 if n == 0:
62 return [0]
63 digits = []
64 while n:
65 digits.append(int(n % b))
66 n //= b
67 return digits[::-1]
68
69 def baseToInt(l, b):
70 rint = 0
71 i = 0
72 for d in reversed(l):
73 rint += d * (b**i)
74 i += 1
75 return rint
76
77 def cunei_print(l):
78 s = ""
79 for d in range(len(l)):
80 s += symbol_list[l[d]] + ""
81 return s
82
83 def find_leg(w,d):
84 return math.sqrt(d * d - w * w)
85
86 base = numberToBase(inint, 60)
87 cuneis = cunei_print(base)
88 print("%s" % (cuneis))
89
90 return 0
91
92 if __name__ == "__main__":
93 sys.exit(main(sys.argv))
94
You are viewing proxied material from bitreich.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.