Improve 1984/mullender alt code

Using 2018/mills (an amazing entry) with trial and error I was able to
determine the approximate speed that the :-) moved across the screen and
now the alt code moves at almost exactly (I believe, at least) that
speed.

The mullender.alt2.c was deleted; instead that became mullender.alt.c.
This is because (I believe but have not confirmed) that the original did
not exit after it timed out and there's no need to have two alt versions
when they're so similar. One is good enough and the obvious choice is
the one that can keep going on.

.gitignore updated.
This commit is contained in:
Cody Boone Ferguson committed 2023-12-15 04:52:39 -08:00
1 parent 36f452de33
commit 475b0beec7
6 files changed
+24 -28

No files matched your search

-1
View File
@@ -8,6 +8,5 @@ indent.c
indent.o
mullender
mullender.alt
mullender.alt2
mullender.orig
prog.orig
+2 -2
View File
@@ -112,8 +112,8 @@ OBJ= ${PROG}.o
DATA=
TARGET= ${PROG}
#
ALT_OBJ= ${PROG}.alt.o ${PROG}.alt2.o
ALT_TARGET= ${PROG}.alt ${PROG}.alt2
ALT_OBJ= ${PROG}.alt.o
ALT_TARGET= ${PROG}.alt
#################
+12 -14
View File
@@ -26,16 +26,18 @@ For more detailed information see [1984 mullender in bugs.md](/bugs.md#1984-mull
```sh
./mullender.alt [microseconds]
./mullender.alt2 [microseconds] # starts over after it times out
```
The default microseconds is 10000 and it is also the lowest it can be as any
lower doesn't work very well. This feature is so you can experiment with
different speeds in between writes. It can be useful if your CPU is too slow or
too fast (:-) ).
Hit ctrl-c/intr to exit the program.
The author stated that the original version also had a delay.
The default microseconds is 190000 as this is approximately how long it slept in
the original entry but it can be no lower than 5000 as any lower doesn't work
very well. This feature is so you can experiment with different speeds in
between writes. It can be useful if your CPU is too fast :-)
The author stated that the original version also had a delay but the difference
is it required one to hit enter for it to print another line; the alt code will
start over once it times out or if one hits a key.
Note that the microseconds is argc and it uses `atoi()` which does NOT check for
overflow!
@@ -49,15 +51,11 @@ which is probably not as uncommon as you think :-).
```sh
./mullender.alt
./mullender.alt 5000
./mullender.alt 5000 # wait for 5000 microseconds and see what happens
./mullender.alt 500
./mullender.alt 20000 # wait for 20000 microseconds and see what happens
./mullender.alt 20000
./mullender.alt 100000
./mullender.alt2 500 # wait for 500 microseconds and see what happens
./mullender.alt 100000 # wait for 100000 microseconds and see what happens
```
What happens if you hit enter after it reaches the end of the line? Why? What
+1 -1
View File
@@ -1 +1 @@
main(i,v)char**v;{i=v[1]?atoi(v[1]):10000;i=i<500?500:i;do write(1," :-)\b\b\b\b",9),usleep(i);while(--i);write(1,"\n",1);}
main(i,v)char**v;{j:i=v[1]?atoi(v[1]):190000;i=i<5000?5000:i;do write(1," :-)\b\b\b\b",9),usleep(i);while(--i);write(1,"\n",1);goto j;}
-1
View File
@@ -1 +0,0 @@
main(i,v)char**v;{j:i=v[1]?atoi(v[1]):10000;i=i<500?500:i;do write(1," :-)\b\b\b\b",9),usleep(i);while(--i);write(1,"\n",1);goto j;}
+9 -9
View File
@@ -130,15 +130,15 @@ This was fixed on 30 October 2023 after the bug status was changed from INABIAF
## <a name="1984_mullender"></a>[1984/mullender](/1984/mullender/mullender.c) ([README.md](/1984/mullender/README.md]))
[Cody](#cody) provided an [alternate version](/1984/mullender/mullender.alt.c), an
improved version of the judges, so that everyone can enjoy it with systems that
are not VAX/PDP. We also refer you to the [FAQ](faq.md) as there are some
winning entries that also let one enjoy it - with more to them of course!
Cody further added the second alt version,
[mullender.alt2.c](/1984/mullender/mullender.alt2.c) which is like the
[1984/mullender/mullender.alt.c](/1984/mullender/mullender.alt.c) except that it
starts over after it times out.
[Cody](#cody) provided an [alternate version](/1984/mullender/mullender.alt.c),
an improved version of the judges, so that everyone can enjoy it with systems
that are not VAX/PDP. It moves at approximately the same speed as the original
did. We also refer you to the [FAQ](faq.md) as there are some winning entries
that also let one enjoy it (which through trial and error was how the right
speed was discovered) - with more to them of course! The difference between the
original is that it will start over after it times out but that might not happen
with the original (might need you to press a key though this is not known for
sure).
Cody also added the [gentab.c](/1984/mullender/gentab.c) file, fixed to compile
(and work, though see [bugs.md](#1984mullender-readmemd)) with modern systems