stockholm/krebs/5pkgs/simple/krebsdance/default.nix

115 lines
2.3 KiB
Nix
Raw Normal View History

2022-01-27 12:20:55 +00:00
{ writers }:
writers.writePython3Bin "krebsdance" {} ''
import argparse
import random
claws = [
dict(
up='(\\/)',
down='(/\\)',
left='(\\\\)',
right='(//)',
),
dict(
up='(V)',
down='(A)',
2022-01-27 14:33:34 +00:00
left='>)=',
right='=(<',
2022-01-27 12:20:55 +00:00
),
dict(
up='(U)',
down='(n)',
2022-01-27 14:33:34 +00:00
left=')==',
right='==(',
2022-01-27 12:20:55 +00:00
),
]
eyes = [
'°',
'*',
'^',
'ö',
'o',
'O',
'X',
'x',
'U',
'u',
]
bodies = [
dict(
left='(',
right=')',
),
dict(
left='{',
right='}',
),
dict(
left='[',
right=']',
),
dict(
left='<',
right='>',
),
dict(
left='|',
right='|',
),
]
mouths = [
',,,,',
',mm,',
'_mm_',
'-mm-',
';;;;',
';mm;',
':mm:',
'::::',
':ww:',
':<>:',
]
def main():
parser = argparse.ArgumentParser()
parser.add_argument(
'seed',
nargs='?',
help='random seed to use for generating the krebs variant',
)
parser.add_argument(
'--dance', '-d',
dest='dance',
help='if the krebs should dance',
default=False,
action='store_true',
)
args = parser.parse_args()
if args.seed:
random.seed(args.seed)
clawstyle = random.choice(claws)
body = random.choice(bodies)
eye = random.choice(eyes)
mouth = random.choice(mouths)
if args.dance:
print(f'{clawstyle["down"]} {body["left"]}{eye}{mouth}{eye}{body["right"]}{clawstyle["up"]}') # noqa
2022-01-27 14:33:34 +00:00
print(f' {clawstyle["left"]}{body["left"]}{eye}{mouth}{eye}{body["right"]} {clawstyle["right"]}') # noqa
2022-01-27 12:20:55 +00:00
print(f'{clawstyle["right"]} {body["left"]}{eye}{mouth}{eye}{body["right"]} {clawstyle["left"]}') # noqa
2022-01-27 14:33:34 +00:00
print(f' {clawstyle["down"]}{body["left"]}{eye}{mouth}{eye}{body["right"]}{clawstyle["down"]}') # noqa
2022-01-27 12:20:55 +00:00
else:
print(f'{clawstyle["up"]} {body["left"]}{eye}{mouth}{eye}{body["right"]} {clawstyle["up"]}') # noqa
if __name__ == '__main__':
main()
''