Fix 2015/yang to compile everything

A rather unfortunate typo in the Makefile made make try and compile
already compiled C++ object code as source code.

Whilst I was at it I format fixed (and fixed other things I saw) the
README.md file.
This commit is contained in:
Cody Boone Ferguson committed 2023-06-03 08:06:56 -07:00
1 parent 96070ce50b
commit f86df1c28f
2 files changed
+43 -18

No files matched your search

+1 -1
View File
@@ -112,7 +112,7 @@ ENTRY= yang
PROG= prog
#
OBJ= ${PROG}.o
CSRC= ${PROG}.o
CSRC= ${PROG}.c
CPLUSPLUSSRC= ${PROG}.cc
DATA=
TARGET= ${PROG} ${PROG}_c90 ${PROG}_c99 ${PROG}_c11 ${CPLUSPLUSSRC} \
+42 -17
View File
@@ -9,6 +9,10 @@ Don Yang
make
```
[Cody Boone Ferguson](/winners.html#Cody_Boone_Ferguson) fixed an unfortunate
typo in the Makefile that was causing some of the files to compile properly,
trying instead to compile already compiled code. Thank you Cody!
## To run:
```sh
@@ -31,6 +35,16 @@ make output
./output
```
### Also try:
```sh
./prog
```
Keep pressing enter to see more output. Send EOF to terminate.
## Judges' remarks:
Before analysing the code in detail we were able to guess two out of four tests
@@ -39,10 +53,14 @@ this entry uses to tell the 5 languages/flavors apart. Can you find all four?
The way the text is encoded in the output doesn't cease to amaze. Can you tell
why an array of 512 elements is needed?
NOTE: the author calls the program `Fuuko` and so the source file referred to in
their remarks uses `fuuko.c`. The [Makefile](Makefile) will compile everything
so you need not worry about this.
## Author's remarks:
Fuuko is a sea star generator. Feed her some input through stdin to
get lots of sea star patterns in stdout.
`Fuuko` is a [sea star](https://en.wikipedia.org/wiki/Starfish) generator. Feed
her some input through `stdin` to get lots of sea star patterns in `stdout`.
```sh
cc -O3 -std=c90 fuuko.c -lm -o fuuko_c90
@@ -57,15 +75,18 @@ cc -O3 -std=c99 fuuko.c -lm -o fuuko_c99
echo IOCCC | ./fuuko_c99 > output_c99.c
```
Don't like sea stars? Use a C++98 compiler to get dango instead.
Don't like [sea stars](https://en.wikipedia.org/wiki/Starfish)? Use a C++98
compiler to get [dango](https://en.wikipedia.org/wiki/Dango) instead.
```sh
g++ -O3 -std=c++98 fuuko.c -lm -o fuuko_cpp98
echo IOCCC | ./fuuko_cpp98 > output_cpp98.c
```
Don't like dango either? Use a C++11 compiler to get just circles (or
Swiss cheese, if you prefer that).
Don't like [dango](https://en.wikipedia.org/wiki/Dango) either? Use a C++11
compiler to get just [circles](https://en.wikipedia.org/wiki/Circle) (or [Swiss
cheese](https://en.wikipedia.org/wiki/Swiss_cheeses_and_dairy_products), if you
prefer that).
```sh
g++ -O3 -std=c++11 fuuko.c -lm -o fuuko_cpp11
@@ -73,7 +94,7 @@ echo IOCCC | ./fuuko_cpp11 > output_cpp11.c
```
Don't like any of these patterns? Use a C11 compiler and there will be
no extra patterns.
no extra pattern.
```sh
cc -O3 -std=c11 fuuko.c -lm -o fuuko_c11
@@ -81,15 +102,15 @@ echo IOCCC | ./fuuko_c11 > output_c11.c
```
Regardless of which of these C/C++ dialects you choose, the output
will all be valid C90 code that reproduces original input on stdout,
will all be valid C90 code that reproduces original input on `stdout`,
filled with pointer dereferences (C stars).
Next time people ask you for a few pointers on C, you can run their
question through Fuuko and give them pointers all day long.
question through `Fuuko` and give them pointers all day long.
### Compatibility
Fuuko has been tested under these environments:
`Fuuko` has been tested under these environments:
- gcc 4.9.3 on Cygwin
- gcc 4.9.2 on Linux
@@ -106,25 +127,29 @@ Fuuko has been tested under these environments:
The most obscure parts are in detecting the subtle differences in
different dialects. The standard committees put a lot of effort into
avoiding "quiet changes", but Fuuko is still able to exploit a few of
avoiding "quiet changes", but `Fuuko` is still able to exploit a few of
those. It should be an interesting exercise for the reader to figure
how she did it.
Output patterns are usually random (except for C11). The built-in
random number generator is seeded using ASLR. On systems where ASLR
is not so random (such as cygwin), you can introduce randomness by
changing number of command line arguments to Fuuko.
Output patterns are usually random (except for C11). The built-in random number
generator is seeded using
[ASLR](https://en.wikipedia.org/wiki/Address_space_layout_randomization). On
systems where ASLR is not so random (such as cygwin), you can introduce
randomness by changing number of command line arguments to `Fuuko`.
Output is somewhat robust: corruption on most of the lines will
usually result in a compiler warning. This is because the output is
vastly redundant: For ~1K of input, expect output to be on the order
of ~1MB, and take ~500MB of RAM to compile.
CRC32 of source code is embedded in the source code itself.
[CRC32](https://en.wikipedia.org/wiki/Computation_of_cyclic_redundancy_checks#CRC-32_algorithm)
of source code is embedded in the source code itself.
Process of writing this program is included in spoiler.html
The process of writing this program can be seen by opening
[spoiler.html](spoiler.html) in a browser that supports JavaScript.
Code layout is inspired by Ibuki Fuuko, for her love of sea stars.
Code layout is inspired by [Ibuki
Fuuko](https://clannad.fandom.com/wiki/Fuko_Ibuki), for her love of sea stars.
## Copyright and CC BY-SA 4.0 License: