Merge pull request #226 from xexyl/1984-mullender-alt
This commit is contained in:
4 files changed
+50
-10
No files matched your search
@@ -137,7 +137,7 @@ alt: data ${ALT_TARGET}
|
|||||||
@${TRUE}
|
@${TRUE}
|
||||||
|
|
||||||
${ALT_TARGET}: ${PROG}.alt.c
|
${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
|
# data files
|
||||||
#
|
#
|
||||||
|
|||||||
@@ -20,20 +20,45 @@ Robbert van Renesse
|
|||||||
|
|
||||||
[Cody Boone Ferguson](/winners.html#Cody_Boone_Ferguson) added the alternative
|
[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
|
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
|
only a slight fix and enhancement to the change in the [faq](/faq.md). Thank you
|
||||||
assistance!
|
Cody for your assistance!
|
||||||
|
|
||||||
To build:
|
### To build:
|
||||||
|
|
||||||
|
|
||||||
make alt
|
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:
|
## Judges' comments:
|
||||||
|
|
||||||
|
|
||||||
Without question, this C program is the one of the most obfuscated
|
Without question, this C program is the one of the most obfuscated
|
||||||
C program that has ever been received! Like all great contest
|
C program that has ever been received! Like all great contest
|
||||||
entries, they result in a change of rules for the following year.
|
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
|
message on the screen. Can you guess what is printed? We knew you
|
||||||
couldn't! :-)
|
couldn't! :-)
|
||||||
|
|
||||||
|
BTW: this remains my (Landon Curt Noll's) all time favorite entries!
|
||||||
|
|
||||||
## Author's comments:
|
## Author's comments:
|
||||||
|
|
||||||
These comments, found at
|
These comments, found at
|
||||||
|
|||||||
@@ -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);}
|
||||||
@@ -41,9 +41,13 @@ can enjoy this entry. Try:
|
|||||||
|
|
||||||
```sh
|
```sh
|
||||||
make alt
|
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
|
See also [Yusuke Endoh](/winners.html#Yusuke_Endoh)'s entry
|
||||||
[2015/endoh3](/2015/endoh3/README.md) entry which lets one compile it and run
|
[2015/endoh3](/2015/endoh3/README.md) entry which lets one compile it and run
|
||||||
it.
|
it.
|
||||||
@@ -353,15 +357,24 @@ try the alternative code added by [Cody Boone Ferguson](/winners.html#Cody_Boone
|
|||||||
|
|
||||||
```sh
|
```sh
|
||||||
make alt
|
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!
|
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);}
|
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;
|
break;
|
||||||
|
|
||||||
- case [1991/davidguy](years.html#1991_davidguy): disable access
|
- case [1991/davidguy](years.html#1991_davidguy): disable access
|
||||||
|
|||||||
Reference in new issue
Block a user