From 03ba78f2d177956b76a245e03b4a1f026a6f6d93 Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Tue, 12 Dec 2023 04:56:15 -0800 Subject: [PATCH 1/2] Add 2018/poikola/try.sh + format/typo checks I believe this completes the review of the entry. --- 2018/poikola/README.md | 63 ++++++++++++++++++++++++++++++------------ 2018/poikola/try.sh | 25 +++++++++++++++++ thanks-for-help.md | 10 ++++++- 3 files changed, 80 insertions(+), 18 deletions(-) create mode 100755 2018/poikola/try.sh diff --git a/2018/poikola/README.md b/2018/poikola/README.md index 07e3d0bdf..7f0f1e685 100644 --- a/2018/poikola/README.md +++ b/2018/poikola/README.md @@ -14,10 +14,11 @@ make ### 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 -./prog +./try.sh ``` @@ -54,16 +55,17 @@ make You can generate an A3 sized poster by _make docs_. This command creates a 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 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. -#### Little spoilers: + +### 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 @@ -74,7 +76,9 @@ some Easter eggs. 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. @@ -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 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 -need xterm from XQuartz or some other working terminal. Thanks to [Dave -Burton](/winners.html#Dave_Burton) for spotting this problem. +Special note for Mac users: `Terminal.app` does not work as expected; you might +need xterm from XQuartz (see [FAQ 3.7: How do I compile and use on macOS, an +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 -I also abused other functions and defines. This header is mutually exclusive +The main reason for the header `unistd.h` is `getdelim(3)` but once I included it +I also abused other functions and `#define`s. This header is mutually exclusive with _-std=c11_. 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 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: + Please do not feed little babies chocolate. -### Major spoilers: -
 
-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. +### Major spoilers: + +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. @@ -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 calendars. + ### Some obfuscation techniques used: 1. I tried to use meaningless or misleading variable names. For example, this @@ -144,11 +161,23 @@ questions: ### 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. +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 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: diff --git a/2018/poikola/try.sh b/2018/poikola/try.sh new file mode 100755 index 000000000..734a07eba --- /dev/null +++ b/2018/poikola/try.sh @@ -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 diff --git a/thanks-for-help.md b/thanks-for-help.md index bd5d4dfca..0c4ffcacd 100644 --- a/thanks-for-help.md +++ b/thanks-for-help.md @@ -4037,7 +4037,15 @@ supposed to segfault :-) ## [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). ## [2019/karns](/2019/karns/prog.c) ([README.md](/2019/karns/README.md])) From 359354cde8c35fdd9a475182986b7a634498ea3c Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Tue, 12 Dec 2023 05:09:50 -0800 Subject: [PATCH 2/2] Simplify how to redefine macros in 2014/birken Now one can do make clobber PORT=31337 TIME=50000 alt or whatever. --- 2014/birken/Makefile | 8 ++++++++ 2014/birken/README.md | 6 +++--- thanks-for-help.md | 3 ++- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/2014/birken/Makefile b/2014/birken/Makefile index 35e4a8375..13e5b7768 100644 --- a/2014/birken/Makefile +++ b/2014/birken/Makefile @@ -139,6 +139,14 @@ ${PROG}: ${PROG}.c alt: data ${ALT_TARGET} @${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: ${DATA} diff --git a/2014/birken/README.md b/2014/birken/README.md index c168af240..92073487a 100644 --- a/2014/birken/README.md +++ b/2014/birken/README.md @@ -56,13 +56,13 @@ described by the author. See [configuration](#configuration) below. To specify the port to say, 31337, try: ```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 -make clobber CDEFINE="-DSTARDATE=5000000" alt +make clobber TIME=5000000 alt ``` You can combine them both of course. diff --git a/thanks-for-help.md b/thanks-for-help.md index 0c4ffcacd..b0b464957 100644 --- a/thanks-for-help.md +++ b/thanks-for-help.md @@ -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 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 -details). +details on this macro). The Makefile was made to use variables so it's easier to +redefine the port and timing constant. ## [2014/deak](/2014/deak/prog.c) ([README.md](/2014/deak/README.md))