smile - annna - Annna the nice friendly bot.
HTML git clone git://bitreich.org/annna/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/annna/
DIR Log
DIR Files
DIR Refs
DIR Tags
DIR README
---
smile (1875B)
---
1 #!/usr/bin/env python
2 # coding=utf-8
3
4 import os
5 import sys
6 import getopt
7 import random
8
9 def usage(app):
10 app = os.path.basename(app)
11 print("usage: %s [-h] [-n moves]" % (app), file=sys.stderr)
12 sys.exit(1)
13
14 def main(args):
15 horiz_hair = ["w", "W", "~"]
16 horiz_eyes = ["o", "O",
17 "𓁹", "𓁺", "𓁻", "𓁼", "𓁽", "𓁾", "𓁿", "𓂀",
18 "{.}", "(.)", "{o}", "{O}", "(o)", "(.)", "{.}",
19 "𓂂", "𓏗", "𓇳", "𓇸", "𓃉",
20 "0"]
21 horiz_nose = ["m", "v", "i", "."]
22 horiz_moustache = ["~~~", "===", "---", "w"]
23 horiz_mouth = ["\\/", "\\_/",
24 "𓂋", "𓂌", "𓂍", "𓂎", "𓂏", "𓂑", "𓂒",
25 ]
26
27 vert_hair = ["d", "c|", "<|", "~", ">", "<+|"]
28 vert_eyes = [":", "8", ";", "="]
29 vert_moustache = ["{", "#", "B", "3"]
30 vert_nose = ["-"]
31 vert_nose1 = ["-", "c", "0", "o"]
32 vert_mouth = [")", "}", "P", "p", "b", "*", ">", "D", "]", "O", "o"]
33 vert_tie = ["x", "X"]
34 vert_body = ["|-<", "|o<", "|O<", "|~<"]
35
36 try:
37 opts, largs = getopt.getopt(args[1:], "hb")
38 except getopt.GetoptError as err:
39 print(str(err))
40 usage(args[0])
41
42 vertical=1
43 withbody=0
44 for o, a in opts:
45 if o == "-h":
46 usage(args[0])
47 elif o == "-b":
48 withbody=1
49 else:
50 assert False, "unhandled option"
51
52 ostr = ""
53 if vertical == 1:
54 if random.randrange(1, 10) > 7:
55 ostr += random.choice(vert_hair)
56 ostr += random.choice(vert_eyes)
57 noserandrange = random.randrange(2, 5)
58 if noserandrange == 2:
59 ostr += random.choice(vert_nose1)
60 else:
61 nose = random.choice(vert_nose)
62 for i in range(1, noserandrange):
63 ostr += nose
64 if random.randrange(1, 10) > 8:
65 ostr += random.choice(vert_moustache)
66 ostr += random.choice(vert_mouth)
67 if random.randrange(1, 10) > 8:
68 ostr += random.choice(vert_tie)
69 if withbody == 1:
70 ostr += random.choice(vert_body)
71
72 print("%s" % (ostr))
73
74 return 0
75
76 if __name__ == "__main__":
77 sys.exit(main(sys.argv))
78