From 6aa1141e291cabf395f584c42af51169fd9e9ca4 Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Thu, 27 Apr 2023 06:11:48 -0700 Subject: [PATCH] Add optional usleep() to 1985/lycklama With a tip from Yusuke Endoh I noticed that if you slow down the call to write() you see some fun output. Now to make it as close to possible as the original (there already is alt code! - mostly for fun display) I don't call usleep() unless the macro Z is not 0. This way someone can do: make CDEFINE+="-DZ=1000" clobber all for example but if they just do make clobber all it won't be slow at all or it'll be as slow as it takes the CPU to run it. --- 1985/lycklama/Makefile | 2 +- 1985/lycklama/README.md | 15 ++++++++++++++- 1985/lycklama/lycklama.c | 2 +- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/1985/lycklama/Makefile b/1985/lycklama/Makefile index ce02663ac..de594d275 100644 --- a/1985/lycklama/Makefile +++ b/1985/lycklama/Makefile @@ -58,7 +58,7 @@ ARCH= # Defines that are needed to compile # -CDEFINE= +CDEFINE= -DZ=0 # Include files that are needed to compile # diff --git a/1985/lycklama/README.md b/1985/lycklama/README.md index 745f0668f..e0b7e64ad 100644 --- a/1985/lycklama/README.md +++ b/1985/lycklama/README.md @@ -13,7 +13,20 @@ make all modern compilers. In the past 'define' in `#define` could even be defined but to get this to work on modern systems Cody changed the `#o` lines to `#define`. The `lycklama.alt.c` is the original source code as it provides some fun input for -the entry. +the entry. Thank you Cody! With a tip from [Yusuke +Endoh](/winners.html#Yusuke_Endoh) it was indirectly noticed that if one slows +down the call to `write()` one can see some fun output that's not visible with +modern systems so Cody added a call to `usleep()`. The default time is `0` +which disables it (in order to make it as close to original as possible; an alt +version already exists mostly for fun output). In order to change the speed (try +500 or 700) do: + +```sh +make CDEFINE+="-DZ=700" clobber all +``` + +Thank you Yusuke! + ## Try: diff --git a/1985/lycklama/lycklama.c b/1985/lycklama/lycklama.c index 3bb0f7462..72a594f36 100644 --- a/1985/lycklama/lycklama.c +++ b/1985/lycklama/lycklama.c @@ -9,7 +9,7 @@ #define o_ main #define o__ if #define oo_ 0 -#define _o(_,__,___)(void)___o(_,__,ooo(___)) +#define _o(_,__,___)(void)___o(_,__,ooo(___),Z&&usleep(Z)) #define __o (o_o_<<((o_o_<<(o_o_<