Files
ioccc/2013/morgan1
Landon Curt Noll f29b37e49a improve HTML menus, add social.html, prep for IOCCC28 winners
Prepare for the winners of **IOCCC28**.

> However these are not the 2024 droids you are looking for.  :-)

The HTML menu (both JavaScript and non-JavaScript) has been updated.

The `Status -> Rules and guidelines' have been replaced with two
separate menus `Status -> IOCCC rules` and `Status -> IOCCC guidelines`.

Added a new top level `social.html` page: built from a new `social.md`.

Sorted rules for building specific web pages in the top level `Makefile`.
Added `make social` to make the `social.html` page from `social.md`.

The `bin/gen-top-html.sh` now is able to process a argument of **social**
to process the new top level `social.html` page.

Changed `bin/gen-top-html.sh` VERSION from "2.0.0 2025-03-13"
to "2.0.1 2025-07-25".

Below `About -> Home page` a new `About -> IOCCC social media` menu item
as added.

Because the menu change touched every HTML file, we changed the general
copyright date range for HTML files from "1984-2024" to "1984-2025"
due to the extensive changes made for **IOCCC28**.

Those markdown files that were modified in 2025 had their copyright date
range also changed from "1984-2024" to "1984-2025".

Rebuilt tarballs and sitemap due to the extensive HTML rebuilding.

Ran `make update` to perform the above.
2025-07-26 13:06:29 -07:00
..
2020-12-30 16:57:03 -08:00
2023-07-06 21:49:38 -07:00

To build:

    make

NOTE: this entry requires the X11/Xlib.h header file and the X11 library to compile. For more information see the FAQ on "X11".

To use:

    echo "YYYY/MM/DD" | ./morgan1

where YYYY is the four digit year, MM is the two digit month and DD is two digit day of the month. The arrow keys control the shifting of the date as follows:

  • Right : go forwards one day.
  • Left : go backwards one day.
  • Up : go forwards 20 days.
  • Down : go backwards 20 days.

Try:

    ./try.sh

Use the same keys as described above to change the dates each time the program window is in focus.

Judges' remarks:

To verify the output, try echoing the date of an evening with a clear sky. Use binoculars and/or telescope as needed. In some cases you may need to wait for a better time of the evening. In a few cases, such as the South Pole in the summer, you may need to move to a different observing site.

Author's remarks:

Instructions

It displays the position of the 8 planets of the solar system around the Sun. The date given in the command line is in the format YYYY/MM/DD (year, month and day). The direction keys can be used to move in time :

  • Left : go back 1 day.
  • Right : go forward 1 day.
  • Down : go back 20 days.
  • Up : go forward 20 days.

It handles correctly all leap years and the switch between Julian calendar and Gregorian calendar (10 days missing between 1582/10/04 and 1582/10/15).

The scale is logarithmic to be able to display the 8 planets without having Mercury, Venus, Earth and Mars squeezed around the Sun.

The size is not proportional either.

Bonus

It also displays the position of 2 famous comets during their last approach:

Limitations

  • ASCII character set is assumed.
  • A C99 compiler is required (for some math.h functions).
  • The position should be correct for years between (-1000; +3000)
  • The approximations done in the formula are OK for displaying the position around the Sun but not for other applications like ephemeride or sky view from Earth (angles may be off by 1 or 2 degrees sometimes).

Obfuscation

  • Reuse of 1 letter variables.
  • Only the main() function with some for loops.
  • Constants for orbital elements encoded in a string.
  • Hexadecimal and decimal values used inconsistently.
  • Comparisons order are not consistent.
  • A lot of stuff is done in the different parts of the for loop.

Compilation warnings

With gcc 4.7.2 on Linux Ubuntu 12.10:

    morgan1.c:38:3: warning: suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses]
    morgan1.c:40:34: warning: value computed is not used [-Wunused-value]
    morgan1.c:56:6: warning: suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses]
    morgan1.c:58:50: warning: value computed is not used [-Wunused-value]
    morgan1.c:61:5: warning: suggest parentheses around ‘-’ inside ‘>>’ [-Wparentheses]

With clang 3.1 on Linux Ubuntu 12.10 :

    morgan1.c:38:49: warning: '&&' within '||' [-Wlogical-op-parentheses]
    morgan1.c:38:27: warning: '&&' within '||' [-Wlogical-op-parentheses]
    morgan1.c:55:13: warning: '&&' within '||' [-Wlogical-op-parentheses]
    morgan1.c:56:14: warning: '&&' within '||' [-Wlogical-op-parentheses]

This is due to most of the parentheses and braces being removed when unnecessary.

To verify the display, you can look at one of these programs :