Merge pull request #235 from xexyl/2018-poikola
This commit is contained in:
2 files changed
+68
-37
No files matched your search
@@ -118,6 +118,7 @@ TARGET= ${PROG}
|
|||||||
ALT_OBJ=
|
ALT_OBJ=
|
||||||
ALT_TARGET=
|
ALT_TARGET=
|
||||||
|
|
||||||
|
DOCS= poikola.tex
|
||||||
|
|
||||||
#################
|
#################
|
||||||
# build the entry
|
# build the entry
|
||||||
@@ -143,6 +144,10 @@ alt: data ${ALT_TARGET}
|
|||||||
data: ${DATA}
|
data: ${DATA}
|
||||||
@${TRUE}
|
@${TRUE}
|
||||||
|
|
||||||
|
docs: ${DOCS}
|
||||||
|
pdflatex ${DOCS}
|
||||||
|
|
||||||
|
|
||||||
# both all and alt
|
# both all and alt
|
||||||
#
|
#
|
||||||
everything: all alt
|
everything: all alt
|
||||||
|
|||||||
+63
-37
@@ -9,10 +9,11 @@
|
|||||||
make
|
make
|
||||||
```
|
```
|
||||||
|
|
||||||
NOTE: this entry requires `X11/Xlib.h` header file and the X11 library to
|
NOTE: some have reported that Terminal.app in macOS does not work and one might
|
||||||
compile. macOS users running Mountain Lion and later will need to download and
|
need a different terminal emulator like that from
|
||||||
install [XQuartz](https://www.xquartz.org) in order to compile and run this
|
[XQuartz](https://www.xquartz.org) but [Cody Boone
|
||||||
entry.
|
Ferguson](/winners.html#Cody_Boone_Ferguson) reported that this works fine in
|
||||||
|
macOS Ventura with Terminal.app. YMMV of course.
|
||||||
|
|
||||||
|
|
||||||
## To run:
|
## To run:
|
||||||
@@ -42,7 +43,7 @@ And those in the deep south might wish to go north for a better view.
|
|||||||
|
|
||||||
## Author's comments:
|
## Author's comments:
|
||||||
|
|
||||||
### How to build
|
### How to build:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
cc -o prog -std=gnu11 -O3 prog.c
|
cc -o prog -std=gnu11 -O3 prog.c
|
||||||
@@ -54,67 +55,91 @@ or
|
|||||||
make
|
make
|
||||||
```
|
```
|
||||||
|
|
||||||
### Poster
|
### Poster:
|
||||||
|
|
||||||
You can generate an A3 sized poster by _make docs_. This command creates a pdf file _poikola.pdf_.
|
You can generate an A3 sized poster by _make docs_. This command creates a pdf
|
||||||
|
file _poikola.pdf_.
|
||||||
|
|
||||||
### What this entry does
|
### What this entry does:
|
||||||
#### Introduction
|
|
||||||
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?"
|
|
||||||
|
|
||||||
So I had to sit down and solve those tricky questions with Nano and a C compiler.
|
#### Introduction:
|
||||||
|
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?"
|
||||||
|
|
||||||
#### Little spoilers
|
So I had to sit down and solve those tricky questions with Nano and a C
|
||||||
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
|
compiler.
|
||||||
colors of the output are as accurate as possible.
|
|
||||||
|
|
||||||
This program also tells once in a year if it is correct time to find and eat some Easter eggs.
|
#### Little spoilers:
|
||||||
|
|
||||||
|
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
|
||||||
|
the output are as accurate as possible.
|
||||||
|
|
||||||
|
This program also tells once in a year if it is correct time to find and eat
|
||||||
|
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 terminal. Color support in the terminal is not necessary, but the effect is better with it.
|
This program has been tested on xterm and Konsole and also Linux virtual
|
||||||
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 colors,
|
terminal. Color support in the terminal is not necessary, but the effect is
|
||||||
has a black background and the size is at least 125x38.
|
better with it.
|
||||||
|
|
||||||
Special note for Mac users: __Terminal__ does not work as expected you might need xterm from XQuartz or some other
|
This entry has partial support for terminals with a white background but the
|
||||||
working terminal. Thanks to [Dave Burton](/winners.html#Dave_Burton) for spotting this problem.
|
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.
|
||||||
|
|
||||||
The main reason for the header `unistd.h` is `getdelim()` but once I included it I also abused other functions and defines. This header is mutually exclusive with _-std=c11_.
|
Special note for Mac users: __Terminal__ does not work as expected you might
|
||||||
|
need xterm from XQuartz or some other working terminal. Thanks to [Dave
|
||||||
|
Burton](/winners.html#Dave_Burton) for spotting this problem.
|
||||||
|
|
||||||
The program was developed with little-endian machines; I tried to support big-endian too, but this support is somewhat limited.
|
The main reason for the header `unistd.h` is `getdelim()` but once I included it
|
||||||
|
I also abused other functions and defines. This header is mutually exclusive
|
||||||
|
with _-std=c11_.
|
||||||
|
|
||||||
|
The program was developed with little-endian machines; I tried to support
|
||||||
|
big-endian too, but this support is somewhat limited.
|
||||||
|
|
||||||
This program has been compiled in
|
This program has been compiled in
|
||||||
|
|
||||||
1. i386 (Debian Stretch) with gcc and clang
|
1. i386 (Debian Stretch) with gcc and clang
|
||||||
2. amd64 (Debian Buster) with gcc and clang
|
2. amd64 (Debian Buster) with gcc and clang
|
||||||
3. Raspberry Pi 3 (Debian stretch) with gcc and clang
|
3. Raspberry Pi 3 (Debian stretch) with gcc and clang
|
||||||
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)
|
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)
|
||||||
|
|
||||||
### 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
|
### Major spoilers:
|
||||||
<div style="margin-bottom:61em;"> </div>
|
<div style="margin-bottom:61em;"> </div>
|
||||||
|
|
||||||
I incorporated the Fletcher 16 checksum algorithm into the source for security reasons; it might be challenging to make changes without breaking the main functionality of the code.
|
I incorporated the Fletcher 16 checksum algorithm 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.
|
||||||
|
|
||||||
The computus uses an algorithm described in the journal Nature in 1876. It should be valid for Gregorian calendars.
|
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
|
||||||
|
calendars.
|
||||||
|
|
||||||
#### Some obfuscation techniques used
|
### Some obfuscation techniques used:
|
||||||
|
|
||||||
1. I tried to use meaningless or misleading variable names. For example, this program draws the Big Dipper with the correct colors, but variables
|
1. I tried to use meaningless or misleading variable names. For example, this
|
||||||
like `o`, `b`, and `a` are used in totally unrelated tasks.
|
program draws the Big Dipper with the correct colors, but variables like `o`,
|
||||||
|
`b`, and `a` are used in totally unrelated tasks.
|
||||||
2. I reused and recycled variables almost every time when possible.
|
2. I reused and recycled variables almost every time when possible.
|
||||||
3. Unnecessary use of predefined stuff like `__ATOMIC_SEQ_CST`.
|
3. Unnecessary use of predefined stuff like `__ATOMIC_SEQ_CST`.
|
||||||
4. When I was a kid, my favorite programming language was Pascal. In Pascal, there are things like `begin;` and `end;` instead of curly brackets.
|
4. When I was a kid, my favorite programming language was Pascal. In Pascal,
|
||||||
They are used also in my code, but I had to shorten them to meet size requirements.
|
there are things like `begin;` and `end;` instead of curly brackets. They are
|
||||||
5. I also have strong Perl background,
|
used also in my code, but I had to shorten them to meet size requirements.
|
||||||
and therefore I added some dollar signs to the code. One of the first ideas was to
|
5. I also have strong Perl background, and therefore I added some dollar signs
|
||||||
write all variables with prefixed `$`, but then I rejected it.
|
to the code. One of the first ideas was to write all variables with prefixed
|
||||||
|
`$`, but then I rejected it.
|
||||||
|
|
||||||
If you think you understand how this program works, can you answer these questions:
|
If you think you understand how this program works, can you answer these
|
||||||
|
questions:
|
||||||
|
|
||||||
1. What is the value of `aI_` after line 21?
|
1. What is the value of `aI_` after line 21?
|
||||||
2. Why are there some big numbers on line 47?
|
2. Why are there some big numbers on line 47?
|
||||||
@@ -124,7 +149,8 @@ If you think you understand how this program works, can you answer these questio
|
|||||||
|
|
||||||
### Rot18 part
|
### Rot18 part
|
||||||
|
|
||||||
Because the rot13 is too easy to decode with the plain eyes, I decided to use the Caesar cipher with the key 18.
|
Because the rot13 is too easy to decode with the plain eyes, I decided to use
|
||||||
|
the 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.
|
||||||
|
|||||||
Reference in new issue
Block a user