Add preview of 1984-2019
The 2020 winners are hinted it, but the source code is not there,
nor are the hints. Someone could look into the HTML and
see what was commented out, but that is not a problem because
WHO won is known and the name of their AWARD is known already.
Moreover a number of the winners have talked about what their
entirs do, so the commented out spoiler text is not a bit problem.
One will find HTML commented out with:
<!-- XXX remove when 2020 is ready
2020 links here
XXX remove when 2020 is ready -->
The "XXX remove when 2020 is ready" string is found at the
start and end comment blocks. Again, soneone could read
what was commented out, but that is OK since most of that
information is known or can be known. The following files
have such HTML comment blocks in them.
./winners.html
./years-spoiler.html
./years.html
In addition, ./all/summary.txt was modified to not
include the 2020 entries for the momemt.
The 2020 winner code AND write-ups are NOT part of this set.
p.s. The all/all.tar.bz2 does not contain the 2020 source code (yet?).
This commit is contained in:
1 parent
28efc67f5d
commit
c0663537cb
1683 files changed
+220064
No files matched your search
@@ -0,0 +1,125 @@
|
||||
#!/usr/bin/env make
|
||||
#
|
||||
# 2011 makefile
|
||||
#
|
||||
# Copyright (C) 2011, Landon Curt Noll, Simon Cooper, and Leonid A. Broukhis.
|
||||
#
|
||||
# Creative Commons Attribution-ShareAlike 3.0 Unported License.
|
||||
# See: http://creativecommons.org/licenses/by-sa/3.0/
|
||||
|
||||
|
||||
################
|
||||
# tool locations
|
||||
################
|
||||
#
|
||||
SHELL= /bin/bash
|
||||
CP= cp
|
||||
CPP= cpp
|
||||
GUNZIP= gunzip
|
||||
LD= ld
|
||||
MAKE= make
|
||||
RM= rm
|
||||
SED= sed
|
||||
TAR= tar
|
||||
TRUE= true
|
||||
|
||||
# Set X11_LIBDIR to the directory where the X11 library resides
|
||||
#
|
||||
X11_LIBDIR= /usr/X11R6/lib
|
||||
|
||||
# Set X11_INCLUDEDIR to the directory where the X11 include files reside
|
||||
#
|
||||
X11_INCDIR= /usr/X11R6/include
|
||||
|
||||
# optimization
|
||||
#
|
||||
# Most compiles will safely use -O2. Some can use only -O1 or -O.
|
||||
# A few compilers have broken optimizers or this entry make break
|
||||
# under those buggy optimizers and thus you may not want anything.
|
||||
#
|
||||
OPT= -O2
|
||||
|
||||
# bitness
|
||||
#
|
||||
# Some entries require 32-bitness,
|
||||
# other entries require 64-bitess.
|
||||
# By default we assume nothing.
|
||||
#
|
||||
ARCH=
|
||||
|
||||
# default flags for ANSI C compilation
|
||||
#
|
||||
CFLAGS= -Wall -W -ansi ${ARCH} ${OPT} -I${X11_INCDIR} -L${X11_LIBDIR} -lX11 -lm -DA=XK_Up:XK_w -DB=XK_Left:XK_a -DC=XK_Right:XK_d -DD=XK_Down:XK_s -DE=XK_BackSpace:XK_Tab "-DQ=XFillRectangle(W,X,Y,"
|
||||
|
||||
# ANSI compiler
|
||||
#
|
||||
# Set CC to the name of your ANSI compiler.
|
||||
#
|
||||
CC= cc
|
||||
|
||||
|
||||
##############################
|
||||
# Special flags for this entry
|
||||
##############################
|
||||
#
|
||||
ENTRY= toledo
|
||||
DATA=
|
||||
|
||||
|
||||
#################
|
||||
# build the entry
|
||||
#################
|
||||
#
|
||||
all: ${ENTRY} ${DATA}
|
||||
@${TRUE}
|
||||
|
||||
${ENTRY}: ${ENTRY}.c
|
||||
${CC} ${CFLAGS} ${ENTRY}.c -o ${ENTRY}
|
||||
|
||||
# alternative executable
|
||||
#
|
||||
alt:
|
||||
@${TRUE}
|
||||
|
||||
|
||||
###############
|
||||
# utility rules
|
||||
###############
|
||||
#
|
||||
everything: all alt
|
||||
|
||||
clean:
|
||||
${RM} -f ${ENTRY}.o
|
||||
|
||||
clobber: clean
|
||||
${RM} -f ${ENTRY}
|
||||
|
||||
nuke: clobber
|
||||
@echo gnab gib!
|
||||
|
||||
install:
|
||||
@echo "Surely you're joking Mr. Feynman!"
|
||||
|
||||
# backwards compatibility
|
||||
#
|
||||
build: all
|
||||
|
||||
|
||||
##################
|
||||
# 133t hacker rulz
|
||||
##################
|
||||
#
|
||||
love:
|
||||
@echo 'not war?'
|
||||
|
||||
haste:
|
||||
$(MAKE) waste
|
||||
|
||||
waste:
|
||||
@echo 'waste'
|
||||
|
||||
easter_egg:
|
||||
@echo you expected to mis-understand this $${RANDOM} magic
|
||||
@echo chongo '<was here>' "/\\oo/\\"
|
||||
@echo Readers shall not be disallowed from being unable to partly misunderstand this final echo.
|
||||
@${TRUE}
|
||||
@@ -0,0 +1,291 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta name="GENERATOR" content="mkd2html 2.1.3 DL=DISCOUNT">
|
||||
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">
|
||||
<link rel="stylesheet"
|
||||
type="text/css"
|
||||
href="../hint.css">
|
||||
<title>Best non-chess game</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Best non-chess game</h1>
|
||||
|
||||
<p>Oscar Toledo G.<br>
|
||||
Av. Sta. Cruz del Monte 9-304<br>
|
||||
Cd. Satelite. Edo. de Mexico.<br>
|
||||
CP. 53110. Mexico.<br>
|
||||
<a href="mailto:biyubi@gmail.com">biyubi@gmail.com</a><br>
|
||||
<a href="http://nanochess.110mb.com/">http://nanochess.110mb.com/</a></p>
|
||||
|
||||
<h2>Judges' comments:</h2>
|
||||
|
||||
<h3>To build:</h3>
|
||||
|
||||
<pre><code>make toledo
|
||||
</code></pre>
|
||||
|
||||
<h3>To run:</h3>
|
||||
|
||||
<pre><code>./toledo
|
||||
|
||||
# NOTE: This requires X11 to run or modifications to use layer.c on
|
||||
# Windows
|
||||
</code></pre>
|
||||
|
||||
<h3>Try:</h3>
|
||||
|
||||
<pre><code>./toledo
|
||||
</code></pre>
|
||||
|
||||
<h3>Selected Judges Remarks:</h3>
|
||||
|
||||
<p>This two player game uses X11. The control keys can be configured by
|
||||
modifying the A,B,C and D macros at compilation.</p>
|
||||
|
||||
<p>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.</p>
|
||||
|
||||
<p>Like Oscar’s previous winning X11 program for the 19th IOCCC, if
|
||||
you remove both the X11 include files and replace them with</p>
|
||||
|
||||
<pre><code>#include "layer.c"
|
||||
</code></pre>
|
||||
|
||||
<p>you ought to be able to compile and run this program on Windows.</p>
|
||||
|
||||
<h2>Author’s comments:</h2>
|
||||
|
||||
<pre><code> /=========\
|
||||
\==\ /==/ ||
|
||||
|| || /====\ |\/=\ || //==\ ==\ |=\
|
||||
|| || || || || || // || =| | |
|
||||
|| || //===| || || ||=// \\=\\ ==/ |=/
|
||||
|| || || || || || || \\ || User's
|
||||
\===/ \\==// || || || \\ \==// Manual
|
||||
</code></pre>
|
||||
|
||||
<p>This is a color X11 3D tank-game for two players, just compile
|
||||
and run it without arguments.</p>
|
||||
|
||||
<p>You will see briefly a tank spinning before each level.</p>
|
||||
|
||||
<p>Left half of the window shows the red player view and right
|
||||
half shows the green player view, the background will change to
|
||||
blue when the view goes inactive.</p>
|
||||
|
||||
<p>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.</p>
|
||||
|
||||
<blockquote><p>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!</p></blockquote>
|
||||
|
||||
<p>When only one tank remains on the field, the level will advance.
|
||||
Don’t forget to destroy the aqua tank.</p>
|
||||
|
||||
<p>The playground is surrounded by mountains and each level is
|
||||
filled with random obstacles (pyramids and cubes).</p>
|
||||
|
||||
<p>The bars show players energy and score, each bar shows energy
|
||||
and indicates current player view (wider on the left), right
|
||||
part grows with every point.</p>
|
||||
|
||||
<p>Keys for player 1 (lowercase):</p>
|
||||
|
||||
<ul>
|
||||
<li>Tab - Fire</li>
|
||||
<li>w - Go ahead</li>
|
||||
<li>s - Go backwards</li>
|
||||
<li>a - Turn left</li>
|
||||
<li>d - Turn right</li>
|
||||
</ul>
|
||||
|
||||
|
||||
<p>Keys for player 2:</p>
|
||||
|
||||
<ul>
|
||||
<li>Backspace - Fire</li>
|
||||
<li>Up arrow - Go ahead</li>
|
||||
<li>Down arrow - Go backwards</li>
|
||||
<li>Left arrow - Turn left</li>
|
||||
<li>Right arrow - Turn right</li>
|
||||
</ul>
|
||||
|
||||
|
||||
<blockquote><p>Note: Numeric keys don’t work.</p></blockquote>
|
||||
|
||||
<p>If you don’t like the keys assignment, you can change it on the
|
||||
the makefile.</p>
|
||||
|
||||
<h2>PARENTAL ADVISORY WARNING:</h2>
|
||||
|
||||
<p>This game is highly violent, when the tank explodes you can
|
||||
see the little stick man blowing in parts.</p>
|
||||
|
||||
<p>Not really, just kidding :D</p>
|
||||
|
||||
<h2>PLATFORMS TESTED:</h2>
|
||||
|
||||
<ul>
|
||||
<li>openSuSE 10.2 x86-32, X11R6 1024x768 32-bits color.</li>
|
||||
<li>Fedora Core 8 x86-64, X11R6 1280x1024 32-bits color.</li>
|
||||
<li>Fedora Core 11 x86-64, X11R6 1024x768 32-bits color.</li>
|
||||
<li>Fedora Core 14 x86-64, X11R6 1024x768 32-bits color.</li>
|
||||
</ul>
|
||||
|
||||
|
||||
<h2>COMPLETE FEATURE SET:</h2>
|
||||
|
||||
<ul>
|
||||
<li>Multiplayer out of the box.</li>
|
||||
<li>Totally self-contained, no external files.</li>
|
||||
<li>Fast-furious action at 29.97 frames per second.</li>
|
||||
<li>Just as the movies, 16:9 aspect-ratio.</li>
|
||||
<li>Beautiful mountains landscape plus horizon line :)</li>
|
||||
<li>Tanks and bullets exploding as wires with weird physics.</li>
|
||||
<li>Tanks backoff when firing.</li>
|
||||
<li>There is an infinite number of levels.</li>
|
||||
<li>Always different levels.</li>
|
||||
<li>Animated intro.</li>
|
||||
<li>It has color!.</li>
|
||||
</ul>
|
||||
|
||||
|
||||
<h2>FEATURES THAT PROGRAMMERS WILL FIND APPEALING:</h2>
|
||||
|
||||
<ul>
|
||||
<li>Works both with x86-32 and x86-64 processors.</li>
|
||||
<li>Double buffered, portable to any X11 with 24/32-bit color.</li>
|
||||
<li>Memory-hungry as must be any 3-D program, uses a 256 MB
|
||||
array.</li>
|
||||
<li>Total and absolute irreverent coding style, so it generates
|
||||
a lot of warnings when compiled.</li>
|
||||
<li>It can take several minutes to compile (known culprits:
|
||||
Fedora Core 11-14 on x86-64 512 MB)</li>
|
||||
<li>It is written in the only true C: K&R, and no, it not means
|
||||
Katherine & Rose.</li>
|
||||
<li>Vectorial scalable graphics, do you want a bigger
|
||||
playfield? change variables M & N.</li>
|
||||
<li>Half of the program is formatted as 3-D cube, view with
|
||||
Tabs at 8 columns and a square font.</li>
|
||||
<li>The other half of the program is unprintable source code,
|
||||
so no typing from paper, you have to write a converter of
|
||||
tabs and formfeeds to its C escaped forms.</li>
|
||||
<li>No text, so this program can be used and understood easily
|
||||
on any country.</li>
|
||||
<li>This program is highly ecologic, it sleeps when it is not
|
||||
doing anything.</li>
|
||||
<li>Virtual world with its own physics laws.</li>
|
||||
<li>When closing the window it will show an X11 error :P</li>
|
||||
</ul>
|
||||
|
||||
|
||||
<h2>OBFUSCATION TRICKS:</h2>
|
||||
|
||||
<ul>
|
||||
<li>Loop code included inside loop test.</li>
|
||||
<li>Function arguments used as variables.</li>
|
||||
<li>Operators used freely.</li>
|
||||
<li>Precalculated values to save bytes.</li>
|
||||
<li><p>Uses the +++, +- and *+ undocumented C operators :P</p>
|
||||
|
||||
<pre><code> ....,,,,---++++++--,,..
|
||||
.,,,....... .$@@@@@@@@@@@@$$@@@@@@@@@@@@@@#+
|
||||
@@@@@###@@@@$$$@@@@$$$@@@-......-@+......,,,,,,##
|
||||
=++==++++++++=@@$==#$$$$$---,,,,@@@,,,,,,-------@@,..........,,.
|
||||
,===#$$$$$$###$####=======@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+=##$@@@@@@@@.
|
||||
+@,,++++++++=+=========++++===++++++++++-+++@@-,,,,,,,,---+++=++++--,,... @.
|
||||
.@. .......,,,,-----++=@=++==@$=+--,,... @.
|
||||
$# S P O I L E R .,,-#@--,,,@$..... @.
|
||||
.@ ..,--+==++-,,,,.,,,,=@+++++====+++++---,,,....@.
|
||||
@+ ..,,-+++++++-,,.. @. ....,,,,,---+@@
|
||||
,@ ..,--+++=+++,,.. $# .==+
|
||||
@#--++==++-,,.. ,@ S P O I L E R .==+
|
||||
,#@@$+,,. @. ==+
|
||||
.,,+++++,,. S P O I L E R $= +=+
|
||||
..,-==++-,. ,@ ---
|
||||
.,-+=+++,.. @. .++-
|
||||
.,,++=++-,. @+ ==+
|
||||
.,-++==+-,. +@ ==+
|
||||
..,+++=+-,.. .@. +=+
|
||||
.,-+++++,@@==
|
||||
</code></pre></li>
|
||||
</ul>
|
||||
|
||||
|
||||
<h1>THE HISTORY OF THIS PROGRAM:</h1>
|
||||
|
||||
<p>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 unportable keycodes and my
|
||||
2 KB of artwork.</p>
|
||||
|
||||
<p>Very hard coding did the first thing, in fact I worked out
|
||||
twenty-nine different versions, at one step I had four
|
||||
parallel versions with different characteristics removed
|
||||
(mountains, horizon line, score/status bars and explosions),
|
||||
I’ve managed to fit it all together!.</p>
|
||||
|
||||
<p>The second thing was solved using the makefile, it is under
|
||||
160 bytes and you get adjustable keyboard. The greatest
|
||||
mistery on the earth is why X11 handles unportable keycodes to
|
||||
the user.</p>
|
||||
|
||||
<p>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 fitted.</p>
|
||||
|
||||
<p>So I had to integrate a decompressor, based on the space,
|
||||
tabulators and other non-counted characters.</p>
|
||||
|
||||
<p>The final program is composed of eight microfunctions, one is
|
||||
the core and does most of the hard work, other functions help
|
||||
doing the X11 things, explosion effects, 3-D calculations and
|
||||
viewing.</p>
|
||||
|
||||
<ul>
|
||||
<li>K() - 3-D transformation</li>
|
||||
<li>s() - Rendering</li>
|
||||
<li>b() - Line color selection</li>
|
||||
<li>G() - Explosion animation</li>
|
||||
<li>g() - Moves 3-D object backward and forward</li>
|
||||
<li>F() - Collision detection</li>
|
||||
<li>T() - Core (also known as main loop :D)</li>
|
||||
<li>main() - Initialization and uncruncher, what a common name!,
|
||||
C programs should start in the cool() function :).</li>
|
||||
</ul>
|
||||
|
||||
|
||||
<p>The source code was formatted as an cube using a specially
|
||||
written program, the reality is that the program is smaller and
|
||||
obfuscated of 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.</p>
|
||||
|
||||
<p><em>Have fun!</em></p>
|
||||
|
||||
<hr />
|
||||
|
||||
<!--
|
||||
(c) Copyright 1984-2012, [Leo Broukhis, Simon Cooper, Landon Curt Noll][judges] - All rights reserved
|
||||
This work is licensed under a [Creative Commons Attribution-ShareAlike 3.0 Unported License][cc].
|
||||
|
||||
[judges]: http://www.ioccc.org/judges.html
|
||||
[cc]: http://creativecommons.org/licenses/by-sa/3.0/
|
||||
-->
|
||||
|
||||
<TABLE><TR>
|
||||
<TD><a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/"><img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/88x31.png" /></a></TD>
|
||||
<TD><P>© Copyright 1984-2012,
|
||||
<A HREF="/judges.html">Leo Broukhis, Simon Cooper, Landon Curt Noll</A>
|
||||
- All rights reserved<BR>
|
||||
This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/">Creative Commons Attribution-ShareAlike 3.0 Unported License</a>.</P></TD>
|
||||
<TD> <!--<a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01 Transitional" height="31" width="88"></a>--></TD>
|
||||
</TR></TABLE>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,248 @@
|
||||
# Best non-chess game
|
||||
|
||||
Oscar Toledo G.
|
||||
Av. Sta. Cruz del Monte 9-304
|
||||
Cd. Satelite. Edo. de Mexico.
|
||||
CP. 53110. Mexico.
|
||||
<biyubi@gmail.com>
|
||||
<http://nanochess.110mb.com/>
|
||||
|
||||
|
||||
## Judges' comments:
|
||||
### To build:
|
||||
|
||||
make toledo
|
||||
|
||||
### To run:
|
||||
|
||||
./toledo
|
||||
|
||||
# NOTE: This requires X11 to run or modifications to use layer.c on
|
||||
# Windows
|
||||
|
||||
### Try:
|
||||
|
||||
./toledo
|
||||
|
||||
### Selected Judges Remarks:
|
||||
|
||||
This two player game uses X11. The control keys can be configured by
|
||||
modifying the A,B,C and D 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.
|
||||
|
||||
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.
|
||||
|
||||
## Author's comments:
|
||||
/=========\
|
||||
\==\ /==/ ||
|
||||
|| || /====\ |\/=\ || //==\ ==\ |=\
|
||||
|| || || || || || // || =| | |
|
||||
|| || //===| || || ||=// \\=\\ ==/ |=/
|
||||
|| || || || || || || \\ || 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.
|
||||
|
||||
Left half of the window shows the red player view and 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 playground 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 current player view (wider on the left), 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 on the
|
||||
the makefile.
|
||||
|
||||
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-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 backoff 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 x86-32 and x86-64 processors.
|
||||
* Double buffered, portable to any X11 with 24/32-bit color.
|
||||
* Memory-hungry as must be any 3-D 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, it not means
|
||||
Katherine & Rose.
|
||||
* Vectorial scalable graphics, do you want a bigger
|
||||
playfield? change variables M & N.
|
||||
* Half of the program is formatted as 3-D 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 formfeeds to its C escaped forms.
|
||||
* No text, so this program can be used and understood easily
|
||||
on any country.
|
||||
* This program is highly ecologic, 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.
|
||||
* Precalculated 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 unportable keycodes and my
|
||||
2 KB of artwork.
|
||||
|
||||
Very hard coding did the first thing, in fact I worked out
|
||||
twenty-nine different versions, at one step I had four
|
||||
parallel versions with different characteristics removed
|
||||
(mountains, horizon line, score/status bars and explosions),
|
||||
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 keyboard. The greatest
|
||||
mistery on the earth is why X11 handles unportable keycodes 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 fitted.
|
||||
|
||||
So I had to integrate a decompressor, based on the space,
|
||||
tabulators and other non-counted characters.
|
||||
|
||||
The final program is composed of eight microfunctions, one is
|
||||
the core and does most of the hard work, other functions help
|
||||
doing the X11 things, explosion effects, 3-D calculations and
|
||||
viewing.
|
||||
|
||||
* K() - 3-D transformation
|
||||
* s() - Rendering
|
||||
* b() - Line color selection
|
||||
* G() - Explosion animation
|
||||
* g() - Moves 3-D 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 an cube using a specially
|
||||
written program, the reality is that the program is smaller and
|
||||
obfuscated of 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!*
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
<!--
|
||||
(c) Copyright 1984-2012, [Leo Broukhis, Simon Cooper, Landon Curt Noll][judges] - All rights reserved
|
||||
This work is licensed under a [Creative Commons Attribution-ShareAlike 3.0 Unported License][cc].
|
||||
|
||||
[judges]: http://www.ioccc.org/judges.html
|
||||
[cc]: http://creativecommons.org/licenses/by-sa/3.0/
|
||||
-->
|
||||
@@ -0,0 +1,130 @@
|
||||
/*
|
||||
** Translation layer to make my 3D Tanks game (20th IOCCC, best non-chess game)
|
||||
** to work in Windows
|
||||
**
|
||||
** by Oscar Toledo G.
|
||||
** http://nanochess.110mb.com/
|
||||
**
|
||||
** From the original game replace:
|
||||
** #include <X11/Xlib.h>
|
||||
** #include <X11/keysym.h>
|
||||
**
|
||||
** with this:
|
||||
** #include "layer.c"
|
||||
**
|
||||
** Only tested with Dev-C++ 4.9.9.2
|
||||
**
|
||||
** Creation: Feb/10/2012.
|
||||
*/
|
||||
|
||||
#include <windows.h> /* Windows headers */
|
||||
|
||||
extern int L[]; /* Keyboard table from game */
|
||||
|
||||
/*
|
||||
** Original makefile translated
|
||||
** Choose your keys if you like
|
||||
*/
|
||||
#define A VK_UP:0x57
|
||||
#define B VK_LEFT:0x41
|
||||
#define C VK_RIGHT:0x44
|
||||
#define D VK_DOWN:0x53
|
||||
#define E VK_BACK:VK_TAB
|
||||
#define Q XFillRectangle(W,X,Y,
|
||||
|
||||
/*
|
||||
** Some X11 definitions translated
|
||||
*/
|
||||
#define main ma
|
||||
#define Display int
|
||||
#define GC HDC
|
||||
#define Pixmap HBITMAP
|
||||
#define Window HWND
|
||||
typedef struct{ int foreground; int line_width; } XGCValues;
|
||||
typedef struct{ int type,X; } XEvent;
|
||||
|
||||
/* XNextEvent, read Windows messages */
|
||||
#define XNextEvent(a,b)(GetMessage(&mm,0,0,0),TranslateMessage(&mm),\
|
||||
DispatchMessage(&mm),*b=oo,oo.type=0)
|
||||
/* XOpenDisplay, not needed */
|
||||
#define XOpenDisplay(a)NULL
|
||||
/* XSelectInput, only needs to process second argument */
|
||||
#define XSelectInput(a,b,c)b
|
||||
/* XCreateSimpleWindow */
|
||||
#define XCreateSimpleWindow(a,b,c,d,e,f,g,h,i)CreateWindowEx(0,"a","3D Tanks",\
|
||||
0xcf0000,c,d,e+8,f+32,0,0,aa,0)
|
||||
/* XMapWindow, activate window and get DC to draw */
|
||||
#define XMapWindow(a,b)(ShowWindow(b,dd),h1=GetDC(b),h3=CreateCompatibleDC(h1))
|
||||
/* XPending, check for pending windows messages */
|
||||
#define XPending(a)PeekMessage(&mm,O,0,0,PM_NOREMOVE)
|
||||
/* XFlush, not needed */
|
||||
#define XFlush(a)
|
||||
/* XLookupKeysym, argument processing and returns key index */
|
||||
#define XLookupKeysym(a,b)(b,(a)->X)
|
||||
/* DefaultDepth, not needed */
|
||||
#define DefaultDepth(a,b)0
|
||||
/* XCreatePixmap, creates a double-buffer bitmap */
|
||||
#define XCreatePixmap(a,b,c,d,e)CreateCompatibleBitmap(h1,c,d)
|
||||
/* XCreateGC, instead selects bitmap for drawing */
|
||||
#define XCreateGC(a,b,c,d)(SelectObject(h3,b),h3)
|
||||
/* XChangeGC, selection of color and line width, all this is required */
|
||||
#define XChangeGC(a,b,c,d)(rr!=INVALID_HANDLE_VALUE?DeleteObject(rr):0,\
|
||||
(d)->foreground=((d)->foreground&0xff0000)>>16|((d)->foreground&0xff)<<16|\
|
||||
(d)->foreground&0xff00,\
|
||||
rr=CreateSolidBrush((d)->foreground),\
|
||||
e2=CreatePen(PS_SOLID,(d)->line_width,(d)->foreground),\
|
||||
SelectObject(b,e2),\
|
||||
e1!=INVALID_HANDLE_VALUE?DeleteObject(e1):0,e1=e2)
|
||||
/* XCopyArea, copies double buffer into main for non-flickering display */
|
||||
#define XCopyArea(a,b,c,d,e,f,g,h,i,j)BitBlt(h1,i,j,g,h,h3,0,0,SRCCOPY)
|
||||
/* Some windows variables required */
|
||||
HBITMAP bb;
|
||||
HBRUSH rr = INVALID_HANDLE_VALUE;
|
||||
HPEN e1 = INVALID_HANDLE_VALUE, e2;
|
||||
PAINTSTRUCT pp;
|
||||
HDC h1, h2, h3;
|
||||
XEvent oo;
|
||||
HINSTANCE aa;
|
||||
int dd;
|
||||
MSG mm;
|
||||
/* Main message processing */
|
||||
LRESULT CALLBACK WP(HWND h,UINT m,WPARAM w,LPARAM l)
|
||||
{
|
||||
if (m==WM_KEYDOWN&&L[w]==0)oo.type=2,oo.X=w;
|
||||
else if (m==WM_KEYUP&&L[w]==1)oo.type=3,oo.X=w;
|
||||
else if (m==WM_PAINT)BeginPaint(h,&pp),EndPaint(h,&pp);
|
||||
else if (m==15)oo.type=12;
|
||||
else if (m==2)exit(1);/*PostQuitMessage(0);*/
|
||||
else return DefWindowProc(h, m, w, l);
|
||||
return 0;
|
||||
}
|
||||
/* Main function */
|
||||
int WINAPI WinMain(HINSTANCE a,HINSTANCE b,LPSTR c,int d)
|
||||
{
|
||||
static WNDCLASSEX w;
|
||||
return aa=a,w.hInstance=a,w.lpszClassName="a",
|
||||
w.lpfnWndProc=WP,w.cbSize=sizeof(WNDCLASSEX),dd=d,
|
||||
w.hIcon=LoadIcon(0,IDI_APPLICATION),
|
||||
w.hIconSm=LoadIcon(0,IDI_APPLICATION),
|
||||
w.hCursor=LoadCursor(0,IDC_ARROW),
|
||||
w.hbrBackground=GetStockObject(BLACK_BRUSH),
|
||||
RegisterClassEx(&w),
|
||||
main();
|
||||
}
|
||||
/* XFillRectangle, note that X uses size and Windows uses coordinates */
|
||||
void XFillRectangle(int *a, HBITMAP b, HDC c, int d, int e, int f, int g)
|
||||
{
|
||||
RECT rect;
|
||||
|
||||
rect.left = d;
|
||||
rect.top = e;
|
||||
rect.right = f + d;
|
||||
rect.bottom = g + e;
|
||||
FillRect(c, &rect, rr);
|
||||
}
|
||||
/* XDrawLine */
|
||||
void XDrawLine(int *a, HBITMAP b, HDC c, int d, int e, int f, int g)
|
||||
{
|
||||
MoveToEx(c, d, e, NULL);
|
||||
LineTo(c, f, g);
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/keysym.h>
|
||||
#define I XDrawLine(W,X,Y,
|
||||
#define l rand()%
|
||||
#define R while(
|
||||
#define n *h++
|
||||
#define x _ c].
|
||||
#define S if(
|
||||
#define _ _[
|
||||
*h ;
|
||||
M=512; i; N=
|
||||
288; e; d; u; p; L[1
|
||||
<<28]; float w=11.46; m; a ;
|
||||
P; k[9304]; *j=k; c; f; q; r; t; v ;
|
||||
* z; K(N,i) { t=u*+cos(N/w)-i*sin(N/w); p=i*
|
||||
cos(N/w)+u*sin(N/w); u=t; } Display*W; GC Y; Pixmap
|
||||
X; s(o,t,g,w,v) { h=v+k; q=2*n; R u=n, r=12+n, K(t,n), K(o,+
|
||||
p+w,u+=g), d=1>p?1:p, u=u*N/d+M/2, d=N/2+r*N/d, u=u>
|
||||
-M*2 ?u<M*2?u:2*M:-2*M, 1&q?i>0|p>0?I f,e,u,d):0: (i=p
|
||||
,e=d,f=u ), --q); } struct{ int c,o,m,f,u,s,i ,e,r; }
|
||||
_ 21 ] ; Window O; b(y) { XGCValues g ; g .
|
||||
foreground=y; g. line_width = 2 ; XChangeGC(W,Y,20
|
||||
,&g); } G(o) { z=x f + k; h=(x f= 381+193*c)+k; i=2*(n
|
||||
=*z++); R--i&1?d=l 9-4,e =l 9 -4*(8>o):0,n=*z+++d,0<(n
|
||||
=*z+++e)?h[-1]=0:0,n=*z+++d, i); } g(o) { u=0; K(x s,o<<9
|
||||
); x u-=u; x r-=p; } F(m,c ) { f=5120*c; c=12; R +c--&&m
|
||||
==+c |abs(x u-_ m].u)>f |x i <1|x c>2 |abs(x r-_ m].r)>f)
|
||||
; return c+1; } T(o) { c=11; S!P){ a=++a%72; S!a){ P=1; R
|
||||
c--){ x c=x m=0; x i=c>2?2:1 ; R x u=l 978-499<<8, x s= l
|
||||
71, x r=l 979-501<<8, F(c,2) ); x f=c>2?l +2*+73:147; x o
|
||||
=2>c?249<<16-c*8:64987<<8*(c >2); } } } S P){ c=11; R 4&x
|
||||
i? ++x m-64&&x m-71? o=1,64> x m?(d=F(c,1))?x m=64,d<4?j[
|
||||
x e]++,++_ --d].c:0:g(7):G(x m -65) :_ x i=0,x e].e-- :0,
|
||||
20>++c); c=3; R c--) { S 1&x i) { o++; S x c>2) x m>15? x
|
||||
i=0:G(x m++); else { S x m ) S x m-->6) g(4); S c<2) { x
|
||||
s=(72+x s+L[c?B]-L[c?C])%72; S d=4*L[c?A]-L[c?D]*4) { g(d
|
||||
); S F(c,2)) g(-d); } S L[c? E]&!x m&x e<3) { d=10; R _++
|
||||
d].i) ; g(-4); _ d]=_ c]; _ d].e=c; x e++; x m=7; c=d; x
|
||||
f = 122 ; x i=4; g(19); x o= 4092<<12; c=x e; } } } } } P
|
||||
-=o<2; } v=2; R v--){ m=(108 - _ v].s)%72; b(3^_ v].c?0:
|
||||
128); Q c=0,0,M,N); S!P) s(+ 36,54-a,0,-120,-+-+-+-+147,b
|
||||
((1<<16)-1)); S P) { b(255); I 0,N/2,M,N/2); t=-.889*m; h
|
||||
=k+340; R u=(t+=q=n)*M/32,d= n*N/48,q?I f,e,u,d):0,f=u,e=
|
||||
+d,k+378>h); R x i&&c-v?s(m, x s,x u-_ v].u>>8,x r-_ v].r
|
||||
>>8,x f,b(x o)):0,20>c++); c =0; R e=16+32*c,Q v^c?16:8,e
|
||||
,(c^v?68:76)+c[b(x o),j] , 16), b(0,d=20*x c), Q
|
||||
80-d,4+e,d,8),2>c++) ; } b(255); I M,0,M,
|
||||
N); XCopyArea(W, X,O,Y,0,0,M,N,v*
|
||||
M,0); } }
|
||||
char*o="{ } {} {{ } ; { } ; {; {; { ; { } ; { } ; {; {; } ; { ; { } } ; { ; } { } ; { ; {} ; { ; } {} {{ } ; { } ; {; {; } { } { } } {} { } { } } { } } { } {} { } } { } { } { ; ; ; ; }{; } { { } ; } } ; {; } { ; } { { } ; { }; {; { ; } } { ; } { { } } } { ; } { ; { }; } } } {} { }; } } } } } { }; } ; } ; { } { } ; {} ; } ; } } { } { }} { } { }} } } { {} } } } } { {} } { ; {{ } ; { ; {{ ; { ; {{ } ; { ; {{ ; ; } ; ; } ; ; } }{{ } {{ } { {{ { } } } } } {{{ {} { }{{ } {{ } { {{ { } } ";
|
||||
main(){
|
||||
XEvent e; W=
|
||||
XOpenDisplay(k);
|
||||
XSelectInput(W,O=
|
||||
XCreateSimpleWindow(W,DefaultRootWindow(W),64,64,M*2,N,2,P,r),3);
|
||||
XMapWindow(W,O); srand(time(0)); Y=
|
||||
XCreateGC(W,X=
|
||||
XCreatePixmap(W,O,M,N,DefaultDepth(W,r)),P,r); R*o){ S*o^59)d=64&*o?'{'^*o++:3,
|
||||
32^*o?d+=*o^9?2:1:0,*j+=P?d*9-43:d,j+=P,P=!P; else R*j=j[-3],j++,*++o^9); o++;
|
||||
} R 7){ T(0);
|
||||
XFlush(W); usleep(33367); R
|
||||
XPending(W)) L[
|
||||
XLookupKeysym(&e,
|
||||
XNextEvent(W,&e)&0)]^=1==e.type/2; } }
|
||||
Reference in new issue
Block a user