Merge pull request #1073 from xexyl/1985-lycklama-alt

This commit is contained in:
Landon Curt Noll authored and GitHub committed 2023-10-16 17:42:43 -07:00
commit 69a471d256
2 files changed
+51 -34

No files matched your search

+48 -29
View File
@@ -1,14 +1,15 @@
# Strangest appearing program # Strangest appearing program
Ed Lycklama Ed Lycklama<br>
## To build: ## To build:
```sh ```sh
make all make alt
``` ```
If you have an old enough compiler you can try: If you have an old enough compiler you can try:
```sh ```sh
@@ -19,49 +20,67 @@ make lycklama.orig
## To run: ## To run:
```sh ```sh
./lycklama < some_file ./lycklama.alt < some_file
``` ```
There is an alternate version which slows down the output for a more fun display To see why we recommend the alternate version instead of the original version,
with modern systems. For this reason we encourage you to try that version see below and the [original code](#original-code) section.
as well. See Alternate code section below.
## Try: ## Try:
```sh This alternate version, which we recommend you you try first, prior to the
./lycklama < lycklama.c original, so that you can see what it does in modern systems, slows down the
output which will provide more fun output. It is slowed down by the `usleep(3)`
# notice the difference between the above and this one: library call with a configurable time to sleep. The default is 500 but you can
./lycklama < lycklama.alt.c reconfigure it like:
# also try:
./lycklama < lycklama.orig.c
./lycklama < README.md
./lycklama < Makefile
```
### Alternative code:
This alternate version slows down the output which will provide more fun
output. The default time passed to `usleep(3)` is `500` but you can reconfigure
it like:
```sh ```sh
make CDEFINE+="-DZ=700" clobber alt make CDEFINE+="-DZ=700" clobber alt
``` ```
#### Try: which would set it at 700. Then, whether you use the default value or not, try:
```sh ```sh
./lycklama.alt < lycklama.c ./lycklama.alt < lycklama.c
# notice the difference between the above and this one:
./lycklama.alt < lycklama.alt.c ./lycklama.alt < lycklama.alt.c
# also try:
./lycklama.alt < lycklama.orig.c ./lycklama.alt < lycklama.orig.c
./lycklama.alt < README.md
./lycklama.alt < Makefile ./lycklama.alt < Makefile
```
### Original code:
As explained above, because modern systems run this entry way too fast to fully
appreciate what it does, we encourage you to first try the alternate version.
After this, however, you might wish to try the original version, fixed for
modern systems. To do this:
```sh
make all
```
#### To use:
```sh
./lycklama < some_file
```
#### Try:
```sh
./lycklama < lycklama.c
./lycklama < lycklama.alt.c
./lycklama < lycklama.orig.c
./lycklama < Makefile
``` ```
+3 -5
View File
@@ -170,9 +170,7 @@ gave to have fun with finding primes that might seem unusual in a way.
Cody fixed this to compile with modern compilers. In the past one could get away Cody fixed this to compile with modern compilers. In the past one could get away
with defining some macro to `#define` and then use `#foo` to have the same with defining some macro to `#define` and then use `#foo` to have the same
effect as using `#define` but this does not work in modern systems so Cody effect as using `#define` but this does not work in modern systems so Cody
changed the `#o` lines to `#define`. The changed the `#o` lines to `#define`. Also `unistd.h` had to be `#include`d.
[lycklama.alt.c](1985/lycklama/lycklama.alt.c) is the original source
code as it provides some fun input for the entry.
Yusuke provided some useful information that amounts to an alternate version Yusuke provided some useful information that amounts to an alternate version
that Cody added. See the README.md for details. that Cody added. See the README.md for details.
@@ -346,7 +344,7 @@ README.md file for more details.
## [1988/phillipps](1988/phillipps/phillipps.c) ([README.md](1988/phillipps/README.md])) ## [1988/phillipps](1988/phillipps/phillipps.c) ([README.md](1988/phillipps/README.md]))
Cody fixed this for modern systems. It did not compile with clang because it Cody fixed this for modern systems. It did not compile with clang because it
requires the second and third args to `main()` to be `char **` but even before requires the second and third args of `main()` to be `char **` but even before
that with gcc it printed random characters. After fixing it for clang by that with gcc it printed random characters. After fixing it for clang by
changing `main()` to call the new function `pain()` (chosen because it's a pain changing `main()` to call the new function `pain()` (chosen because it's a pain
that clang requires these args to be `char **` :-) ) with the correct args it that clang requires these args to be `char **` :-) ) with the correct args it
@@ -376,7 +374,7 @@ thank him for this ghastly point! :-)
## [1988/westley](1988/westley/westley.c) ([README.md](1988/westley/README.md])) ## [1988/westley](1988/westley/westley.c) ([README.md](1988/westley/README.md]))
The [original version](1988/westley/westley.alt.c), provided as alternate code, The [original version](1988/westley/westley.alt.c), provided as alternate code,
was fixed by Misha Dynin, based on the judges' remarks so that this would work was fixed by Misha Dynin, based on the judges' remarks, so that this would work
with modern C compilers. We encourage you to try the alternate version to see with modern C compilers. We encourage you to try the alternate version to see
what happens with current compilers! See the README.md files for details. what happens with current compilers! See the README.md files for details.