Files
ioccc/2011/toledo
Landon Curt Noll 2b92c89be8 fix and improve links within the web site
Entry source is now prog.c for IOCCC years 2014 thru 2020,
or is now dirname.c IOCCC years 1984 thru 2013.

To achieve this state, we renamed the following:

renamed:    2004/hibachi/src/hibachi.c -> 2004/hibachi/hibachi.c
renamed:    2012/omoikane/nyaruko.alt.c -> 2012/omoikane/omoikane.alt.c
renamed:    2012/omoikane/nyaruko.alt2.c -> 2012/omoikane/omoikane.alt2.c
renamed:    2012/omoikane/nyaruko.c -> 2012/omoikane/omoikane.c
renamed:    2012/omoikane/nyaruko.orig.c -> 2012/omoikane/omoikane.orig.c

Modified `bin/subst.entry-index.sh` to add to entry `index.html` file,
links to the `Makefile` and the _C code_ to the top navigation bar.
Changed `bin/subst.entry-index.sh` VERSION from "1.2.2 2024-02-25"
to "1.3 2024-03-02".

Moved printing the Inventory link in the top navigation bar
from `bin/subst.entry-navbar.awk` to `bin/subst.entry-index.sh`.
Changed `bin/subst.entry-navbar.awk` VERSION from "1.0.1 2024-02-23"
to "1.1 2024-03-02".

Moved printing the Inventory link in the top navigation bar
from `bin/subst.year-navbar.awk` to `bin/subst.year-index.sh`.
Changed `bin/subst.year-index.sh` VERSION from "1.0 2024-02-11"
to "1.1 2024-03-02".
Changed `bin/subst.year-navbar.awk` VERSION from "1.0 2024-02-11"
to "1.1 2024-03-02".

Added location names (both default and common) to `author.html`.
Changed `tmp/gen_author_json.sh` VERSION from "1.0 2023-06-06"
to "1.1 2024-03-04".

Added location names (both default and common) to `author.html`.
Changed `bin/gen-authors.sh` VERSION from "1.2 2024-03-09"
to "1.3 2024-03-04".

The manifest and the resulting `.entry.json` files have been changed
for `2004/hibachi` and `2012/omoikane`.

The Makefiles for  `2004/hibachi` and `2012/omoikane` copy the
source file into the "previously used location".  The `make clobber`
rule removes the copied source.  The `.gitignore` files have been
updated accordingly.

Improved how the concept of IOCCC terms _entry_, _author_ and _submission_ are
used in markdown files.

Links to markdown files (files ending in .md) within the repo were
changed to link to HTML files (files ending in .html).  Special cases
where `README.md` became `index.html` were modified accordingly.

Fixed URL for `bugs.html` in Makefile comments.

Fixed name of `bin/sgi.sh` referenced in comments in `.gitignore` files.

Links to locations within the repo are now relative.  For example a
link to `/contact.html` may become `../contact.html' or '../../contact.html`
depending on the directory level of the markdown file.

Nearly all links with absolute URLs under _https://www.ioccc.org_
or `https://ioccc-src.github.io/temp-test-ioccc_ have been changed to
relative paths within the repo.  Some exceptions to this (such as
referring to a GitHub repo) were preserved.

Fixed a number of inside `faq.md` and `bugs.md`.

Added HTML name tags (in the form of an _entry_id_) for each entry
referenced in `bugs.md`.  Fixed links from outside of `bugs.html`
into `bugs.html` accordingly.

Where FAQ entries are referenced, a named tag is used so that if a
FAQ is ever renumbered, links outside of `faq.html` will still work.

Changed the _inventory_order_ of a compressed tarball from _300_
to _100000_.  While this may have been done for the manifest,
this changed had not yet been propagated into the `.entry.json` files.

Links to web sites that were in the for <URL> are now [URL](URL).

Performed `name www` to process all of the above.

Improved format of `authors.html`.  Full names are now bold.
Location codes are now links back into `location.html` and
location names (both default and common) are now italics.
Added _author_handle_ each author.

Changed `bin/gen-authors.sh` VERSION from "1.1 2024-02-25"
to "1.2 2024-03-09".

Improved format of `location.html` as location codes are now bold,
author counts in a given location are now bold, and location names
(both default and common) are now italics.

Changed `bin/gen-location.sh` VERSION from "1.0.1 2024-02-23"
to "1.1 2024-03-04".

Added italic location name after location code in entry
`index.html` files.

Changed `bin/output-index-author.sh` VERSION from "1.4.1 2024-02-23"
to "1.5 2024-03-04".

Added _Location of authors_ to the sidebar as a link to `location.html`.

TODO: While nearly all of the above mentioned changes are likely correct,
      they likely introduced a few errors that need correcting.
2024-03-04 23:45:28 -08:00
..
2024-02-27 23:21:32 -08:00
2020-12-30 16:57:03 -08:00
2020-12-30 16:57:03 -08:00

To build:

If you have X11 installed:

make

There are two alternate versions, one that lets you reconfigure the controls and size and another that should work for Windows. See Alternate code below.

To use:

./toledo

Alternate code:

The first alt version, toledo.alt.c, allows you to reconfigure the controls and the dimensions more easily.

The second version, toledo.alt2.c, should work for Windows but does not allow you to reconfigure the keys or dimensions. This is because it cannot be tested by us.

Alternate build:

For the one that lets you reconfigure the keys you will want to look at the included header file, keysym.h, to find the correct macros. Once you have the right names you can define the macros FIRE, FORWARD, BACKWARD, LEFT, RIGHT, WIDTH and HEIGHT. Here are the defaults:

FIRE= XK_BackSpace:XK_Tab
FORWARD= XK_Up:XK_w
BACKWARD= XK_Down:XK_s
LEFT= XK_Left:XK_a
RIGHT= XK_Right:XK_d
WIDTH= 512
HEIGHT= 288

but you can change them about however you like, even with other keys. For instance to swap LEFT and RIGHT:

make clobber LEFT=XK_Right:XK_d RIGHT=XK_Left:XK_a alt

but you can specify something completely else and you can pick and choose which controls you wish to redefine. You might also wish to change the dimensions of the game, WIDTH and HEIGHT which have an arbitrarily selected lower limit as well as the default values.

Observe that each of the controls are a pair in the form of player2:player1 (yes, player 2 comes first!).

Judges' remarks:

This two player game uses X11. The control keys can be configured by modifying the A, B, C, D and E macros at compilation.

After a quick splash screen the objective should be clear. There are Red, Green and Cyan tanks. A larger window can be made by altering the source early on, right before the code gets hard to follow, or using the alternate version.

Like Oscar's previous winning X11 program for the 19th IOCCC, if you remove both the X11 include files and replace them with

#include "layer.c"

you ought to be able to compile and run this program on Windows. NOTE: this is what toledo.alt2.c is for.

Author's remarks:

        /=========\\
        \==\   /==/                ||
           || ||   /====\  |\/=\   ||      //==\   ==\ |=\
           || ||       ||  ||  ||  ||  //  ||       =| | |
           || ||   //===|  ||  ||  ||=//   \\=\\   ==/ |=/
           || ||   ||  ||  ||  ||  || \\      ||   User's
           \===/   \\==//  ||  ||  ||  \\  \==//   Manual

This is a color X11 3D tank-game for two players, just compile and run it without arguments.

You will see briefly a tank spinning before each level.

The Left half of the window shows the red player view and the right half shows the green player view; the background will change to blue when the view goes inactive.

The objective is to chase and destroy the other player's tank. There is also an aqua tank for testing your aim and getting extra points.

Caveat: You can shoot only 3 bullets at a time.
Trick: You can fire faster if they explode on anything.
Believe it or not, it has strategy!

When only one tank remains on the field, the level will advance. Don't forget to destroy the aqua tank.

The battleplayground is surrounded by mountains and each level is filled with random obstacles (pyramids and cubes).

The bars show players energy and score; each bar shows energy and indicates the current player view (wider on the left). The right part grows with every point.

Keys for player 1 (lowercase):

  • Tab - Fire
  • w - Go ahead
  • s - Go backwards
  • a - Turn left
  • d - Turn right

Keys for player 2:

  • Backspace - Fire
  • Up arrow - Go ahead
  • Down arrow - Go backwards
  • Left arrow - Turn left
  • Right arrow - Turn right

Note: Numeric keys don't work.

If you don't like the keys assignment, you can change it in the Makefile or use the alternate version.

PARENTAL ADVISORY WARNING:

This game is highly violent: when the tank explodes you can see the little stick man blowing in parts.

Not really, just kidding :D

PLATFORMS TESTED:

  • openSUSE 10.2 x86-32, X11R6 1024x768 32-bits color.
  • Fedora Core 8 x86-64, X11R6 1280x1024 32-bits color.
  • Fedora Core 11 x86-64, X11R6 1024x768 32-bits color.
  • Fedora Core 14 x86-64, X11R6 1024x768 32-bits color.

COMPLETE FEATURE SET:

  • Multiplayer out of the box.
  • Totally self-contained, no external files.
  • Fast-and-furious action at 29.97 frames per second.
  • Just as the movies, 16:9 aspect-ratio.
  • Beautiful mountains landscape plus horizon line :)
  • Tanks and bullets exploding as wires with weird physics.
  • Tanks back off when firing.
  • There is an infinite number of levels.
  • Always different levels.
  • Animated intro.
  • It has color!

FEATURES THAT PROGRAMMERS WILL FIND APPEALING:

  • Works both with 32 and 64-bit CPUs.
  • Double buffered, portable to any X11 with 24/32-bit color.
  • Memory-hungry as must be any 3D program; uses a 256 MB array.
  • Total and absolute irreverent coding style, so it generates a lot of warnings when compiled.
  • It can take several minutes to compile (known culprits: Fedora Core 11-14 on x86-64 512 MB).
  • It is written in the only true C: K&R, and no, that doesn't mean Katherine & Rose.
  • Vectorial scalable graphics: do you want a bigger viewport? Change variables M and N (see the alternate code).
  • Half of the program is formatted as 3D cube. View with tabs at 8 columns and a square font.
  • The other half of the program is unprintable source code, so no typing from paper, you have to write a converter of tabs and form-feeds to its C escaped forms.
  • No text, so this program can be used and understood easily in any country.
  • This program is highly ecological, it sleeps when it is not doing anything.
  • Virtual world with its own physics laws.
  • When closing the window it will show an X11 error :P

OBFUSCATION TRICKS:

  • Loop code included inside loop test.
  • Function arguments used as variables.
  • Operators used freely.
  • Pre-calculated values to save bytes.
  • Uses the +++, +- and *+ undocumented C operators :P

                                       ....,,,,---++++++--,,..\
                     .,,,.......     .$@@@@@@@@@@@@$$@@@@@@@@@@@@@@#+\
                     @@@@@###@@@@$$$@@@@$$$@@@-......-@+......,,,,,,##\
                     =++==++++++++=@@$==#$$$$$---,,,,@@@,,,,,,-------@@,..........,,.\
        ,===#$$$$$$###$####=======@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+=##$@@@@@@@@.
        +@,,++++++++=+=========++++===++++++++++-+++@@-,,,,,,,,---+++=++++--,,...   @.
        .@.                      .......,,,,-----++=@=++==@$=+--,,...               @.
         $#         S P O I L E R              .,,-#@--,,,@$.....                   @.
         .@                           ..,--+==++-,,,,.,,,,=@+++++====+++++---,,,....@.
          @+                ..,,-+++++++-,,..              @.         ....,,,,,---+@@\
          ,@       ..,--+++=+++,,..                        $#                   .==+\
           @#--++==++-,,..                                 ,@  S P O I L E R  .==+\
           ,#@@$+,,.                                        @.               ==+\
               .,,+++++,,.            S P O I L E R         $=             +=+\
                     ..,-==++-,.                            ,@           ---\
                            .,-+=+++,..                      @.       .++-\
                                  .,,++=++-,.                @+      ==+\
                                        .,-++==+-,.          +@    ==+\
                                              ..,+++=+-,..   .@. +=+\
                                                     .,-+++++,@@==

THE HISTORY OF THIS PROGRAM:

When I started working on this program, I figured that it would be easy to fit on the character limit, but I missed three things: the enormous X11 names, the non-portable key codes and my 2 KB of artwork.

Very hard coding did the first thing. In fact I worked out twenty-nine different versions and at one step I had four parallel versions with different characteristics removed (mountains, horizon lines, score/status bars and explosions) but I've managed to fit it all together!

The second thing was solved using the Makefile: it is under 160 bytes and you get adjustable controls. The greatest mystery on the Earth is why X11 gives non-portable key codes to the user.

And finally, the third "Thing" was growing and growing, and growing, eating bytes for lunch... after endless rounds of crunching I obtained three-hundred seventy-eight bytes of artwork and guess what? It doesn't fit.

So I had to integrate a decompressor based on the space, tabulators and other non-counted characters.

The final program is composed of eight micro-functions: one is the core and does most of the hard work and the other functions help do the X11 things, explosion effects, 3D calculations and viewing.

  • K() - 3D transformation
  • s() - Rendering
  • b() - Line color selection
  • G() - Explosion animation
  • g() - Moves 3D object backward and forward
  • F() - Collision detection
  • T() - Core (also known as main loop :D)
  • main() - Initialization and 'uncruncher', what a common name!; C programs should start in the cool() function :).

The source code was formatted as a cube using a specially written program. This program is smaller and obfuscated what is needed so the reformatting doesn't exceeded the character limits. The crunched vectors were generated by another special program and the tank that surrounds this text was generated by yet another program.

Have fun!

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/