Merge pull request #1692 from xexyl/birken2014-make
This commit is contained in:
5 files changed
+93
-22
No files matched your search
@@ -139,6 +139,14 @@ ${PROG}: ${PROG}.c
|
|||||||
alt: data ${ALT_TARGET}
|
alt: data ${ALT_TARGET}
|
||||||
@${TRUE}
|
@${TRUE}
|
||||||
|
|
||||||
|
# Variables to control port and timing constant in alt code
|
||||||
|
#
|
||||||
|
PORT= 1701
|
||||||
|
TIME= 500000
|
||||||
|
|
||||||
|
${PROG}.alt: ${PROG}.alt.c
|
||||||
|
${CC} ${CFLAGS} -DNCC=${PORT} -DSTARDATE=${TIME} $< -o $@ ${LDFLAGS}
|
||||||
|
|
||||||
# data files
|
# data files
|
||||||
#
|
#
|
||||||
data: ${DATA}
|
data: ${DATA}
|
||||||
|
|||||||
@@ -56,13 +56,13 @@ described by the author. See [configuration](#configuration) below.
|
|||||||
To specify the port to say, 31337, try:
|
To specify the port to say, 31337, try:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
make clobber CDEFINE="-DNCC=31337" alt
|
make clobber PORT=31337 alt
|
||||||
```
|
```
|
||||||
|
|
||||||
To change the `STARDATE` timing constant, try:
|
To change the timing constant, `STARDATE`, try:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
make clobber CDEFINE="-DSTARDATE=5000000" alt
|
make clobber TIME=5000000 alt
|
||||||
```
|
```
|
||||||
|
|
||||||
You can combine them both of course.
|
You can combine them both of course.
|
||||||
|
|||||||
+46
-17
@@ -14,10 +14,11 @@ make
|
|||||||
|
|
||||||
### Try:
|
### Try:
|
||||||
|
|
||||||
On terminal supports 24 bit color, has black background, and size at least 125x38, try:
|
On a terminal that supports 24 bit color, has black background, and size at
|
||||||
|
least 125x38, try:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
./prog
|
./try.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@@ -54,16 +55,17 @@ make
|
|||||||
You can generate an A3 sized poster by _make docs_. This command creates a pdf
|
You can generate an A3 sized poster by _make docs_. This command creates a pdf
|
||||||
file _poikola.pdf_.
|
file _poikola.pdf_.
|
||||||
|
|
||||||
### What this entry does:
|
|
||||||
|
|
||||||
#### Introduction:
|
### Introduction:
|
||||||
|
|
||||||
It was a starry night when my wife pointed her finger up and asked: "What is
|
It was a starry night when my wife pointed her finger up and asked: "What is
|
||||||
this star and may I have some Easter eggs?"
|
this star and may I have some Easter eggs?"
|
||||||
|
|
||||||
So I had to sit down and solve those tricky questions with Nano and a C
|
So I had to sit down and solve those tricky questions with Nano and a C
|
||||||
compiler.
|
compiler.
|
||||||
|
|
||||||
#### Little spoilers:
|
|
||||||
|
### Little spoilers:
|
||||||
|
|
||||||
Basically, the program draws animated ASCII art of the Big Dipper using Annie
|
Basically, the program draws animated ASCII art of the Big Dipper using Annie
|
||||||
Jump Cannon's spectral classification system of stars and I think the colors of
|
Jump Cannon's spectral classification system of stars and I think the colors of
|
||||||
@@ -74,7 +76,9 @@ some Easter eggs.
|
|||||||
|
|
||||||
The program has also at least three other functions, obvious and not so obvious.
|
The program has also at least three other functions, obvious and not so obvious.
|
||||||
|
|
||||||
#### Technical jargon
|
|
||||||
|
### Technical jargon
|
||||||
|
|
||||||
This program has been tested on xterm and Konsole and also Linux virtual
|
This program has been tested on xterm and Konsole and also Linux virtual
|
||||||
terminal. Color support in the terminal is not necessary, but the effect is
|
terminal. Color support in the terminal is not necessary, but the effect is
|
||||||
better with it.
|
better with it.
|
||||||
@@ -83,12 +87,14 @@ This entry has partial support for terminals with a white background but the
|
|||||||
best viewing experience is achieved when the terminal in use supports 24-bit
|
best viewing experience is achieved when the terminal in use supports 24-bit
|
||||||
colors, has a black background and the size is at least 125x38.
|
colors, has a black background and the size is at least 125x38.
|
||||||
|
|
||||||
Special note for Mac users: __Terminal__ does not work as expected; you might
|
Special note for Mac users: `Terminal.app` does not work as expected; you might
|
||||||
need xterm from XQuartz or some other working terminal. Thanks to [Dave
|
need xterm from XQuartz (see [FAQ 3.7: How do I compile and use on macOS, an
|
||||||
Burton](/winners.html#Dave_Burton) for spotting this problem.
|
IOCCC winner that requires X11?](/faq.md#X11macos)) or some other working
|
||||||
|
terminal. Thanks to [Dave Burton](/winners.html#Dave_Burton) for spotting this
|
||||||
|
problem.
|
||||||
|
|
||||||
The main reason for the header `unistd.h` is `getdelim()` but once I included it
|
The main reason for the header `unistd.h` is `getdelim(3)` but once I included it
|
||||||
I also abused other functions and defines. This header is mutually exclusive
|
I also abused other functions and `#define`s. This header is mutually exclusive
|
||||||
with _-std=c11_.
|
with _-std=c11_.
|
||||||
|
|
||||||
The program was developed with little-endian machines; I tried to support
|
The program was developed with little-endian machines; I tried to support
|
||||||
@@ -102,15 +108,25 @@ This program has been compiled with:
|
|||||||
4. Lego Mindstorms EV3 Intelligent Brick (Debian Jessie) with gcc and clang (in
|
4. Lego Mindstorms EV3 Intelligent Brick (Debian Jessie) with gcc and clang (in
|
||||||
this case, compiling time with clang-3.5 12 seconds and with gcc 27 seconds)
|
this case, compiling time with clang-3.5 12 seconds and with gcc 27 seconds)
|
||||||
|
|
||||||
|
|
||||||
|
### Extra notes from the judges on the macOS Terminal.app problems:
|
||||||
|
|
||||||
|
Depending on the settings of the terminal in Terminal.app the program might not
|
||||||
|
show anything at all. In other cases it won't show all the colours right but
|
||||||
|
mostly is okay. YMMV, as they say.
|
||||||
|
|
||||||
|
|
||||||
### Warnings and restrictions required by law:
|
### Warnings and restrictions required by law:
|
||||||
|
|
||||||
Please do not feed little babies chocolate.
|
Please do not feed little babies chocolate.
|
||||||
|
|
||||||
### Major spoilers:
|
|
||||||
<div style="margin-bottom:61em;"> </div>
|
|
||||||
|
|
||||||
I incorporated the Fletcher 16 checksum algorithm into the source for security
|
### Major spoilers:
|
||||||
reasons; it might be challenging to make changes without breaking the main
|
|
||||||
functionality of the code.
|
I incorporated the [Fletcher 16 checksum
|
||||||
|
algorithm](https://en.wikipedia.org/wiki/Fletcher%27s_checksum) into the source
|
||||||
|
for security reasons; it might be challenging to make changes without breaking
|
||||||
|
the main functionality of the code.
|
||||||
|
|
||||||
The space after `#define p return` is necessary.
|
The space after `#define p return` is necessary.
|
||||||
|
|
||||||
@@ -118,6 +134,7 @@ The computus (method to determine the date of Easter) uses an algorithm
|
|||||||
described in the journal Nature in 1876. It should be valid for Gregorian
|
described in the journal Nature in 1876. It should be valid for Gregorian
|
||||||
calendars.
|
calendars.
|
||||||
|
|
||||||
|
|
||||||
### Some obfuscation techniques used:
|
### Some obfuscation techniques used:
|
||||||
|
|
||||||
1. I tried to use meaningless or misleading variable names. For example, this
|
1. I tried to use meaningless or misleading variable names. For example, this
|
||||||
@@ -144,11 +161,23 @@ questions:
|
|||||||
### Rot18 part
|
### Rot18 part
|
||||||
|
|
||||||
Because the rot13 is too easy to decode with the plain eyes, I decided to use
|
Because the rot13 is too easy to decode with the plain eyes, I decided to use
|
||||||
the Caesar cipher with the key 18.
|
the [Caesar cipher](https://en.wikipedia.org/wiki/Caesar_cipher) with the key
|
||||||
|
18:
|
||||||
|
|
||||||
Lzw xajkl tsffwj ak wfugvwv mkafy AWWW 754 xdgslk gf dafw 47. Al ak hjaflwv
|
Lzw xajkl tsffwj ak wfugvwv mkafy AWWW 754 xdgslk gf dafw 47. Al ak hjaflwv
|
||||||
gfdq gf dalldw-wfvasf esuzafwk.
|
gfdq gf dalldw-wfvasf esuzafwk.
|
||||||
|
|
||||||
|
If you want to or must know and don't know how to decipher this, you might look
|
||||||
|
at the [Caesar cipher decoder](https://www.dcode.fr/caesar-cipher). Find the
|
||||||
|
text that says:
|
||||||
|
|
||||||
|
```
|
||||||
|
Manual decryption and parameters
|
||||||
|
Shift/Key (number)
|
||||||
|
```
|
||||||
|
|
||||||
|
and enter 18 and then click the button that says: `DECRYPT (BRUTEFORCE)`.
|
||||||
|
|
||||||
|
|
||||||
## Copyright and CC BY-SA 4.0 License:
|
## Copyright and CC BY-SA 4.0 License:
|
||||||
|
|
||||||
|
|||||||
Executable
+25
@@ -0,0 +1,25 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
#
|
||||||
|
# try.sh - demonstrate IOCCC winner 2018/poikola
|
||||||
|
#
|
||||||
|
|
||||||
|
# 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
|
||||||
|
|
||||||
|
|
||||||
|
clear
|
||||||
|
read -r -n 1 -p "Press any key to show code (space = next page, q = quit): "
|
||||||
|
echo 1>&2
|
||||||
|
less -EXF prog.c
|
||||||
|
read -r -n 1 -p "Press any key to run program: "
|
||||||
|
echo 1>&2
|
||||||
|
./prog
|
||||||
+11
-2
@@ -3677,7 +3677,8 @@ code](/2014/birken/README.md#alternate-code) that lets one redefine the port to
|
|||||||
bind to in case there is a firewall issue or there is some other reason to not
|
bind to in case there is a firewall issue or there is some other reason to not
|
||||||
have the default port. Remember that ports < 1024 are privileged. It also lets
|
have the default port. Remember that ports < 1024 are privileged. It also lets
|
||||||
you redefine the timing constant `STARDATE` (see the author's remarks for more
|
you redefine the timing constant `STARDATE` (see the author's remarks for more
|
||||||
details).
|
details on this macro). The Makefile was made to use variables so it's easier to
|
||||||
|
redefine the port and timing constant.
|
||||||
|
|
||||||
|
|
||||||
## <a name="2014_deak"></a>[2014/deak](/2014/deak/prog.c) ([README.md](/2014/deak/README.md))
|
## <a name="2014_deak"></a>[2014/deak](/2014/deak/prog.c) ([README.md](/2014/deak/README.md))
|
||||||
@@ -4037,7 +4038,15 @@ supposed to segfault :-)
|
|||||||
|
|
||||||
## <a name="2019_poikola"></a>[2019/poikola](/2019/poikola/prog.c) ([README.md[(/2019/poikola/README.md))
|
## <a name="2019_poikola"></a>[2019/poikola](/2019/poikola/prog.c) ([README.md[(/2019/poikola/README.md))
|
||||||
|
|
||||||
[Cody](#cody) added a missing rule to the Makefile.
|
[Cody](#cody) added the `docs` rule to the Makefile that forms a PDF file. The
|
||||||
|
rule requires the tool `pdflatex`.
|
||||||
|
|
||||||
|
Cody also added the [try.sh](/2019/poikola/try.sh) script.
|
||||||
|
|
||||||
|
[Dave Burton](/winners.html#Dave_Burton), during the preview period, noticed a
|
||||||
|
problem where the macOS `Terminal.app` does not work properly for this program.
|
||||||
|
We added some additional notes on what might happen (it varies depending on
|
||||||
|
configuration).
|
||||||
|
|
||||||
|
|
||||||
## <a name="2019_karns"></a>[2019/karns](/2019/karns/prog.c) ([README.md](/2019/karns/README.md]))
|
## <a name="2019_karns"></a>[2019/karns](/2019/karns/prog.c) ([README.md](/2019/karns/README.md]))
|
||||||
|
|||||||
Reference in new issue
Block a user