diff options
author | lassulus <lassulus@lassul.us> | 2022-01-27 13:20:55 +0100 |
---|---|---|
committer | lassulus <lassulus@lassul.us> | 2022-01-27 13:20:55 +0100 |
commit | e5c8919da86403ab94aacef4308f75998216669b (patch) | |
tree | b703581af7ce23a195e57741beaf771b758144bd | |
parent | 61f7ba2bddf74f73077e43468e2ba2ef153852c9 (diff) |
reaktor2: show dancing krebs
-rw-r--r-- | krebs/5pkgs/simple/krebsdance/default.nix | 115 | ||||
-rw-r--r-- | krebs/5pkgs/simple/reaktor2-plugins.nix | 6 |
2 files changed, 116 insertions, 5 deletions
diff --git a/krebs/5pkgs/simple/krebsdance/default.nix b/krebs/5pkgs/simple/krebsdance/default.nix new file mode 100644 index 000000000..e95b6578f --- /dev/null +++ b/krebs/5pkgs/simple/krebsdance/default.nix @@ -0,0 +1,115 @@ +{ writers }: +writers.writePython3Bin "krebsdance" {} '' + import argparse + import random + + claws = [ + dict( + up='(\\/)', + down='(/\\)', + left='(\\\\)', + right='(//)', + ), + dict( + up='(V)', + down='(A)', + left='>)', + right='(<', + ), + dict( + up='(U)', + down='(n)', + left=')=', + right='=(', + ), + ] + + 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 + print(f'{clawstyle["left"]}{body["left"]}{eye}{mouth}{eye}{body["right"]} {clawstyle["right"]}') # noqa + print(f'{clawstyle["right"]} {body["left"]}{eye}{mouth}{eye}{body["right"]} {clawstyle["left"]}') # noqa + print(f'{clawstyle["down"]}{body["left"]}{eye}{mouth}{eye}{body["right"]}{clawstyle["down"]}') # noqa + else: + print(f'{clawstyle["up"]} {body["left"]}{eye}{mouth}{eye}{body["right"]} {clawstyle["up"]}') # noqa + + + if __name__ == '__main__': + main() +'' diff --git a/krebs/5pkgs/simple/reaktor2-plugins.nix b/krebs/5pkgs/simple/reaktor2-plugins.nix index 54aaf246a..052e389a6 100644 --- a/krebs/5pkgs/simple/reaktor2-plugins.nix +++ b/krebs/5pkgs/simple/reaktor2-plugins.nix @@ -23,11 +23,7 @@ rec { dance = { filename = pkgs.writeDash "dance" '' - echo "<(^.^<)" - echo "<(^.^)>" - echo "(>^.^)>" - echo "(7^.^)7" - echo "(>^.^<)" + ${pkgs.krebsdance}/bin/krebsdance --dance "$@"; ''; }; |