Merge pull request #1624 from xexyl/endoh413

This commit is contained in:
Landon Curt Noll authored and GitHub committed 2023-12-04 10:48:36 -07:00
commit c657772d92
6 files changed
+66 -11

No files matched your search

+3 -1
View File
@@ -32,7 +32,7 @@ Next look at `jpeg.jpg` in an image viewer program.
## Judges' remarks:
\
This is a program which, when fed its own source, generates a program that
almost is its whitespace inverse, which, in its order, generates a JPEG file
(speaking of file size abuse, that is about 16.4 times larger than a PBM file
@@ -53,6 +53,7 @@ straightforward bitmap comparison.
* Discrete cosine transform
* JPEG Huffman encoding (cheating)
### Notes
I picked JPEG instead of PNG, GIF, or BMP
@@ -67,6 +68,7 @@ year.
I think the program will work on any major platforms and compilers.
### Legal
This program uses (a part of) Proggy Tiny Fonts
+21 -4
View File
@@ -4,6 +4,16 @@
make
```
### Bugs and (Mis)features:
The current status of this entry is:
```
STATUS: INABIAF - please **DO NOT** fix
```
For more detailed information see [2013 endoh3 in bugs.md](/bugs.md#2013-endoh3).
## To use:
@@ -23,6 +33,8 @@ The simplest way is to create a .wav file and have your system play that.
echo 'CDEFGABc' | ./endoh3 | ruby wavify.rb > cde.wav
```
Observe how you will need ruby installed.
There are also some other musical samples, twinkle.abc and menuet.abc.
@@ -33,6 +45,7 @@ media platforms that have small message length limits.
This endoh3ram can toot out a tune that is small enough.
### A modern day (2023) note about the award 'Most tweetable 1-liner' and twitter:
The IOCCC no longer endorses the use of what was once twitter, or whatever it
@@ -101,6 +114,7 @@ program:
tree](https://en.wikipedia.org/wiki/Stern-Brocot_tree).
- How does it generate a wave? Hint: it generates a saw wave.
### Limitation
The following features are supported:
@@ -125,6 +139,7 @@ The following features are *NOT* supported:
- Any meta fields: `T:title` `L:1/4`
- Bar line, repeat, ties and slurs, and everything else.
### Known Bugs
You can *NOT* write a note length immediately followed by a note `E`,
@@ -134,6 +149,7 @@ Can you figure out why?
A workaround is inserting a whitespace: `C2 E2`.
### Portability
I tested it on:
@@ -152,6 +168,7 @@ But I do not attach it to protect you from W\*\*\*\*r.
For the same reason, do not post a score that contains only `z1092`.
You know, it is ["the famous song"](http://en.wikipedia.org/wiki/4%E2%80%B233%E2%80%B3).
### Spoiler
Here is a magical expression which I found by brute-force:
@@ -203,15 +220,15 @@ Finally, the following code generates a saw wave:
for(c = 0; c < len; c++) putchar(a = n * D);
```
where `D` is a frequency and `a` is a variable whose type is char. By assigning
float to char variable, the implicit type conversion is performed from float to
char (modulo 256).
where `D` is a frequency and `a` is a variable whose type is `char`. By
assigning `float` to `char` variable, the implicit type conversion is performed
from `float` to `char` (modulo 256).
(Strictly speaking, this behavior is undefined according to 6.3.1.4 in C99; you
can replace it with `(long)(n*D)` if you are pedantic.)
All that was left was to combine and condense the components. The key is
squashing them into just one for-loop.
squashing them into just one `for`-loop.
## Copyright and CC BY-SA 4.0 License:
+2
View File
@@ -65,11 +65,13 @@ This simple spec involves many details.
(Note that this program does not use `math.h`.)
### Portability
I think it conforms with both C89 and C99. I confirmed that it worked on gcc,
clang, and tcc. It should not be warned with `-pedantic` and `-Wextra`.
### Tips
You may want to use `tput` to hide the terminal cursor.
+14 -1
View File
@@ -1,6 +1,19 @@
#!/usr/bin/env bash
#
# try.sh - demonstrate IOCCC winner 2013/endoh4
#
make all || exit 1
# make sure CC is set so that when we do make CC="$CC" it isn't empty. Doing it
# this way allows us to have the user specify a different compiler in an easy
# way.
if [[ -z "$CC" ]]; then
CC="cc"
fi
make CC="$CC" all >/dev/null || exit 1
# clear screen after compilation so that only the entry is shown
clear
# set it so that when program is terminated through various signals we re-enable
# the cursor
+21
View File
@@ -2907,6 +2907,27 @@ section](2013/endoh1/README.md#spoiler).
--
## 2013 endoh3
### STATUS: INABIAF - please **DO NOT** fix
### Source code: [2013/endoh3/endoh3.c](2013/endoh3/endoh3.c)
### Information: [2013/endoh3/README.md](2013/endoh3/README.md)
From the author:
--
You can *NOT* write a note length immediately followed by a note `E`,
such as `C2E2`.
Can you figure out why?
A workaround is inserting a whitespace: `C2 E2`.
--
## 2013 hou
### STATUS: INABIAF - please **DO NOT** fix
+5 -5
View File
@@ -3589,11 +3589,11 @@ The entry can still be enjoyed if you do not have these tools, however.
## [2013/endoh4](2013/endoh4/endoh4.c) ([README.md](2013/endoh4/README.md))
[Cody](#cody) added the [run.sh](2013/endoh4/run.sh) script which temporarily turns off
the cursor as suggested by the author, with the addition that if no file is
specified it will feed the source code [endoh4.c](2013/endoh4/endoh4.c) to the
program rather than the file specified. It does not try and detect if the file
exists or can be read as that will be handled by the shell/program.
[Cody](#cody) added the [try.sh](2013/endoh4/try.sh) script which temporarily
turns off the cursor as suggested by the author, with the addition that if no
file is specified it will feed the source code [endoh4.c](2013/endoh4/endoh4.c)
to the program rather than the file specified. It does not try and detect if the
file exists or can be read as that will be handled by the shell/program.
## [2013/hou](2013/hou/hou.c) ([README.md](2013/hou/README.md))