diff --git a/1984/mullender/Makefile b/1984/mullender/Makefile index b45316974..b539c0321 100644 --- a/1984/mullender/Makefile +++ b/1984/mullender/Makefile @@ -137,7 +137,7 @@ alt: data ${ALT_TARGET} @${TRUE} ${ALT_TARGET}: ${PROG}.alt.c - ${CC} -include stdio.h -include unistd.h ${CFLAGS} $< -o $@ ${LIBS} + ${CC} -include stdio.h -include unistd.h -include stdlib.h ${CFLAGS} $< -o $@ ${LIBS} # data files # diff --git a/1984/mullender/README.md b/1984/mullender/README.md index 42cc744ee..3fe9b76f4 100644 --- a/1984/mullender/README.md +++ b/1984/mullender/README.md @@ -20,20 +20,45 @@ Robbert van Renesse [Cody Boone Ferguson](/winners.html#Cody_Boone_Ferguson) added the alternative code which lets you run this on other systems. He notes though that this was -only a slight fix to the change in the [faq](/faq.md). Thank you Cody for your -assistance! +only a slight fix and enhancement to the change in the [faq](/faq.md). Thank you +Cody for your assistance! -To build: +### To build: make alt -Use `./mullender.alt` as you would `./mullender` above. +### To run: + + ./mullender.alt [microseconds] + +The default microseconds is 10000. This ability is so you can experiment with +different speeds in between writes. It can be useful if your CPU is too slow or +too fast. + +BTW: is there such a thing as too fast a CPU ? :-) actually yes for certain code +which is probably not as uncommon as you think :-) ). + +Note that it is an int and it uses `atoi()` which does NOT check for +overflow! In fact it's argc itself. + + +### Try: + + + ./mullender.alt + + ./mullender.alt 5000 + + ./mullender.alt 500 + + ./mullender.alt 20000 + +What happens if you hit enter after it writes a line of output? ## Judges' comments: - Without question, this C program is the one of the most obfuscated C program that has ever been received! Like all great contest entries, they result in a change of rules for the following year. @@ -55,6 +80,8 @@ makes direct calls to the write() Unix system call to produce a message on the screen. Can you guess what is printed? We knew you couldn't! :-) +BTW: this remains my (Landon Curt Noll's) all time favorite entries! + ## Author's comments: These comments, found at diff --git a/1984/mullender/mullender.alt.c b/1984/mullender/mullender.alt.c index ad6677967..4329093eb 100644 --- a/1984/mullender/mullender.alt.c +++ b/1984/mullender/mullender.alt.c @@ -1 +1 @@ -main(){int i=10000;do write(1," :-)\b\b\b\b",9),usleep(i);while(--i);} +main(i,v)char**v;{i=v[1]?atoi(v[1]):10000;do write(1," :-)\b\b\b\b",9),usleep(i);while(--i);} diff --git a/faq.md b/faq.md index 4d485dae3..a8ca9b5ea 100644 --- a/faq.md +++ b/faq.md @@ -41,9 +41,13 @@ can enjoy this entry. Try: ```sh make alt -./mullender.alt +./mullender.alt [microseconds] ``` +The microseconds defaults to 10000. + +Thank you Cody! + See also [Yusuke Endoh](/winners.html#Yusuke_Endoh)'s entry [2015/endoh3](/2015/endoh3/README.md) entry which lets one compile it and run it. @@ -353,15 +357,24 @@ try the alternative code added by [Cody Boone Ferguson](/winners.html#Cody_Boone ```sh make alt -./mullender.alt +./mullender.alt [microseconds] ``` +where microseconds is the number of microseconds to sleep between writes. +Default 10000. This is useful to see different speeds as well as if your CPU is +too slow or too fast for the entry. See the +[README.md](/1984/mullender/README.md) for more details. + Thank you Cody for your help! -BTW: in this case it's a slight adjustment to our original suggested code: +BTW: in this case it's a slight fix and improvement to our original suggested +code: main(){int i=512;do write(1," :-)\b\b\b\b",9),usleep(i);while(--i);} +BTW: is there such a thing as too fast a CPU ? :-) actually yes for certain code +which is probably not as uncommon as you think :-) ). + break; - case [1991/davidguy](years.html#1991_davidguy): disable access