Files
ioccc/2000/natori
Cody Boone Ferguson 8dffa154bc Add 2000/natori/try.sh
This script will show the current phase of White Face ('Moon' :-) ) in
artistic ways. Rather than write the different ways here I would suggest
one just try it out.
2023-11-23 01:49:40 -08:00
..
2023-11-01 00:47:43 -07:00
2023-10-16 05:32:46 -07:00
2023-10-16 05:32:46 -07:00
2023-07-06 21:49:38 -07:00
2023-11-23 01:49:40 -08:00
2023-11-23 01:49:40 -08:00

To build:

make

An alt version exists for those in the southern hemisphere (or those who want to see what it would be in the southern hemisphere). See alternate version below.

To use:

./natori

Try:

./try.sh

Also try modifying the code so that it will show another Moon phase based on input or else just by the code itself. Bonus points if you can make it show all~

Alternate code:

The author noted that those in the southern hemisphere might want to change acos(l/2) into acos(-l/2) which we have done in the alternate version.

Alternate build:

To run the alternate code that supports the southern hemisphere:

make alt

Alternate use:

./natori.alt

What happens if you run it in the northern hemisphere? Are there any differences?

Can you identify any Moon phases that result in the same output of both versions? Or are there any?

Judges' remarks:

Here is a nice compact program that changes with the phase of the Moon. Can you figure out how it does it?

The ANSI-C committee, among their multiple misdeeds, broke perfectly fun C programs by making it intractable for them to declare their own non-traditional prototype for main(). We have had to uglify this program in order to prevent C compilers from failing to compile it due to (the now changed) unusual arg types of the main() function.

Author's remarks:

This program outputs a rough image of the moon in its current phase. The main obfuscation of this entry is its complicated double recursion (without any loop or conditional statement).

People living in the southern hemisphere may want to change acos(l/2) into acos(-l/2).

This file is Copyright (c) 2023 by Landon Curt Noll. All Rights Reserved. You are free to share and adapt this file under the terms of this license:

Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)

For more information, see: https://creativecommons.org/licenses/by-sa/4.0/