cleanup winner README.md files
Fixed cases where there was a bad trailing backslash. Improved a few cases where a code block was needed to highlight some text. Changed a few cases where a code block needed to declared as, say, a sh code block. Fixed a few cases where the winner information was not properly formatted. Plus a few nits and clarifying text was added.
This commit is contained in:
1 parent
394f710bc3
commit
360708f858
120 files changed
+1198
-1024
No files matched your search
@@ -1,7 +1,7 @@
|
||||
# Grand Prize
|
||||
|
||||
Sjoerd Mullender\
|
||||
<https://github.com/sjoerdmullender>\
|
||||
<https://github.com/sjoerdmullender>
|
||||
|
||||
Robbert van Renesse
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Best Obfuscator of Programs
|
||||
|
||||
Paul Heckbert\
|
||||
Paul Heckbert
|
||||
|
||||
|
||||
## To build:
|
||||
|
||||
+16
-13
@@ -35,27 +35,30 @@ Several points are important to understand this program:
|
||||
2. What is the value of the symbol `"have"`? (hint: the value is NOT 4
|
||||
characters, or `'h'`, or a string) Consider the fact that:
|
||||
|
||||
```c
|
||||
char *x;
|
||||
```
|
||||
|
||||
char *x;
|
||||
defines a pointer to a `char` (i.e. an address), and that the `=` assigns
|
||||
things of compatible types. Since:
|
||||
|
||||
```c
|
||||
x = "have";
|
||||
```
|
||||
|
||||
defines a pointer to a `char` (i.e. an address), and that the `=` assigns
|
||||
things of compatible types. Since:
|
||||
|
||||
x = "have";
|
||||
|
||||
is legal C, what type of value is `"have"`?
|
||||
is legal C, what type of value is `"have"`?
|
||||
|
||||
3. Note that the following expressions yield the same value:
|
||||
|
||||
```c
|
||||
x[3] *(x+3) *(3+x)
|
||||
```
|
||||
|
||||
x[3] *(x+3) *(3+x)
|
||||
since addition is commutative. What can be said about this value?
|
||||
|
||||
since addition is commutative. What can be said about the value:
|
||||
|
||||
3[x]
|
||||
|
||||
?
|
||||
```c
|
||||
3[x]
|
||||
```
|
||||
|
||||
[David
|
||||
Korn](https://news.slashdot.org/story/01/02/06/2030205/david-korn-tells-all)'s
|
||||
|
||||
@@ -28,7 +28,7 @@ The original version of this code is in [isaak.alt.c](isaak.alt.c).
|
||||
The original entry starts with the line:
|
||||
|
||||
```c
|
||||
main(){};
|
||||
main(){};
|
||||
```
|
||||
|
||||
This works on some systems. Why? Note that `#include <stdio.h>` is given on
|
||||
|
||||
@@ -19,14 +19,12 @@ char *(*(fun[16])();
|
||||
char *(*(*(*(*(*fun[32])))))();
|
||||
```
|
||||
|
||||
What happens if you input:
|
||||
What happens if you input, and what you do about it?
|
||||
|
||||
```
|
||||
```c
|
||||
char *(*(*(*(*(*fun[32])))))());
|
||||
```
|
||||
|
||||
? What can you do about it?
|
||||
|
||||
|
||||
## Judges' remarks:
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ rm -f spinellis ; cc spinellis.c -o spinellis < input.txt && ./spinellis
|
||||
|
||||
and try:
|
||||
|
||||
```
|
||||
```sh
|
||||
rm -f spinellis ; cc spinellis.c -o spinellis < input2.txt && ./spinellis
|
||||
```
|
||||
|
||||
@@ -36,7 +36,7 @@ cc spinellis.alt.c -o spinellis.alt < input.txt && ./spinellis.alt
|
||||
|
||||
and try:
|
||||
|
||||
```
|
||||
```sh
|
||||
cc spinellis.alt.c -o spinellis.alt < input2.txt && ./spinellis.alt
|
||||
```
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# Best layout
|
||||
|
||||
Merlyn LeRoy (Brian Westley)\
|
||||
US
|
||||
US\
|
||||
<http://www.westley.org>
|
||||
|
||||
|
||||
|
||||
@@ -22,10 +22,8 @@ make all
|
||||
[enter some lisp]
|
||||
|
||||
./jar.2 < some_lisp_file
|
||||
|
||||
```
|
||||
|
||||
|
||||
NOTE: this entry will likely segfault on invalid input.
|
||||
|
||||
|
||||
@@ -39,7 +37,6 @@ cat chocolate_cake.lisp ; ./jar.2 < chocolate_cake.lisp
|
||||
./try.sh chocolate_cake.lisp
|
||||
|
||||
./try.sh try.txt
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
+1
-1
@@ -24,7 +24,7 @@ make all
|
||||
|
||||
Give the following lines as input:
|
||||
|
||||
```
|
||||
```basic
|
||||
OLD LANDER.BAS
|
||||
RUN
|
||||
```
|
||||
|
||||
+1
-1
@@ -65,7 +65,7 @@ As for the rot13 algorithm, it relies on `index(3)` to find if the
|
||||
character is in the set `A-Za-z`. `l[]` is an array that gets filled
|
||||
with:
|
||||
|
||||
```
|
||||
```c
|
||||
"nopqrstuvwxyzzzzabcdefghijklmmmmNOPQRSTUVWXYZZZZABCDEFGHIJKLMMMM"
|
||||
```
|
||||
|
||||
|
||||
+6
-3
@@ -23,7 +23,7 @@ output due to a warning at runtime that was interspersed with the output of the
|
||||
program. For instance it would show:
|
||||
|
||||
```sh
|
||||
$ ./tbr
|
||||
./tbr
|
||||
$ warning: this program uses gets(), which is unsafe.
|
||||
```
|
||||
|
||||
@@ -39,7 +39,7 @@ below, in the [alternate version](#alternate-code) section.
|
||||
|
||||
```sh
|
||||
./tbr
|
||||
# enter some shell commands
|
||||
$ enter some shell commands
|
||||
```
|
||||
|
||||
NOTE: globs do not work with this entry. Why?
|
||||
@@ -53,11 +53,14 @@ just `exit` or `logout`? Hint: see the authors' remarks.
|
||||
|
||||
```sh
|
||||
./tbr
|
||||
ls -l tbr tbr.c
|
||||
$ ls -l tbr tbr.c
|
||||
|
||||
# notice how the following does not work:
|
||||
ls tbr*
|
||||
|
||||
# try figuring out how this entry works in an editor:
|
||||
vi tbr.c
|
||||
|
||||
# then figure out how to exit vi :-)
|
||||
```
|
||||
|
||||
|
||||
+35
-39
@@ -43,60 +43,56 @@ it) or when you type `^D` (EOF).
|
||||
|
||||
### Hints on how to cheat
|
||||
|
||||
Rot13 to read:
|
||||
You can, of course, cheat by looking at the maze map. The question
|
||||
you need to ask yourself, though, is what sequence of characters
|
||||
marks the place where you can escape the maze?
|
||||
|
||||
Lbh pna, bs pbhefr, purng ol ybbxvat ng gur znmr znc. Gur dhrfgvba
|
||||
lbh arrq gb nfx lbhefrys, gubhtu, vf jung frdhrapr bs punenpgref
|
||||
znexf gur cynpr jurer lbh pna rfpncr gur znmr?
|
||||
|
||||
Gur nytbevguz vf dhvgr ovmneer--gur cevznel arfgrq ybbc gung
|
||||
trarengrf vg tbrf gbc gb obggbz ba gur qvfcynl, ybbcvat sbejneq
|
||||
gura onpxjneq sebz gur pheerag cbfvgvba gb qenj gur yrsg fvqr naq
|
||||
gura gur evtug fvqr.
|
||||
The algorithm is quite bizarre--the primary nested loop that
|
||||
generates it goes top to bottom on the display, looping forward
|
||||
then backward from the current position to draw the left side and
|
||||
then the right side.
|
||||
|
||||
### Advanced usage notes
|
||||
|
||||
Rot13 to read:
|
||||
The program can also be run from other files containing mazes. The
|
||||
maze should be laid out graphically in the obvious format; newlines
|
||||
separate physical rows in the maze; a space indicates a corridor,
|
||||
and any other character is a wall. Tabs are also considered walls,
|
||||
so make sure to convert tabs to spaces before using it.
|
||||
|
||||
Gur cebtenz pna nyfb or eha sebz bgure svyrf pbagnvavat znmrf. Gur
|
||||
znmr fubhyq or ynvq bhg tencuvpnyyl va gur boivbhf sbezng; arjyvarf
|
||||
frcnengr culfvpny ebjf va gur znmr; n fcnpr vaqvpngrf n pbeevqbe,
|
||||
naq nal bgure punenpgre vf n jnyy. Gnof ner nyfb pbafvqrerq jnyyf,
|
||||
fb znxr fher gb pbaireg gnof gb fcnprf orsber hfvat vg.
|
||||
Usage: buzzard [filename [escape-char [start-x start-yNNN
|
||||
|
||||
Hfntr: ohmmneq [svyranzr [rfpncr-pune [fgneg-k fgneg-l]]]
|
||||
Filename is the name of the file containing the maze. This
|
||||
defaults to 'buzzard.c'.
|
||||
|
||||
Svyranzr vf gur anzr bs gur svyr pbagnvavat gur znmr. Guvf
|
||||
qrsnhygf gb 'ohmmneq.p'.
|
||||
Escape-char is the character in the maze that represents the exit.
|
||||
You can put more than one exit in the maze (for example, you could
|
||||
make all '!'s in the maze be exits).
|
||||
|
||||
Rfpncr-pune vf gur punenpgre va gur znmr gung ercerfragf gur rkvg.
|
||||
Lbh pna chg zber guna bar rkvg va gur znmr (sbe rknzcyr, lbh pbhyq
|
||||
znxr nyy '!'f va gur znmr or rkvgf).
|
||||
Start-x and start-y mark the coordinates where you begin playing.
|
||||
Y coordinate is down the rows in the files, X is to the right
|
||||
through the characters of each line. Both X and Y begin counting
|
||||
from 0. The default is start-x = 4, start-y = 5, which is needed
|
||||
for the buzzard.c, but would probably be inappropriate for other
|
||||
mazes.
|
||||
|
||||
Fgneg-k naq fgneg-l znex gur pbbeqvangrf jurer lbh ortva cynlvat.
|
||||
L pbbeqvangr vf qbja gur ebjf va gur svyrf, K vf gb gur evtug
|
||||
guebhtu gur punenpgref bs rnpu yvar. Obgu K naq L ortva pbhagvat
|
||||
sebz 0. Gur qrsnhyg vf fgneg-k = 4, fgneg-l = 5, juvpu vf arrqrq
|
||||
sbe gur ohmmneq.p, ohg jbhyq cebonoyl or vanccebcevngr sbe bgure
|
||||
znmrf.
|
||||
BUGS:
|
||||
|
||||
OHTF:
|
||||
You can't change that at start you're facing down ("south").
|
||||
|
||||
Lbh pna'g punatr gung ng fgneg lbh'er snpvat qbja ("fbhgu").
|
||||
\
|
||||
Gur qenjvat nytbevguz pnaabg unaqyr bcra fcnprf (gjb fhpprfvir
|
||||
fvqr-pbeevqbef jvgu ab jnyy orgjrra gurz). Va snpg, vg pnaabg unaqyr
|
||||
fznyy qbt-yrtf cebcreyl, nygubhtu gur reebe vf fhogyr.
|
||||
The drawing algorithm cannot handle open spaces (two successive
|
||||
side-corridors with no wall between them). In fact, it cannot handle
|
||||
small dog-legs properly, although the error is subtle.
|
||||
|
||||
Gur rkvg vf qenja yvxr n abezny pbeevqbe sebz gur fvqr ivrj;
|
||||
vg'f bayl qvfcynlrq nf gur rkvg jura lbh ner snpvat vg.
|
||||
The exit is drawn like a normal corridor from the side view;
|
||||
it's only displayed as the exit when you are facing it.
|
||||
|
||||
Vzcebcre pbzznaqyvar nethzragf ner abg unaqyrq avpryl.
|
||||
Improper command line arguments are not handled nicely.
|
||||
|
||||
Znmrf jvgu bcravatf ng gur rqtrf jvyy pnhfr gur qenjvat cebtenz
|
||||
gb ernpu vagb neovgenel cnepryf bs zrzbel.
|
||||
Mazes with openings at the edges will cause the drawing program
|
||||
to reach into arbitrary parcels of memory.
|
||||
|
||||
Gur cebtenz nffhzrf gung gnof ner frg gb 8 punenpgref.
|
||||
The program assumes that tabs are set to 8 characters.
|
||||
|
||||
|
||||
## Copyright and CC BY-SA 4.0 License:
|
||||
|
||||
+10
-10
@@ -40,19 +40,19 @@ this entry.
|
||||
|
||||
## Author's remarks:
|
||||
|
||||
Spoiler, rot13 to read:
|
||||
Spoiler:
|
||||
|
||||
Gur fbhepr pbqr ubyqf gur yrggref bs gur zrffntr. Rnpu yrggre, pbzovarq
|
||||
jvgu nabgure xrl yrggre, vf hfrq gb pbzchgr gur pbbeqvangrf bs gur arkg
|
||||
yrggre naq xrl. Guhf, gur zrffntr vf pbqr. Gung vf jul V hfr fvyyl\
|
||||
pbzzragf, zbfg bsgra onqyl fcnprq.
|
||||
The source code holds the letters of the message. Each letter, combined
|
||||
with another key letter, is used to compute the coordinates of the next
|
||||
letter and key. Thus, the message is code. That is why I use silly\
|
||||
comments, most often badly spaced.
|
||||
|
||||
Gur fcnpr punenpgre frdhrapr orgjrra gur jbeqf vf tvira ol n fvzcyr
|
||||
pbzchgngvba ba na bpgny pbafgnag (tvira urer nf na urk inyhr, bs
|
||||
pbhefr).
|
||||
The space character sequence between the words is given by a simple
|
||||
computation on an octal constant (given here as an hex value, of
|
||||
course).
|
||||
|
||||
Guvf jnl, nal zrffntr pna or zvkrq vagb n pbqr, fvapr gur xrlf nyybj
|
||||
lbh gb cynpr gur zrnavatshy yrggref jurerire lbh jnag.
|
||||
This way, any message can be mixed into a code, since the keys allow
|
||||
you to place the meaningful letters wherever you want.
|
||||
|
||||
|
||||
## Copyright and CC BY-SA 4.0 License:
|
||||
|
||||
+2
-2
@@ -55,12 +55,12 @@ the high bit off some input?
|
||||
|
||||
The author wishes to thank J Greely for the last 6 bytes.
|
||||
|
||||
Here's about how it does it: [rot13 to read]
|
||||
Here's about how it does it:
|
||||
|
||||
NOTE: Bits are referred to as 76543210, high to low.
|
||||
|
||||
1. Get the character in variable `a`. Note the fun way we check for `EOF`.
|
||||
(thanks J).
|
||||
(thanks J).
|
||||
|
||||
2. Reverse bit 6, and strip bit 5. Bit 6 determines (mostly) whether
|
||||
or not this character is a letter. Bit 5 would determine case if
|
||||
|
||||
+33
-33
@@ -33,45 +33,45 @@ This entry has been updated to allow most ANSI C compilers.
|
||||
This program is a simple puzzle type game. (I'll leave you to play
|
||||
it to see the rest of it .. :-) .) The general idea was to try and
|
||||
write the smallest playable game, but keep the playability and
|
||||
enjoyment high.\
|
||||
\
|
||||
### Instructions (rot13 to read):
|
||||
enjoyment high.
|
||||
|
||||
### Instructions:
|
||||
|
||||
Xrl gb znc:-
|
||||
Key to map:
|
||||
|
||||
|
|
||||
###### | | | /\ /--\ ==| /\ | | Qverpgbany xrlf\
|
||||
###### Fbyvq Jnyy | ----|| \/ /\ ||---- (haybpx qbbef bs
|
||||
###### | \/ ==| \--/ \/ gur fnzr qverpgvba)
|
||||
|\
|
||||
| << >> Qbbef. Haybpxrq ol
|
||||
Oynax fcnpr | << iiiiii ^^^^^^ >> gur nobir xrlf.
|
||||
| << >>
|
||||
|\
|
||||
___ | b__B\ B__B ^__^ /B__b\
|
||||
/ \ 'Pehfunoyr' | \___/ /----\ /----\ \___/ Gur sbhe fcevgrf sbe
|
||||
\___/ obhyqre | _/_\ _/ \_ _/ \_ /_\_ lbhe punenpgre :-)
|
||||
|\
|
||||
___ hapehfunoyr | /\ Qvnzbaqf. Gurl pna rvgure or sbhaq ylvat
|
||||
/@@@\ obhyqre | < > nebhaq (vs bayl!) be znahsnpgher ol chfuvat
|
||||
\@@@/ | \/ gjb 'pehfunoyr' ebpxf gbtrgure.
|
||||
|
|
||||
```
|
||||
|
|
||||
###### | | | /\ /--\ ==| /\ | | Directonal keys\
|
||||
###### Solid Wall | ----|| \/ /\ ||---- (unlock doors of
|
||||
###### | \/ ==| \--/ \/ the same direction)
|
||||
|\
|
||||
| << >> Doors. Unlocked by
|
||||
Blank space | << vvvvvv ^^^^^^ >> the above keys.
|
||||
| << >>
|
||||
|\
|
||||
___ | o__O\ O__O ^__^ /O__o\
|
||||
/ \ 'Crushable' | \___/ /----\ /----\ \___/ The four sprites for
|
||||
\___/ boulder | _/_\ _/ \_ _/ \_ /_\_ your character :-)
|
||||
|\
|
||||
___ uncrushable | /\ Diamonds. They can either be found lying
|
||||
/@@@\ boulder | < > around (if only!) or manufacture by pushing
|
||||
\@@@/ | \/ two 'crushable' rocks together.
|
||||
|
|
||||
|
||||
Gur trareny vqrn bs gur tnzr vf gb pbyyrpg nyy gur qvnzbaqf. Guvf zhfg
|
||||
or qbar va gur zvavzhz nzbhag bs zbirf. V'ir nyybjrq n znetva bs 5
|
||||
zbirf juvpu oevatf gur zbirf nyybjrq gb 484. (nygre gur inyhr bs 'h' va
|
||||
gur cebtenz gb frg gur znk zbirf nyybjrq)
|
||||
The general idea of the game is to collect all the diamonds. This must
|
||||
be done in the minimum amount of moves. I've allowed a margin of 5
|
||||
moves which brings the moves allowed to 484. (alter the value of 'u' in
|
||||
the program to set the max moves allowed)
|
||||
|
||||
Gurer ner gjb glcrf bs obhyqref. Obgu pna or chfurq nebhaq, ohg bayl
|
||||
gur ubyybj (pehfunoyr) barf pna or ghearq vagb qvnzbaqf (ol chfuvat vg
|
||||
bagb nabgure ubyybj bar).
|
||||
|
||||
Bs gur sbhe glcrf bs qbbef (naq xrlf) bayl 3 unir orra qrsvarq. Guvf
|
||||
jnf qbar gb xrrc gur fbhepr nf ybj nf cbffvoyr (nf V bayl hfrq 3 va gur
|
||||
znc). Gb haybpx n qbbe fvzcyl chfu n xrl vagb gur pbeerfcbaqvat qbbe.
|
||||
Gnxr pner gung vg'f snpvat va gur pbeerpg qverpgvba.
|
||||
There are two types of boulders. Both can be pushed around, but only
|
||||
the hollow (crushable) ones can be turned into diamonds (by pushing it
|
||||
onto another hollow one).
|
||||
|
||||
Of the four types of doors (and keys) only 3 have been defined. This
|
||||
was done to keep the source as low as possible (as I only used 3 in the
|
||||
map). To unlock a door simply push a key into the corresponding door.
|
||||
Take care that it's facing in the correct direction.
|
||||
```
|
||||
|
||||
## Copyright and CC BY-SA 4.0 License:
|
||||
|
||||
|
||||
+93
-86
@@ -38,9 +38,11 @@ Make and run as follows:
|
||||
where the `move_location` is a digit from 1 to 9 that represents
|
||||
a move on a tic-tac-toe board:
|
||||
|
||||
1 2 3
|
||||
4 5 6
|
||||
7 8 9
|
||||
```
|
||||
1 2 3
|
||||
4 5 6
|
||||
7 8 9
|
||||
```
|
||||
|
||||
If you omit `move_location`, then the computer moves first. For your\
|
||||
next move, recompile `nextmove.c` and play it again:
|
||||
@@ -61,7 +63,7 @@ make ttt
|
||||
./ttt next_move
|
||||
|
||||
```
|
||||
\
|
||||
|
||||
The shell script determines when the game is over, and automatically\
|
||||
replaces `merlyn.c` (copied from [westley.c](westley.c) with an improved version after a loss. The [ttt](ttt.sh) script\
|
||||
has two other modes:
|
||||
@@ -172,113 +174,118 @@ longer loses games.
|
||||
If you want a program that never loses, simply replace the string
|
||||
`"9999999999 :-| "` with `"9883857753 :-| "`.
|
||||
|
||||
### How it works (rot13 to read):
|
||||
### How it works
|
||||
|
||||
The vertical "bars" of the grid are identical functions, with the
|
||||
name of the function as a(), b(), or c(). After each function is
|
||||
called, the global variables X and O contain bitmasks of where all
|
||||
the Xs and Os are placed. The statement:
|
||||
|
||||
Gur iregvpny "onef" bs gur tevq ner vqragvpny shapgvbaf, jvgu gur
|
||||
anzr bs gur shapgvba nf n(), o(), be p(). Nsgre rnpu shapgvba vf
|
||||
pnyyrq, gur tybony inevnoyrf K naq B pbagnva ovgznfxf bs jurer nyy
|
||||
gur Kf naq Bf ner cynprq. Gur fgngrzrag:
|
||||
```c
|
||||
X=- <char> -1;
|
||||
``
|
||||
|
||||
K=- <pune> -1;
|
||||
evaluates to 1, -1, or -2 when X is 1 and <char> is one of "X",
|
||||
"0", or " ". The function S(&X) sets the appropriate bits in
|
||||
(global var) X and O and resets the value of &X to 1. This is how
|
||||
the current position is computed.
|
||||
|
||||
rinyhngrf gb 1, -1, be -2 jura K vf 1 naq <pune> vf bar bs "K",
|
||||
"0", be " ". Gur shapgvba F(&K) frgf gur nccebcevngr ovgf va
|
||||
(tybony ine) K naq B naq erfrgf gur inyhr bs &K gb 1. Guvf vf ubj
|
||||
gur pheerag cbfvgvba vf pbzchgrq.
|
||||
The player's move is OR'd into the X mask, and (if it is the
|
||||
opening move) the strategy string's first character is set to the
|
||||
player's first move (or "5" if the computer moves first).
|
||||
|
||||
Gur cynlre'f zbir vf BE'q vagb gur K znfx, naq (vs vg vf gur
|
||||
bcravat zbir) gur fgengrtl fgevat'f svefg punenpgre vf frg gb gur
|
||||
cynlre'f svefg zbir (be "5" vs gur pbzchgre zbirf svefg).
|
||||
The evalution function y(M) checks if the mask has a winning
|
||||
pattern (any of the first eight bitmasks of the w[N array), and
|
||||
sets the variable q to 0 if it does.
|
||||
|
||||
Gur rinyhgvba shapgvba l(Z) purpxf vs gur znfx unf n jvaavat
|
||||
cnggrea (nal bs gur svefg rvtug ovgznfxf bs gur j[] neenl), naq
|
||||
frgf gur inevnoyr d gb 0 vs vg qbrf.
|
||||
The player's move is evaluated to see if the human has won. The
|
||||
smiley is set to :-) or :-( depending on this. Also, if the human
|
||||
has won, the digit in the strategy string is decremented to change
|
||||
the computer's play for next game.
|
||||
|
||||
Gur cynlre'f zbir vf rinyhngrq gb frr vs gur uhzna unf jba. Gur
|
||||
fzvyrl vf frg gb :-) be :-( qrcraqvat ba guvf. Nyfb, vs gur uhzna
|
||||
unf jba, gur qvtvg va gur fgengrtl fgevat vf qrperzragrq gb punatr
|
||||
gur pbzchgre'f cynl sbe arkg tnzr.
|
||||
If the human has NOT won, the e(N,M) function evaluates if ANY move
|
||||
not in mask N can produce a win in mask M. The first evaluation
|
||||
e(X,O) checks if O can make a legal winning move. If so, the
|
||||
computer has a winning move and makes it. If not, the smiley is
|
||||
set to :-|, and a non-winning move is generated.
|
||||
|
||||
Vs gur uhzna unf ABG jba, gur r(A,Z) shapgvba rinyhngrf vs NAL zbir
|
||||
abg va znfx A pna cebqhpr n jva va znfx Z. Gur svefg rinyhngvba
|
||||
r(K,B) purpxf vs B pna znxr n yrtny jvaavat zbir. Vs fb, gur
|
||||
pbzchgre unf n jvaavat zbir naq znxrf vg. Vs abg, gur fzvyrl vf
|
||||
frg gb :-|, naq n aba-jvaavat zbir vf trarengrq.
|
||||
A non-winning move first checks if X can win in one move; if so,
|
||||
this move is selected, blocking the win. Otherwise, a move is
|
||||
generated by looking down the list of "move templates". The first
|
||||
move template that generates a move that is NOT already occupied by
|
||||
an X or O is returned.
|
||||
|
||||
N aba-jvaavat zbir svefg purpxf vs K pna jva va bar zbir; vs fb,
|
||||
guvf zbir vf fryrpgrq, oybpxvat gur jva. Bgurejvfr, n zbir vf
|
||||
trarengrq ol ybbxvat qbja gur yvfg bs "zbir grzcyngrf". Gur svefg
|
||||
zbir grzcyngr gung trarengrf n zbir gung vf ABG nyernql bpphcvrq ol
|
||||
na K be B vf erghearq.
|
||||
The "move templates" are static tic-tac-toe positions that generate
|
||||
possible moves by making the e() function return "winning" moves,
|
||||
e.g. the template:
|
||||
|
||||
Gur "zbir grzcyngrf" ner fgngvp gvp-gnp-gbr cbfvgvbaf gung trarengr
|
||||
cbffvoyr zbirf ol znxvat gur r() shapgvba erghea "jvaavat" zbirf,
|
||||
r.t. gur grzcyngr:
|
||||
```
|
||||
. . .
|
||||
O , O (this is the value 40; 2^3+2^5)
|
||||
. . . ("O"s are 1 bits, "." and "," are 0 bits)
|
||||
```
|
||||
|
||||
. . .
|
||||
B , B (guvf vf gur inyhr 40; 2^3+2^5)
|
||||
. . . ("B"f ner 1 ovgf, "." naq "," ner 0 ovgf)
|
||||
...will make the e() function return a center move, as
|
||||
this is the only move that produces three in a row. Notice that
|
||||
the computer does not consider which cells contain Xs and Os when
|
||||
making a template move, only which cells are empty and not-empty.
|
||||
This makes for unusual play.
|
||||
|
||||
...jvyy znxr gur r() shapgvba erghea n pragre zbir, nf
|
||||
guvf vf gur bayl zbir gung cebqhprf guerr va n ebj. Abgvpr gung
|
||||
gur pbzchgre qbrf abg pbafvqre juvpu pryyf pbagnva Kf naq Bf jura
|
||||
znxvat n grzcyngr zbir, bayl juvpu pryyf ner rzcgl naq abg-rzcgl.
|
||||
Guvf znxrf sbe hahfhny cynl.
|
||||
The templates are carefully chosen to eventually block all traps
|
||||
that X can try, by just blundering in the way.
|
||||
|
||||
Gur grzcyngrf ner pnershyyl pubfra gb riraghnyyl oybpx nyy gencf
|
||||
gung K pna gel, ol whfg oyhaqrevat va gur jnl.
|
||||
Also note that the winning & strategy templates are part of the
|
||||
compile line, making it possible to change the rules of the game by
|
||||
changing the compile line.
|
||||
|
||||
Nyfb abgr gung gur jvaavat & fgengrtl grzcyngrf ner cneg bs gur
|
||||
pbzcvyr yvar, znxvat vg cbffvoyr gb punatr gur ehyrf bs gur tnzr ol
|
||||
punatvat gur pbzcvyr yvar.
|
||||
The templates are:
|
||||
|
||||
Gur grzcyngrf ner:
|
||||
```
|
||||
O , O
|
||||
, , ,
|
||||
O , O
|
||||
|
||||
B , B
|
||||
, , ,
|
||||
B , B
|
||||
, . .
|
||||
. O .
|
||||
. . O
|
||||
|
||||
, . .
|
||||
. B .
|
||||
. . B
|
||||
. . .
|
||||
O , O
|
||||
. . .
|
||||
|
||||
. . .
|
||||
B , B
|
||||
. . .
|
||||
. . .
|
||||
O O ,
|
||||
. . .
|
||||
|
||||
. . .
|
||||
B B ,
|
||||
. . .
|
||||
. . .
|
||||
O , O
|
||||
. . .
|
||||
|
||||
. . .
|
||||
B , B
|
||||
. . .
|
||||
. , ,
|
||||
. O .
|
||||
O O ,
|
||||
|
||||
. , ,
|
||||
. B .
|
||||
B B ,
|
||||
O , O
|
||||
, , .
|
||||
O . .
|
||||
|
||||
B , B
|
||||
, , .
|
||||
B . .
|
||||
, . O
|
||||
O , O
|
||||
O . ,
|
||||
|
||||
, . B
|
||||
B , B
|
||||
B . ,
|
||||
O . ,
|
||||
O , O
|
||||
, . O
|
||||
|
||||
B . ,
|
||||
B , B
|
||||
, . B
|
||||
O , O
|
||||
, , ,
|
||||
O , O
|
||||
```
|
||||
|
||||
B , B
|
||||
, , ,
|
||||
B , B
|
||||
|
||||
N qvtvg bs "9" zrnaf fgneg jvgu gur svefg grzcyngr, "8" fgnegf ng
|
||||
gur frpbaq, rgp. Gur grzcyngrf ner fpnaarq hagvy n yrtny zbir vf
|
||||
sbhaq. N grzcyngr vf fpnaarq sebz obggbz gb gbc, evtug gb yrsg
|
||||
(v.r. zbir 9 vf grfgrq svefg, gura 8, qbja gb zbir 1).
|
||||
A digit of "9" means start with the first template, "8" starts at
|
||||
the second, etc. The templates are scanned until a legal move is
|
||||
found. A template is scanned from bottom to top, right to left
|
||||
(i.e. move 9 is tested first, then 8, down to move 1).
|
||||
|
||||
|
||||
## Copyright and CC BY-SA 4.0 License:
|
||||
|
||||
+58
-36
@@ -28,7 +28,6 @@ NOTE: if you do not specify an arg to the program it will segfault.
|
||||
|
||||
## Judges' remarks:
|
||||
|
||||
\
|
||||
Once you get past the obfuscation, you have an opportunity to learn
|
||||
about regular expressions and state machines.
|
||||
|
||||
@@ -79,43 +78,49 @@ character list.
|
||||
|
||||
### Example 2: `^abc`
|
||||
|
||||
<q0> a <q1>
|
||||
<q1> b <q2>
|
||||
<q2> c [q3]
|
||||
[q3] . [q3]
|
||||
|
||||
```
|
||||
<q0> a <q1>
|
||||
<q1> b <q2>
|
||||
<q2> c [q3]
|
||||
[q3] . [q3]
|
||||
```
|
||||
|
||||
### Example 3: `abc$`
|
||||
|
||||
<q0> a <q1> . <q0>
|
||||
<q1> b <q2> a <q1> . <q0>
|
||||
<q2> c [q3] a <q1> . <q0>
|
||||
[q3] . <q1>
|
||||
|
||||
```
|
||||
<q0> a <q1> . <q0>
|
||||
<q1> b <q2> a <q1> . <q0>
|
||||
<q2> c [q3] a <q1> . <q0>
|
||||
[q3] . <q1>
|
||||
```
|
||||
|
||||
### Example 4: `^(abc)*$`
|
||||
|
||||
[q0] a <q1>
|
||||
<q1> b <q2>
|
||||
<q2> c [q0]
|
||||
|
||||
```
|
||||
[q0] a <q1>
|
||||
<q1> b <q2>
|
||||
<q2> c [q0]
|
||||
```
|
||||
|
||||
### Example 5: `^[ab][cd][ef]$`
|
||||
|
||||
<q0> ab <q1>
|
||||
<q1> cd <q2>
|
||||
<q2> ef [q3]
|
||||
[q3]
|
||||
|
||||
```
|
||||
<q0> ab <q1>
|
||||
<q1> cd <q2>
|
||||
<q2> ef [q3]
|
||||
[q3]
|
||||
```
|
||||
|
||||
### Example 6: `^(abc|efg)$`
|
||||
|
||||
<q0> a <q1> e <q3>
|
||||
<q1> b <q2>
|
||||
<q2> c [q5]
|
||||
<q3> f <q4>
|
||||
<q4> g [q5]
|
||||
[q5]
|
||||
```
|
||||
<q0> a <q1> e <q3>
|
||||
<q1> b <q2>
|
||||
<q2> c [q5]
|
||||
<q3> f <q4>
|
||||
<q4> g [q5]
|
||||
[q5]
|
||||
```
|
||||
|
||||
|
||||
With the automaton specification in 'filename', invoke the program by
|
||||
@@ -149,8 +154,9 @@ as the specification for the automaton. (This file has been renamed\
|
||||
to `adrian.c` by the judges.) In this case, the program will search for\
|
||||
matches to the regular expression:
|
||||
|
||||
|
||||
^.[^|C][^w[Q]*(Q|[w[]c).*|^.[C|]$
|
||||
```
|
||||
^.[^|C][^w[Q]*(Q|[w[]c).*|^.[C|]$
|
||||
```
|
||||
|
||||
I suggest using `adgrep.c` as input, and storing the output in `adwc.c`:
|
||||
|
||||
@@ -166,7 +172,9 @@ displays the number of lines, words, and bytes in the input file.
|
||||
Another possibly interesting automaton can be created by slightly
|
||||
adjusting the `adgrep.c` file. Change the first line to read
|
||||
|
||||
/* . echo| . */
|
||||
```c
|
||||
/* . echo| . */
|
||||
```
|
||||
|
||||
and repeat the process above
|
||||
|
||||
@@ -176,7 +184,9 @@ and repeat the process above
|
||||
|
||||
The new file now contains all lines which match
|
||||
|
||||
^.[^5|m^]*[m^]([e=p,;]|[^e=+p,;].*)$
|
||||
```
|
||||
^.[^5|m^]*[m^]([e=p,;]|[^e=+p,;].*)$
|
||||
```
|
||||
|
||||
Compile and run. This is an echo clone. Note the efficient algorithm
|
||||
employed.
|
||||
@@ -185,11 +195,15 @@ employed.
|
||||
Two other adjustments to the first line also yield useful results. By
|
||||
changing it to
|
||||
|
||||
/* . head; . */
|
||||
```c
|
||||
/* . head; . */
|
||||
```
|
||||
|
||||
you can search for matches to
|
||||
|
||||
^.[^W]*W..*$
|
||||
```
|
||||
^.[^W]*W..*$
|
||||
```
|
||||
|
||||
By some freak happenstance, lines of adgrep.c which match this regular
|
||||
expression form a unix head command. It prints the first ten lines of
|
||||
@@ -198,12 +212,16 @@ specified).
|
||||
|
||||
By setting the first line to
|
||||
|
||||
/* . basename . */
|
||||
```c
|
||||
/* . basename . */
|
||||
```
|
||||
|
||||
a clone of the unix basename command can be unearthed. The automaton will
|
||||
search for
|
||||
|
||||
^.[^j]*jr.*$
|
||||
```
|
||||
^.[^j]*jr.*$
|
||||
```
|
||||
|
||||
on standard input. And the program which results by running adgrep.c
|
||||
through this filter requires two parameters. The first is meant to be a
|
||||
@@ -213,11 +231,15 @@ The resulting base name is printed to stdout.
|
||||
|
||||
Lastly, by setting the first line to
|
||||
|
||||
/* . sleep . */
|
||||
```c
|
||||
/* . sleep . */
|
||||
```
|
||||
|
||||
you can search for
|
||||
|
||||
^.[^(~][^s]*sl.*$
|
||||
```
|
||||
^.[^(~][^s]*sl.*$
|
||||
```
|
||||
|
||||
Filtering adgrep.c through this search yields a clone of the sleep
|
||||
command. Invoke with a single integer parameter, and it will pause
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
Albert van der Horst\
|
||||
S P&A R&C\
|
||||
Oranjestraat 8\
|
||||
3511 RA UTRECHT\
|
||||
3511 RA UTRECHT\
|
||||
The Netherlands
|
||||
|
||||
|
||||
@@ -65,7 +65,6 @@ Use `albert.alt` as you would `albert` above.
|
||||
|
||||
## Judges' remarks:
|
||||
|
||||
\
|
||||
We were impressed with the speed at which it was able to factor
|
||||
arbitrarily large numbers consisting of factors that fit into
|
||||
a long.
|
||||
|
||||
@@ -182,21 +182,21 @@ programs is the conditional (given that we have loops).
|
||||
Since all you can do in the given operation output set is
|
||||
assignment, we implement "conditional assignment":
|
||||
|
||||
```
|
||||
```c
|
||||
if (x) y = z;
|
||||
```
|
||||
|
||||
To implement this, we constrain x to be either 0 or 1, and
|
||||
simply compute:
|
||||
|
||||
```
|
||||
```c
|
||||
y = (z * x) + (y * (1-x));
|
||||
```
|
||||
|
||||
This is more obscured by factoring out common terms and restricting
|
||||
ourselves to two operand operations:
|
||||
|
||||
```
|
||||
```c
|
||||
temp = z; (temp == z)
|
||||
temp -= y; (temp == z-y)
|
||||
temp *= x; (temp == (z-y)*x)
|
||||
@@ -210,7 +210,7 @@ Next we imagine we have a [pc](https://en.wikipedia.org/wiki/Program_counter).
|
||||
we're not currently coming up on statement pc. To handle this, we simply make
|
||||
every operation conditional on the pc having the correct value:
|
||||
|
||||
```
|
||||
```c
|
||||
if (pc == some_constant) y = z;
|
||||
```
|
||||
|
||||
|
||||
@@ -236,12 +236,10 @@ those bits that should remain zero. For example, the following
|
||||
program prints all those 16-bit integers that contain zeroes in all
|
||||
even bit positions:
|
||||
|
||||
|
||||
```c
|
||||
main(){int i=0,s=0xAAAA;do{printf("%04x\t",i);}while(i=((i|~s)+1)&s);}
|
||||
```
|
||||
|
||||
|
||||
AG uses a similar method but works in the opposite direction, finding
|
||||
the next lower value with zeroes in given bit positions by propagating
|
||||
borrows across those bits. Some additional adjustments are made
|
||||
|
||||
+1
-1
@@ -22,7 +22,7 @@ make all
|
||||
# text mode
|
||||
./imc -text
|
||||
|
||||
./imc\
|
||||
./imc
|
||||
```
|
||||
|
||||
|
||||
|
||||
@@ -66,12 +66,12 @@ distribute winners outside of the US.
|
||||
Nathan Sidwell stated that he was willing to distribute the winning source. To
|
||||
read HIS instructions of how to obtain his winning program one was able to run:
|
||||
|
||||
```sh
|
||||
make nathan
|
||||
./nathan
|
||||
```
|
||||
|
||||
make nathan
|
||||
./nathan
|
||||
|
||||
|
||||
to learn how to get a copy of the code.
|
||||
to learn how to get a copy of the code.
|
||||
|
||||
See the 1992/nathan.c file in the
|
||||
[../../archive/archive-1992.tar.bz2](archive/archive-1992.tar.bz2) tarball if
|
||||
|
||||
+2
-3
@@ -19,7 +19,7 @@ make all
|
||||
## To use:
|
||||
|
||||
```sh
|
||||
./vern 3 # <-- default is 2
|
||||
./vern 3 # <-- default is 2
|
||||
```
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ You might start off by giving the following input:
|
||||
63 43
|
||||
76 55
|
||||
71 52
|
||||
67 57 # (this may take a while)
|
||||
67 57 # <-- this may take a while
|
||||
```
|
||||
|
||||
|
||||
@@ -47,7 +47,6 @@ For a real quick game try:
|
||||
|
||||
65 55
|
||||
66 46
|
||||
|
||||
```
|
||||
|
||||
NOTE: Move values must be restricted to the range 00 to 77.
|
||||
|
||||
@@ -35,7 +35,7 @@ show correctly!
|
||||
### Try:
|
||||
|
||||
```sh
|
||||
./whereami 47 -122 (- means west of meridian)
|
||||
./whereami 47 -122 # NOTE: - means west of meridian
|
||||
./whereami 47 122
|
||||
```
|
||||
|
||||
@@ -66,7 +66,7 @@ NOTE: this alternative version also needs a terminal that wraps at 80 columns.
|
||||
To find the approximate place where this entry was judged, type:
|
||||
|
||||
```sh
|
||||
./whereami 37 -122 (- means west of meridian)
|
||||
./whereami 37 -122 # NOTE: - means west of meridian
|
||||
```
|
||||
|
||||
|
||||
@@ -155,8 +155,10 @@ n="bnaBCOCXdBBHGYdAP[A M E R I C A].AqandkmavX|ELC}BOCd"
|
||||
The code will test the 80-column wrap and document itself if it is
|
||||
joined together as one 160-character line and listed. You should see:
|
||||
|
||||
main(l,a,n,d)...
|
||||
[A M E R I C A]...
|
||||
```c
|
||||
main(l,a,n,d)...
|
||||
[A M E R I C A]...
|
||||
```
|
||||
|
||||
...going down the left edge if your terminal auto-wraps at 80 characters.
|
||||
|
||||
|
||||
+10
-8
@@ -38,14 +38,16 @@ From the San Jose Mercury News (May 15, 1993 page 20A "West Hackers\
|
||||
trounce East in computer quiz game"):
|
||||
|
||||
|
||||
> "Since 1984, a contest has been held on Usenet for the most
|
||||
> unreadable, creative, bizarre but working C program", Gates
|
||||
> said. "What is the name of this contest?"
|
||||
>
|
||||
> "Windows," shot back Gassee, naming Microsoft's premier product
|
||||
> - a product over which Apple sued Microsoft five years ago. Not
|
||||
> the right answer - it's "The Obfuscated C Contest [sic]" - but
|
||||
> it brought down the house of Apple partisans...
|
||||
```
|
||||
"Since 1984, a contest has been held on Usenet for the most
|
||||
unreadable, creative, bizarre but working C program", Gates
|
||||
said. "What is the name of this contest"
|
||||
|
||||
"Windows," shot back Gassee, naming Microsoft's premier product
|
||||
- a product over which Apple sued Microsoft five years ago. Not
|
||||
the right answer - it's "The Obfuscated C Contest [sic]" - but
|
||||
it brought down the house of Apple partisans...
|
||||
```
|
||||
|
||||
[The expression on Bill Gates' face was a sight to behold, as reported
|
||||
to us by several who were there].
|
||||
|
||||
@@ -22,7 +22,7 @@ make all
|
||||
```
|
||||
|
||||
where:
|
||||
\
|
||||
|
||||
`datafile` is the initial pattern (default: [dgibson.data1](dgibson.data1))
|
||||
|
||||
|
||||
|
||||
+2
-2
@@ -48,7 +48,7 @@ We note that this also works under macOS just fine.
|
||||
#### Output solution to Towers of Hanoi for five rings:
|
||||
|
||||
```sh
|
||||
./ejb 5\
|
||||
./ejb 5
|
||||
```
|
||||
|
||||
The format of the output for the Towers of Hanoi case is simply a
|
||||
@@ -57,7 +57,7 @@ text description of how to solve the puzzle.
|
||||
#### Output solution to the Patience puzzle for six rings:
|
||||
|
||||
```sh
|
||||
./ejb -6\
|
||||
./ejb -6
|
||||
```
|
||||
|
||||
|
||||
|
||||
+10
-11
@@ -35,7 +35,6 @@ where:
|
||||
|
||||
## Judges' remarks:
|
||||
|
||||
\
|
||||
By default, the number of colors is 6. You may specify a
|
||||
value of between 1 and 15 colors. See the author's notes
|
||||
for instructions of how to play.
|
||||
@@ -78,16 +77,16 @@ backspaces. Do "disable scrolling" on cmdtool or similar emulators.
|
||||
|
||||
```
|
||||
judges-385> ./leo
|
||||
(1296): 6433
|
||||
?? 12 # one 3 is a bull, another is a cow, and 4 is a cow
|
||||
(160): 5363
|
||||
?? 02 # both 3's are cows
|
||||
(21): 4231
|
||||
?? 22 # 2 and 3 are bulls, 4 and 1 are cows
|
||||
(2): 4132
|
||||
?? 13 # 3 is a bull; 1, 2 and 4 are cows
|
||||
(1): 1234
|
||||
?? 40 # you may enter everything there
|
||||
(1296): 6433
|
||||
?? 12 # one 3 is a bull, another is a cow, and 4 is a cow
|
||||
(160): 5363
|
||||
?? 02 # both 3's are cows
|
||||
(21): 4231
|
||||
?? 22 # 2 and 3 are bulls, 4 and 1 are cows
|
||||
(2): 4132
|
||||
?? 13 # 3 is a bull; 1, 2 and 4 are cows
|
||||
(1): 1234
|
||||
?? 40 # you may enter everything there
|
||||
```
|
||||
|
||||
##### EXAMPLE: Guess the computer's number
|
||||
|
||||
@@ -39,7 +39,6 @@ NOTE: an alternate version exists. See Alternate code section below.
|
||||
|
||||
To use:
|
||||
|
||||
|
||||
```sh
|
||||
make alt
|
||||
```
|
||||
|
||||
@@ -63,7 +63,7 @@ What is cat?
|
||||
|
||||
After this program prints the contents of 'file', ask it
|
||||
some questions related to the text.
|
||||
\
|
||||
|
||||
The author suggests the following questions when using
|
||||
[schnitzi.info](schnitzi.info):
|
||||
|
||||
|
||||
+1
-2
@@ -37,7 +37,6 @@ What happens if you use something other than valid digits?
|
||||
|
||||
## Judges' remarks:
|
||||
|
||||
\
|
||||
The octal expression may contain:
|
||||
|
||||
```
|
||||
@@ -93,7 +92,7 @@ what grammar non-terminal to parse. `**O7` is the next character.
|
||||
`O3` is an intermediate result. Whenever you see a construct like:
|
||||
|
||||
```
|
||||
!(expression with O2)?
|
||||
!(expression with O2)?
|
||||
```
|
||||
|
||||
it's decrementing & testing `O2` to see what state it's in. Comparisons
|
||||
|
||||
@@ -76,7 +76,9 @@ feeding the source code to it will not work right.
|
||||
|
||||
Try:
|
||||
|
||||
./schnitzi < schnitzi.c
|
||||
```sh
|
||||
./schnitzi < schnitzi.c
|
||||
```
|
||||
|
||||
Compare the output of the program with its source. Sure the output
|
||||
is different, but there is more than meets the `diff`'s eye. Can you
|
||||
@@ -104,7 +106,7 @@ The program generates interesting results when its source file is
|
||||
used as input:
|
||||
|
||||
```sh
|
||||
schnitzi < schnitzi.c
|
||||
schnitzi < schnitzi.c
|
||||
```
|
||||
|
||||
The result of this command is a program which does the exact same
|
||||
|
||||
+5
-3
@@ -35,9 +35,11 @@ Mode may be a value from 0 to 12.
|
||||
|
||||
The author has provided us a spoiler version:
|
||||
|
||||
make tvr.alt
|
||||
./tvr.alt altmode screensize/2 < colormapfile
|
||||
\
|
||||
```sh
|
||||
make tvr.alt
|
||||
./tvr.alt altmode screensize/2 < colormapfile
|
||||
```
|
||||
|
||||
where `altmode` `1` - `4` correspond to mode `0` - `3` in the original entry and
|
||||
`altmode 0` calculates Mandelbrot/Julian sets correctly.
|
||||
|
||||
|
||||
+1
-1
@@ -79,7 +79,7 @@ make all
|
||||
|
||||
### Original use:
|
||||
|
||||
```
|
||||
```sh
|
||||
./cdua
|
||||
```
|
||||
|
||||
|
||||
@@ -33,15 +33,17 @@ make all
|
||||
You might consider giving the following input:
|
||||
|
||||
```
|
||||
... a male (who) gets very, very frustrated sitting in a chair all
|
||||
the time because males are biologically driven to go out and hunt
|
||||
giraffes.
|
||||
-- Adjunct Professor Newt Gingrich, Reinhardt College, 1/7/95
|
||||
... a male (who) gets very, very frustrated sitting in a chair all
|
||||
the time because males are biologically driven to go out and hunt
|
||||
giraffes.
|
||||
-- Adjunct Professor Newt Gingrich, Reinhardt College, 1/7/95
|
||||
```
|
||||
|
||||
... which can be done like:
|
||||
|
||||
./dodsond1 < try.this.txt
|
||||
```c
|
||||
./dodsond1 < try.this.txt
|
||||
```
|
||||
|
||||
|
||||
## Author's remarks:
|
||||
|
||||
+9
-7
@@ -60,13 +60,15 @@ three-digit code. This is the algorithm:
|
||||
|
||||
These are the codes:
|
||||
|
||||
0 = A, E, H, I, O, U, W, Y
|
||||
1 = B, P, F, V
|
||||
2 = C, S, G, J, K, Q, X, Z
|
||||
3 = D, T
|
||||
4 = L
|
||||
5 = M, N
|
||||
6 = R
|
||||
```
|
||||
0 = A, E, H, I, O, U, W, Y
|
||||
1 = B, P, F, V
|
||||
2 = C, S, G, J, K, Q, X, Z
|
||||
3 = D, T
|
||||
4 = L
|
||||
5 = M, N
|
||||
6 = R
|
||||
```
|
||||
|
||||
### information about an info file:
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# Best Utility
|
||||
|
||||
Garry Glendown
|
||||
Germany
|
||||
Garry Glendown\
|
||||
Germany\
|
||||
<https://web.archive.org/web/20011221120305/http://insider.regio.net/~garry/>
|
||||
|
||||
|
||||
@@ -22,7 +22,6 @@ make all
|
||||
### Try:
|
||||
|
||||
```sh
|
||||
|
||||
./garry.test.sh
|
||||
|
||||
./garry < README.md
|
||||
@@ -54,7 +53,6 @@ make alt
|
||||
### Alternate try:
|
||||
|
||||
```sh
|
||||
|
||||
GARRY=garry.alt ./garry.test.sh
|
||||
|
||||
./garry.alt < README.md
|
||||
|
||||
+1
-2
@@ -33,7 +33,7 @@ See the author's information below on these details.
|
||||
If you don't have gs or an equivalent postscript viewer, try:
|
||||
|
||||
```sh
|
||||
echo "" | ./leo 1 > foo.ps
|
||||
echo "" | ./leo 1 > foo.ps
|
||||
```
|
||||
|
||||
and send foo.ps to your local postscript printer or open it in an appropriate
|
||||
@@ -193,7 +193,6 @@ the opening for step 1 is not a single line but a cross:
|
||||
```
|
||||
\./
|
||||
/ \
|
||||
\
|
||||
```
|
||||
|
||||
To watch it repeatedly (as a screensaver), use:
|
||||
|
||||
@@ -32,7 +32,9 @@ Can you figure out how it does it?
|
||||
This program takes no arguments. It emits the base 8 representation
|
||||
of prime palindromes (palindromic in base 8, of course).
|
||||
|
||||
`^_^`
|
||||
```
|
||||
^_^
|
||||
```
|
||||
|
||||
|
||||
## Copyright and CC BY-SA 4.0 License:
|
||||
|
||||
@@ -53,7 +53,9 @@ containing 1000 buckets of 4-digit integers. To further confuse
|
||||
matters, the buckets are arranged backwards in the block. For example,
|
||||
the number 8347108947139478934713847134 is represented as:
|
||||
|
||||
7134 1384 9347 3947 9471 7108 834
|
||||
```
|
||||
7134 1384 9347 3947 9471 7108 834
|
||||
```
|
||||
|
||||
### Platform limitations
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ University of Oslo\
|
||||
Gaustadveien 10B\
|
||||
N 0372 Oslo\
|
||||
Norway\
|
||||
http://www.uio.no/~jonth/
|
||||
<http://www.uio.no/~jonth/>
|
||||
|
||||
|
||||
## To build:
|
||||
|
||||
+4
-3
@@ -62,14 +62,15 @@ meets and actually exceeds specification."
|
||||
|
||||
#### The Program Metrics Argument:
|
||||
|
||||
"The program source is less than 3,100 characters in length and uncompresses
|
||||
file
|
||||
"The program source is less than 3,100 characters in length and uncompresses file
|
||||
[emacs-19.34b.tar.gz](https://ftp.gnu.org/old-gnu/emacs/emacs-19.34b.tar.gz) in
|
||||
about 130 seconds on my HP 9000/735. The now obsolete source file `inflate.c'
|
||||
from the GNU gzip source tree is 31,613 characters in length and uncompresses
|
||||
the emacs distribution file in slightly under 25 seconds. Thus:
|
||||
|
||||
3100 / 130 = 23.85 -vs- 31613 / 25 = 1264.52
|
||||
```
|
||||
3100 / 130 = 23.85 -vs- 31613 / 25 = 1264.52
|
||||
```
|
||||
|
||||
which represents a better than 530% improvement in the ratio of
|
||||
source file size to execution time."
|
||||
|
||||
@@ -48,7 +48,6 @@ The author also suggests:
|
||||
|
||||
```sh
|
||||
while :; do grep -v '#' schweikh2.c; done
|
||||
|
||||
```
|
||||
|
||||
(and we do too) which works with `sh`, `bash`, `ksh` and `zsh` as well.
|
||||
@@ -143,12 +142,12 @@ minutes (`gcc -O3`).
|
||||
### Sample arguments:
|
||||
|
||||
```sh
|
||||
$ ./schweikh2 6
|
||||
$ ./schweikh2 7 0
|
||||
$ ./schweikh2 7 7 0\
|
||||
$ ./schweikh2 8 9 -1 -67/21
|
||||
$ ./schweikh2 8 2 2/5 -98/25
|
||||
$ ./schweikh2 2 1/0 1 1/0
|
||||
./schweikh2 6
|
||||
./schweikh2 7 0
|
||||
./schweikh2 7 7 0
|
||||
./schweikh2 8 9 -1 -67/21
|
||||
./schweikh2 8 2 2/5 -98/25
|
||||
./schweikh2 2 1/0 1 1/0
|
||||
```
|
||||
|
||||
### Miscellaneous
|
||||
@@ -157,7 +156,7 @@ The diamond pattern can be continued without a break.\
|
||||
For a nice printout try this on your Bourne compatible shell:
|
||||
|
||||
```sh
|
||||
% while :; do grep -v '#' schweikh2.c; done
|
||||
while :; do grep -v '#' schweikh2.c; done
|
||||
```
|
||||
|
||||
|
||||
|
||||
@@ -46,9 +46,9 @@ and thanks for the virtual memories! :-)
|
||||
NOTE: On some systems such as SunOS, one may need to compile with:
|
||||
|
||||
```make
|
||||
${CC} ${CFLAGS} \
|
||||
-I. -D_POSIX_SOURCE '-Ddifftime(a,b)=(double)(b-a)' \
|
||||
schweikh3.c -o schweikh3
|
||||
${CC} ${CFLAGS} \
|
||||
-I. -D_POSIX_SOURCE '-Ddifftime(a,b)=(double)(b-a)' \
|
||||
schweikh3.c -o schweikh3
|
||||
```
|
||||
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
David Lowe\
|
||||
US\
|
||||
<j.david.lowe@gmail.com>
|
||||
<j.david.lowe@gmail.com>\
|
||||
<https://github.com/dlowe>
|
||||
|
||||
|
||||
|
||||
@@ -47,9 +47,11 @@ Pressing `d` drops the current letter onto the board.
|
||||
Read the authors' remarks below to find out how to play. We believe that your
|
||||
experience may mirror one of our experiences:
|
||||
|
||||
> Originally, I didn't appreciate the game. Then I actually read the
|
||||
> description of the controls. I started playing. I struggled.
|
||||
> I spelled my first "poot". I was hooked ...
|
||||
```
|
||||
Originally, I didn't appreciate the game. Then I actually read the
|
||||
description of the controls. I started playing. I struggled.
|
||||
I spelled my first "poot". I was hooked ...
|
||||
```
|
||||
|
||||
|
||||
## Author's remarks:
|
||||
@@ -69,7 +71,7 @@ around the border of the playing board, and decide when and where to drop
|
||||
it into the board. Sound easy? Of course, there's a catch...
|
||||
|
||||
### Controls
|
||||
\
|
||||
|
||||
Only three controls:
|
||||
|
||||
'a' moves the current letter one position counterclockwise around
|
||||
@@ -160,7 +162,6 @@ places.
|
||||
|
||||
- Some way of quitting gracefully.
|
||||
|
||||
|
||||
Good Luck!
|
||||
|
||||
|
||||
|
||||
+10
-10
@@ -1,7 +1,7 @@
|
||||
# Most Obfuscated Translator
|
||||
|
||||
Tony Finch
|
||||
United Kingdom
|
||||
Tony Finch\
|
||||
United Kingdom\
|
||||
<https://dotat.at>
|
||||
|
||||
|
||||
@@ -179,24 +179,24 @@ couple of simple optimisations. For example, note that `K (a b)` is the
|
||||
same as `S (K a) (K b)`, because
|
||||
|
||||
```
|
||||
K (a b) x
|
||||
-> a b
|
||||
K (a b) x
|
||||
-> a b
|
||||
```
|
||||
|
||||
and
|
||||
|
||||
```
|
||||
S (K a) (K b) x
|
||||
-> K a x (K b x)
|
||||
-> a b
|
||||
S (K a) (K b) x
|
||||
-> K a x (K b x)
|
||||
-> a b
|
||||
```
|
||||
|
||||
Also, `S (K a) I` is the same as just `a` because
|
||||
|
||||
```
|
||||
S (K a) I x
|
||||
-> K a x (I x)
|
||||
-> a x
|
||||
S (K a) I x
|
||||
-> K a x (I x)
|
||||
-> a x
|
||||
```
|
||||
|
||||
The program simply reads a lambda expression from the standard input,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# Best Flow Control
|
||||
|
||||
Mark Schnitzius
|
||||
US
|
||||
Mark Schnitzius\
|
||||
US\
|
||||
<http://computronium.org/ioccc.html>
|
||||
|
||||
|
||||
|
||||
+20
-20
@@ -221,19 +221,19 @@ C compilers.
|
||||
must resemble one of the canonical forms, `"foo.h"` or `<bar.h>`.
|
||||
This lets us write things like
|
||||
|
||||
```c\
|
||||
#define HEADER "foo.h"
|
||||
#include HEADER
|
||||
```
|
||||
```c
|
||||
#define HEADER "foo.h"
|
||||
#include HEADER
|
||||
```
|
||||
|
||||
I could not find a compiler rejecting this. However, if we're
|
||||
torturing the preprocessor a little more, by using token pasting,
|
||||
at least one compiler falls over.
|
||||
|
||||
```c
|
||||
#define H(x) <st##x##.h>
|
||||
#include H(dio) /* expands to <stdio.h> */
|
||||
```
|
||||
```c
|
||||
#define H(x) <st##x##.h>
|
||||
#include H(dio) /* expands to <stdio.h> */
|
||||
```
|
||||
|
||||
is rejected by tcc version 4.1.2, the TenDRA compiler:
|
||||
```
|
||||
@@ -253,21 +253,21 @@ C compilers.
|
||||
ISO 6.8.4. ISO 6.1.4 defines string literals as s-char-sequences,
|
||||
which may include octal escape sequences. Let's look at
|
||||
|
||||
```c
|
||||
#include <stdio.h>
|
||||
#line 42 "foo\0bar"
|
||||
int main (void) {
|
||||
printf ("%s %d\n", __FILE__, (int)sizeof __FILE__);
|
||||
return 0;
|
||||
}
|
||||
```
|
||||
```c
|
||||
#include <stdio.h>
|
||||
#line 42 "foo\0bar"
|
||||
int main (void) {
|
||||
printf ("%s %d\n", __FILE__, (int)sizeof __FILE__);
|
||||
return 0;
|
||||
}
|
||||
```
|
||||
|
||||
This is supposed to output `'foo 8'`. Here's what happens in RL:
|
||||
|
||||
```
|
||||
foo 4 gcc 2.7.2.1, lcc
|
||||
foo\0bar 9 tcc 4.1.2, Sunsoft cc turn "\0" into "\\0", ugh!
|
||||
```
|
||||
```
|
||||
foo 4 gcc 2.7.2.1, lcc
|
||||
foo\0bar 9 tcc 4.1.2, Sunsoft cc turn "\0" into "\\0", ugh!
|
||||
```
|
||||
|
||||
(I have written a bug report for gcc. Newer versions and egcs are ok.)
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ make schweikh2
|
||||
|
||||
often produced an error of the form:
|
||||
|
||||
```
|
||||
```sh
|
||||
gcc -ansi schweikh2.alt.c -o schweikh2.alt
|
||||
as: Error: cca00NzV.s, line 58: Missing " at end of string
|
||||
"
|
||||
|
||||
@@ -5,8 +5,7 @@ Monash University, Melbourne, Australia\
|
||||
1/832 Blackburn Rd\
|
||||
Clayton, VIC 3168\
|
||||
Australia\
|
||||
<https://web.archive.org/web/20030212213342/http://byron.csse.monash.edu.au/realindex.html>\
|
||||
\
|
||||
<https://web.archive.org/web/20030212213342/http://byron.csse.monash.edu.au/realindex.html>
|
||||
|
||||
|
||||
## To build:
|
||||
@@ -56,7 +55,7 @@ Create a large reverse video xterm, say 200 columns wide and try:
|
||||
```
|
||||
|
||||
Produce an even smaller output:
|
||||
\
|
||||
|
||||
```sh
|
||||
./bmeyer -2 200 < lavabus.pgm > lavabus.glic2
|
||||
```
|
||||
@@ -114,6 +113,7 @@ The [Makefile](Makefile) defaults to `-O3` and no `asm()` call.
|
||||
|
||||
This program is called `GLICBAWLS`
|
||||
|
||||
|
||||
#### Function
|
||||
|
||||
`GLICBAWLS` stands for "Grey Level Image Compression By Adaptive Weighted Least
|
||||
@@ -197,15 +197,13 @@ considerably better. And don't even *think* about using it for
|
||||
so-called "artistic" images (i.e. anything that wasn't scanned
|
||||
from a photo or camera)....
|
||||
|
||||
### WARNING
|
||||
|
||||
### WARNING
|
||||
|
||||
`Glicball` is rather CPU and FPU intensive. Don't run it on anything slow.
|
||||
Things start to be usable around 300+MHz, with 600+ being highly desirable.
|
||||
|
||||
|
||||
|
||||
|
||||
### Compile Instructions
|
||||
|
||||
Unlike most compression program, `glicbawls` makes heavy use of
|
||||
|
||||
@@ -52,7 +52,9 @@ of the submitters hidden until all the prize winners have been selected.
|
||||
|
||||
### Usage
|
||||
|
||||
```
|
||||
./dlowe [file ...]
|
||||
```
|
||||
|
||||
### Synopsis
|
||||
|
||||
|
||||
@@ -4,8 +4,8 @@ Jari Arkko\
|
||||
Kauppalantie 25A7\
|
||||
02700 Kauniainen\
|
||||
Finland\
|
||||
<http://www.arkko.com>\
|
||||
\
|
||||
<http://www.arkko.com>
|
||||
|
||||
Jyrki Holopainen\
|
||||
Forsellesintie 1-3A10\
|
||||
02700 Kauniainen\
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Best Small Program
|
||||
|
||||
NATORI Shin
|
||||
NATORI Shin\
|
||||
Japan
|
||||
|
||||
|
||||
|
||||
@@ -129,13 +129,13 @@ from inside the monitor whilst standing on your head. In case of
|
||||
confusion, please consult the following chart (\*):
|
||||
|
||||
```
|
||||
N
|
||||
^
|
||||
|
|
||||
E <---+---> W
|
||||
|
|
||||
v
|
||||
S
|
||||
N
|
||||
^
|
||||
|
|
||||
E <---+---> W
|
||||
|
|
||||
v
|
||||
S
|
||||
```
|
||||
|
||||
(\*) Not to scale.
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
# Most Portable Output
|
||||
|
||||
Thaddaeus Frogley\
|
||||
UK\
|
||||
\
|
||||
UK
|
||||
|
||||
Gavin Buttimore\
|
||||
UK
|
||||
|
||||
|
||||
+5
-3
@@ -95,9 +95,11 @@ the `main()`, leaving the complexities of the C file elsewhere and making this
|
||||
source still acceptable to `make` and `sh`. The following modification to the
|
||||
last few lines will compile the IOCCC's famous [mkentry.c](mkentry.c).
|
||||
|
||||
.PHONY: /* true clean */\
|
||||
#undef true\
|
||||
#include "mkentry.c"
|
||||
```
|
||||
.PHONY: /* true clean */
|
||||
#undef true
|
||||
#include "mkentry.c"
|
||||
```
|
||||
|
||||
Ain't that useful?
|
||||
|
||||
|
||||
+13
-7
@@ -66,19 +66,25 @@ or by giving the C source to its standard input.
|
||||
|
||||
- Sample compilation and execution:
|
||||
|
||||
./bellard bellard.otccex.c 10
|
||||
```sh
|
||||
./bellard bellard.otccex.c 10
|
||||
```
|
||||
|
||||
- Self compilation:
|
||||
|
||||
./bellard bellard.c bellard.otccex.c 10
|
||||
```sh
|
||||
./bellard bellard.c bellard.otccex.c 10
|
||||
```
|
||||
|
||||
- Self compilation iterated...
|
||||
|
||||
./bellard bellard.c bellard.c bellard.otccex.c 10
|
||||
\
|
||||
An alternate syntax is to use it as a script interpreter: you can
|
||||
put `#!/usr/local/bin/otcc` at the beginning of your C source if
|
||||
you installed `otcc` at this place.
|
||||
```sh
|
||||
./bellard bellard.c bellard.c bellard.otccex.c 10
|
||||
```
|
||||
|
||||
An alternate syntax is to use it as a script interpreter: you can
|
||||
put `#!/usr/local/bin/otcc` at the beginning of your C source if
|
||||
you installed `otcc` at this place.
|
||||
|
||||
### Supported C language subset (read joint example [bellard.otccex.c](bellard.otccex.c) to have an introduction to `OTCC` dialect)
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
# Best Of Show
|
||||
|
||||
Jason Orendorff
|
||||
5 Buchanan St.
|
||||
Nashua, NH 03060
|
||||
US
|
||||
Jason Orendorff\
|
||||
5 Buchanan St.\
|
||||
Nashua, NH 03060\
|
||||
US\
|
||||
<http://jorendorff.blogspot.com>
|
||||
|
||||
|
||||
@@ -49,14 +49,13 @@ TED Shroyer came up with the idea that made it possible to hide all
|
||||
the text. Thanks, TED. You won. :)
|
||||
|
||||
```sh
|
||||
$ cc -o jason jason.c
|
||||
$ ./jason
|
||||
cc -o jason jason.c
|
||||
./jason
|
||||
you are in a maze of twisty little passages
|
||||
caves lead: left forward back
|
||||
you see
|
||||
a lamp
|
||||
> _
|
||||
|
||||
```
|
||||
|
||||
This program is a rather nostalgic little labyrinth game. Start
|
||||
|
||||
+22
-21
@@ -1,7 +1,7 @@
|
||||
# Best of Show
|
||||
|
||||
Nicolas Ollinger
|
||||
France
|
||||
Nicolas Ollinger\
|
||||
France\
|
||||
<https://www.univ-orleans.fr/lifo/Members/Nicolas.Ollinger/>
|
||||
|
||||
|
||||
@@ -80,35 +80,36 @@ Q: Are there types of entries that are submitted so frequently that the
|
||||
A: Yes, there are types of entries that show up over and over again.
|
||||
The guidelines say:
|
||||
|
||||
We tend to dislike programs that:
|
||||
are similar to previous winners
|
||||
```
|
||||
We tend to dislike programs that:
|
||||
are similar to previous winners
|
||||
|
||||
We like variety. However too often we see (please look at the winning
|
||||
examples given to be aware of the level of the competition):
|
||||
We like variety. However too often we see (please look at the winning
|
||||
examples given to be aware of the level of the competition):
|
||||
|
||||
(snip)
|
||||
|
||||
generating small primes (below is the list of all
|
||||
prime related winners)
|
||||
1985/august
|
||||
1988/applin
|
||||
1994/weisberg
|
||||
1995/makarios
|
||||
1996/dalbec
|
||||
2000/bellard
|
||||
generating small primes (below is the list of all prime related winners)
|
||||
|
||||
As you can see, just a list of primes (let alone small primes)
|
||||
does not cut it anymore.
|
||||
1985/august
|
||||
1988/applin
|
||||
1994/weisberg
|
||||
1995/makarios
|
||||
1996/dalbec
|
||||
2000/bellard
|
||||
|
||||
As you can see, just a list of primes (let alone small primes)
|
||||
does not cut it anymore.
|
||||
|
||||
(snip)
|
||||
|
||||
entries that use some complex state machine/table to print
|
||||
something
|
||||
entries that use some complex state machine/table to print something
|
||||
|
||||
1988/isaak
|
||||
1988/phillipps
|
||||
1988/isaak
|
||||
1988/phillipps
|
||||
|
||||
Unbeaten for 12 years and counting...
|
||||
Unbeaten for 12 years and counting...
|
||||
```
|
||||
|
||||
I think this is enough motivation for trying to submit a program which uses
|
||||
some complex state machine/table to generate small primes and print them.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# Best position-independent code
|
||||
|
||||
Brian Westley
|
||||
US
|
||||
Brian Westley\
|
||||
US\
|
||||
<http://www.westley.org>
|
||||
|
||||
|
||||
@@ -202,9 +202,11 @@ comment), there are technically `28!` different programs, or
|
||||
`304,888,344,611,713,860,501,504,000,000` different versions,
|
||||
all legal C.
|
||||
|
||||
```
|
||||
\* except in Florida voting machines
|
||||
|
||||
\*\* all cards must be face down, nine-edge first, of course.
|
||||
```
|
||||
|
||||
|
||||
## Copyright and CC BY-SA 4.0 License:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Best Graphic Game
|
||||
|
||||
John Williams
|
||||
John Williams\
|
||||
US
|
||||
|
||||
|
||||
|
||||
@@ -41,7 +41,6 @@ su
|
||||
Make a floppy with an ext2 filesystem (`mke2fs /dev/fd0` replacing `fd0` with
|
||||
whatever the floppy device is!), mount it under `/mnt/floppy` and then:
|
||||
|
||||
|
||||
```sh
|
||||
cp kernel fs.tar lilo.conf boot.b /mnt/floppy
|
||||
```
|
||||
@@ -175,7 +174,9 @@ Accesses to data in the string are made relative to the define `V`,
|
||||
so these may need updating as appropriate (`0x90200` is the address
|
||||
at which a Linux bootloader loads an x86 kernel image).
|
||||
|
||||
```
|
||||
\* ;-)
|
||||
```
|
||||
|
||||
|
||||
## Copyright and CC BY-SA 4.0 License:
|
||||
|
||||
@@ -186,12 +186,12 @@ style](https://wiki.c2.com/?OneTrueBraceStyle).
|
||||
|
||||
### Suggested IOCCC Categories
|
||||
|
||||
Best Utility
|
||||
Best Support
|
||||
Most Portable Package
|
||||
Most Likely to Cook Apache
|
||||
Best Interpretation of RFC 2616
|
||||
Winner of The Far Too Much Free Time Award
|
||||
* Best Utility
|
||||
* Best Support
|
||||
* Most Portable Package
|
||||
* Most Likely to Cook Apache
|
||||
* Best Interpretation of RFC 2616
|
||||
* Winner of The Far Too Much Free Time Award
|
||||
|
||||
|
||||
## Copyright and CC BY-SA 4.0 License:
|
||||
|
||||
+27
-15
@@ -135,37 +135,47 @@ numbers from 8 to 11.
|
||||
2. We know that [Euler
|
||||
characteristics](https://en.wikipedia.org/wiki/Euler_characteristic) is the number of "vertexes"
|
||||
|
||||
```
|
||||
#
|
||||
```
|
||||
|
||||
minus the number of "edges"
|
||||
minus the number of "edges"
|
||||
|
||||
```
|
||||
## # #. .#
|
||||
# .# #. ('.' must be empty)
|
||||
```
|
||||
|
||||
plus the number of "faces"
|
||||
plus the number of "faces"
|
||||
|
||||
```
|
||||
##
|
||||
##
|
||||
```
|
||||
|
||||
3. If we fill all these patterns to 2x2 squares,
|
||||
|
||||
```
|
||||
#? ## #? #. .# ##
|
||||
?? ?? #? .# #. ##
|
||||
+1 -1 -1 -1 -1 +1
|
||||
```
|
||||
|
||||
substitute all possible "values" of `?` and sum them up, we get that it is
|
||||
enough to calculate:
|
||||
substitute all possible "values" of `?` and sum them up, we get that it is
|
||||
enough to calculate:
|
||||
|
||||
```
|
||||
#. .# ##
|
||||
.. #. #.
|
||||
+1 -1 -1
|
||||
```
|
||||
|
||||
Note now it is simple and obfuscated enough to be used as
|
||||
a "magic trick".
|
||||
Note now it is simple and obfuscated enough to be used as
|
||||
a "magic trick".
|
||||
|
||||
4. I make a 16-character array; when indexed by 4-bit value which
|
||||
represents the 2x2 squares, it will return a number to add/subtract
|
||||
`{-1,0,+1}`
|
||||
represents the 2x2 squares, it will return a number to add/subtract
|
||||
`{-1,0,+1}`
|
||||
|
||||
5. We convert lines of input to bitmaps (`N-bit` integers). Additionally, it is
|
||||
heavily obfuscated by using negative numbers (two's complement). For example,
|
||||
@@ -180,14 +190,16 @@ we use 15-character string.)
|
||||
|
||||
7. Since the rule found in (3) did not produce any funny messages, I changed it until it did. (The `#` character to find vertexes is in the top right corner, not the top left one.) The following messages will also work instead of `has dirtiest IF`:
|
||||
|
||||
HighlandYachter
|
||||
TestDirtiestTen
|
||||
has lintiest IF
|
||||
TighterLaughter
|
||||
HustlerDaughter
|
||||
TighterDemoThen
|
||||
```
|
||||
HighlandYachter
|
||||
TestDirtiestTen
|
||||
has lintiest IF
|
||||
TighterLaughter
|
||||
HustlerDaughter
|
||||
TighterDemoThen
|
||||
```
|
||||
|
||||
They can be mixed, of course!
|
||||
They can be mixed, of course!
|
||||
|
||||
8. NOTE: item 8 was removed by the judges so as to not spoil the challenge of
|
||||
figuring how arguments can be used to alter the exit value.
|
||||
|
||||
@@ -40,12 +40,16 @@ This is a configurable banner-like program.
|
||||
|
||||
- To convert a character glyph into a data file:
|
||||
|
||||
./newbern char < some_nicely_shaped_text >> data_file
|
||||
```sh
|
||||
./newbern char < some_nicely_shaped_text >> data_file
|
||||
```
|
||||
|
||||
|
||||
- To print a string using glyphs from a data file:
|
||||
|
||||
./newbern data_file a_string
|
||||
```sh
|
||||
./newbern data_file a_string
|
||||
```
|
||||
|
||||
### Extra functionality
|
||||
|
||||
|
||||
@@ -307,7 +307,7 @@ What does this do?
|
||||
```sh
|
||||
./sykes pet.rom -1
|
||||
```
|
||||
\
|
||||
|
||||
Have fun!
|
||||
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
Michael Birken\
|
||||
US\
|
||||
<o__1 at hotmail dot com>
|
||||
<o__1@hotmail.com>
|
||||
|
||||
|
||||
## To build:
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
Szabolcs Borsanyi\
|
||||
United Kingdom\
|
||||
s.borsanyi at sussex dot ac dot uk
|
||||
<s.borsanyi@sussex.ac.uk>
|
||||
|
||||
|
||||
## To build:
|
||||
|
||||
+14
-6
@@ -1,7 +1,7 @@
|
||||
# Best Compiled Graphics
|
||||
|
||||
Maurizio Monge
|
||||
Italy
|
||||
Maurizio Monge\
|
||||
Italy\
|
||||
<maurizio.monge at gmail dot com>
|
||||
|
||||
|
||||
@@ -74,7 +74,9 @@ effort to work on both `i386` and `x86_64`. Portable it is! :)
|
||||
|
||||
1. Run:
|
||||
|
||||
./monge "z = 0" "z = z*z + c; Abs2(z) < 4"
|
||||
```
|
||||
./monge "z = 0" "z = z*z + c; Abs2(z) < 4"
|
||||
```
|
||||
|
||||
2. Keep clicking with left or right button to zoom in or out.
|
||||
|
||||
@@ -145,15 +147,21 @@ Here are a few examples of fractals you can draw:
|
||||
|
||||
- Newton-Mandelbrot:
|
||||
|
||||
./monge "z=0" "p=z; z=z-(z*z*z + (c-1)*z - c)/(3*z*z+c-1); Abs2(p-z) > 0.001"
|
||||
```
|
||||
./monge "z=0" "p=z; z=z-(z*z*z + (c-1)*z - c)/(3*z*z+c-1); Abs2(p-z) > 0.001"
|
||||
```
|
||||
|
||||
- Phoenix, Mandelbrot version:
|
||||
|
||||
./monge "z=0; q=0" "t=z; z=z*z+Re(c)+Im(c)*q; q=t; Abs2(z)<4"
|
||||
```
|
||||
./monge "z=0; q=0" "t=z; z=z*z+Re(c)+Im(c)*q; q=t; Abs2(z)<4"
|
||||
```
|
||||
|
||||
- Phoenix, Julia version for `c=0.56667-i*0.5`:
|
||||
|
||||
./monge "z=c; c=0.56667-i*0.5; q=0" "t=z; z=z*z+Re(c)+Im(c)*q; q=t; Abs2(z)<4"
|
||||
```
|
||||
./monge "z=c; c=0.56667-i*0.5; q=0" "t=z; z=z*z+Re(c)+Im(c)*q; q=t; Abs2(z)<4"
|
||||
```
|
||||
|
||||
### Compilation and portability
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# Best Abuse of Computation
|
||||
|
||||
Christopher Night
|
||||
US
|
||||
Christopher Night\
|
||||
US\
|
||||
<https://web.archive.org/web/20090415070532/https://www.people.fas.harvard.edu/~night>
|
||||
|
||||
|
||||
|
||||
+10
-6
@@ -42,15 +42,19 @@ time ./sykes1 19186
|
||||
This was done on a CentOS 7 server with `Intel(R) Core(TM) i9-9900K CPU @ 3.60GHz`
|
||||
with 16 cores (via HyperThreading):
|
||||
|
||||
real 7m48.287s
|
||||
user 7m48.223s
|
||||
sys 0m0.004s
|
||||
```
|
||||
real 7m48.287s
|
||||
user 7m48.223s
|
||||
sys 0m0.004s
|
||||
```
|
||||
|
||||
and done with macOS Ventura with the Max M1 chip:
|
||||
|
||||
real 8m26.466s
|
||||
user 8m23.134s
|
||||
sys 0m2.981s
|
||||
```
|
||||
real 8m26.466s
|
||||
user 8m23.134s
|
||||
sys 0m2.981s
|
||||
```
|
||||
|
||||
|
||||
## Judges' remarks:
|
||||
|
||||
@@ -112,9 +112,11 @@ that did not win were flushed to `/dev/null`.
|
||||
|
||||
The [earlystop.pl](earlystop.pl) tool wrote:
|
||||
|
||||
training 1 to 1001...
|
||||
training 1001 to 2001...
|
||||
prior error = 56.746974766043; current error = 58.095691135305
|
||||
```
|
||||
training 1 to 1001...
|
||||
training 1001 to 2001...
|
||||
prior error = 56.746974766043; current error = 58.095691135305
|
||||
```
|
||||
|
||||
The resulting `ioccc-winlose-trained.net` file was included in the
|
||||
[dlowe-aux-data.tar.bz2](dlowe-aux-data.tar.bz2) tarball.
|
||||
|
||||
@@ -61,8 +61,10 @@ a pipe. But what IS a pipe? This program tries to provide an answer.
|
||||
|
||||
Magritte's [test for pipes](http://en.wikipedia.org/wiki/The_Treachery_of_Images) is:
|
||||
|
||||
> The famous pipe. How people reproached me for it! And yet, could
|
||||
> you stuff my pipe? No, it's just a representation, is it not?
|
||||
```
|
||||
The famous pipe. How people reproached me for it! And yet, could
|
||||
you stuff my pipe? No, it's just a representation, is it not?
|
||||
```
|
||||
|
||||
Accordingly, this program only approves pipes which can be used for
|
||||
stuffing data.
|
||||
|
||||
@@ -61,7 +61,7 @@ Game of Life](http://en.wikipedia.org/wiki/Conway's_Game_of_Life):
|
||||
1
|
||||
.
|
||||
112
|
||||
\
|
||||
|
||||
1 X
|
||||
1 X
|
||||
3 XXX
|
||||
@@ -110,8 +110,8 @@ There are two solutions:
|
||||
|
||||
```
|
||||
11
|
||||
\
|
||||
1 X\
|
||||
|
||||
1 X
|
||||
1 X
|
||||
```
|
||||
|
||||
@@ -119,9 +119,9 @@ and
|
||||
|
||||
```
|
||||
11
|
||||
\
|
||||
|
||||
1 X
|
||||
1 X\
|
||||
1 X
|
||||
```
|
||||
|
||||
### Detail
|
||||
|
||||
@@ -52,7 +52,7 @@ This program ignores non-lower case letters.
|
||||
|
||||
### Obfuscation
|
||||
|
||||
* `for` is not used.\
|
||||
* `for` is not used.
|
||||
* A part of the program is encrypted.
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# Best way to lose a life
|
||||
|
||||
J. David Lowe\
|
||||
US
|
||||
US\
|
||||
<j.david.lowe@gmail.com>\
|
||||
<https://github.com/dlowe>
|
||||
|
||||
|
||||
+12
-7
@@ -1,7 +1,7 @@
|
||||
# Balanced use of obfuscation - Gold award
|
||||
|
||||
Adar Zeitak\
|
||||
<aa4z2@walla.co.il>
|
||||
Adar Zeitak\
|
||||
<aa4z2@walla.co.il>
|
||||
|
||||
|
||||
## To build:
|
||||
@@ -82,7 +82,9 @@ around it's position.
|
||||
* Ignores parenthesis inside strings or character constants, so no errors
|
||||
will be detected in the following line:
|
||||
|
||||
printf(")");
|
||||
```c
|
||||
printf(")");
|
||||
```
|
||||
|
||||
* Doesn't get confused by the [1984/anonymous](/1984/anonymous/anonymous.c) entry!
|
||||
|
||||
@@ -91,7 +93,9 @@ around it's position.
|
||||
* Escapes (e.g. `\"`) are ignored, so the following line will produce
|
||||
an error:
|
||||
|
||||
printf("\"");
|
||||
```c
|
||||
printf("\"");
|
||||
```
|
||||
|
||||
#### Obfuscation
|
||||
|
||||
@@ -125,9 +129,10 @@ only function calls, typecasts, array lookups and pointer operators.
|
||||
at least two bytes long.
|
||||
|
||||
* The program was tested on the following platforms:
|
||||
- Ubuntu 9.04 32-bit with GCC
|
||||
- Windows 7 32-bit with GCC
|
||||
- Windows 7 32-bit with OpenWatcom
|
||||
|
||||
- Ubuntu 9.04 32-bit with GCC
|
||||
- Windows 7 32-bit with GCC
|
||||
- Windows 7 32-bit with OpenWatcom
|
||||
|
||||
|
||||
## Copyright and CC BY-SA 4.0 License:
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# Best of show
|
||||
|
||||
Adrian Cable\
|
||||
<adrian.cable@gmail.com>\
|
||||
<adrian.cable@gmail.com>
|
||||
|
||||
|
||||
## To build:
|
||||
|
||||
@@ -57,9 +57,9 @@ straightforward bitmap comparison.
|
||||
|
||||
* LZ77-like compression for font and template data
|
||||
* tiny JPEG encoder
|
||||
* Zig-zag space-filling curve
|
||||
* Discrete cosine transform
|
||||
* JPEG Huffman encoding (cheating)
|
||||
* Zig-zag space-filling curve
|
||||
* Discrete cosine transform
|
||||
* JPEG Huffman encoding (cheating)
|
||||
|
||||
### Notes
|
||||
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
|
||||
Qiming Hou\
|
||||
<hqm03ster@gmail.com>\
|
||||
<http://www.houqiming.net>\
|
||||
<http://www.houqiming.net>
|
||||
|
||||
|
||||
## To build:
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
# Homage to a classic game
|
||||
|
||||
Sandro Maffiodo\
|
||||
<smaffer@gmail.com>\
|
||||
<http://www.assezeta.com/sandromaffiodo>
|
||||
Sandro Maffiodo\
|
||||
<smaffer@gmail.com>\
|
||||
<http://www.assezeta.com/sandromaffiodo>
|
||||
|
||||
|
||||
## To build:
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
# Most tweetable entry
|
||||
|
||||
Sandro Maffiodo\
|
||||
<smaffer@gmail.com>\
|
||||
<http://www.assezeta.com/sandromaffiodo>
|
||||
Sandro Maffiodo\
|
||||
<smaffer@gmail.com>\
|
||||
<http://www.assezeta.com/sandromaffiodo>
|
||||
|
||||
|
||||
## To build:
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# Most likely to succeed
|
||||
|
||||
Yves-Marie Morgan\
|
||||
<yves-marie.morgan@parrot.com>
|
||||
Yves-Marie Morgan\
|
||||
<yves-marie.morgan@parrot.com>
|
||||
|
||||
|
||||
## To build:
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
# Best choice of optimization
|
||||
|
||||
Don Yang\
|
||||
<omoikane@uguu.org>\
|
||||
<http://uguu.org/>
|
||||
Don Yang\
|
||||
<omoikane@uguu.org>\
|
||||
<http://uguu.org/>
|
||||
|
||||
|
||||
## To build:
|
||||
|
||||
+50
-50
@@ -1,8 +1,8 @@
|
||||
# Most dynamic
|
||||
|
||||
Cel Skeggs\
|
||||
<ioccc@celskeggs.com>\
|
||||
<http://www.celskeggs.com>
|
||||
Cel Skeggs\
|
||||
<ioccc@celskeggs.com>\
|
||||
<http://www.celskeggs.com>
|
||||
|
||||
|
||||
## To build:
|
||||
@@ -79,29 +79,29 @@ The current size is a third to a half of the original size before compression.
|
||||
|
||||
Due to this, it does LOTS of things that subtly annoy compilers!
|
||||
|
||||
* (10) data argument not used by format string
|
||||
* (10) data argument not used by format string
|
||||
|
||||
This occurs because some of the fprintf invocations don't use all their
|
||||
parameters. The program should still work fine!
|
||||
This occurs because some of the fprintf invocations don't use all their
|
||||
parameters. The program should still work fine!
|
||||
|
||||
* (1) using the result of an assignment as a condition without parentheses
|
||||
* (1) using the result of an assignment as a condition without parentheses
|
||||
|
||||
Somewhere, I needed to set a variable and then branch on the result. The
|
||||
shortest way was to combine them. Some self-proclaimed "EXPERTS" think this
|
||||
is a bad programming practice, but what do they know? :P
|
||||
Somewhere, I needed to set a variable and then branch on the result. The
|
||||
shortest way was to combine them. Some self-proclaimed "EXPERTS" think this
|
||||
is a bad programming practice, but what do they know? :P
|
||||
|
||||
* (1) implicit declaration of function 'time' is invalid in C99
|
||||
* (1) implicit declaration of function 'time' is invalid in C99
|
||||
|
||||
An `#include` statement is expensive, and I'm broke.
|
||||
An `#include` statement is expensive, and I'm broke.
|
||||
|
||||
* (1) control may reach end of non-void function
|
||||
* (1) control may reach end of non-void function
|
||||
|
||||
Turns out that sometimes, a return statement is too much. This will never
|
||||
actually occur, but some C compilers think they know more about my program
|
||||
than I do! :P
|
||||
Turns out that sometimes, a return statement is too much. This will never
|
||||
actually occur, but some C compilers think they know more about my program
|
||||
than I do! :P
|
||||
|
||||
* (?) Under some systems, `-fPIC` is irrelevant for shared libraries. If so,
|
||||
you should remove it from the Makefile.
|
||||
* (?) Under some systems, `-fPIC` is irrelevant for shared libraries. If so,
|
||||
you should remove it from the Makefile.
|
||||
|
||||
## OBFUSCATION? WHAT OBFUSCATION? THIS IS A PERFECTLY NORMAL C PROGRAM!
|
||||
|
||||
@@ -180,56 +180,56 @@ This program is a very easy program to cause to fail!
|
||||
|
||||
Some things to check
|
||||
|
||||
* On line 16, where it says `%cinclude "prog.c"`, is `prog.c` the name of the
|
||||
original source code file?
|
||||
* Do you have ncurses installed?
|
||||
* Does your system have `ncurses.h` (like a nice system) or
|
||||
`ncurses/ncurses.h` (like a rude system) ?
|
||||
* On line 16, where it says `%cinclude "prog.c"`, is `prog.c` the name of the
|
||||
original source code file?
|
||||
* Do you have ncurses installed?
|
||||
* Does your system have `ncurses.h` (like a nice system) or
|
||||
`ncurses/ncurses.h` (like a rude system) ?
|
||||
|
||||
If it's the latter (or some other path), you'll need to update line 97.
|
||||
If it's the latter (or some other path), you'll need to update line 97.
|
||||
|
||||
(I had to do this under Cygwin.)
|
||||
* Does your system need `-fPIC` (or other arcane invocations) to compile a
|
||||
shared library? If so, make sure that you include it in the -DCC argument in
|
||||
the build script.
|
||||
* Does your system have a vague dislike for `-fPIC`? (Like Cygwin.) You might
|
||||
need to remove it from the build script.
|
||||
* Does your system support `__attribute__((constructor))`? It needs to.
|
||||
* Check the file `err`. Maybe it will help you figure out why a runtime-
|
||||
generated program failed. The failing program should be found in `t.c`.
|
||||
* Can't run a beautifier on the source code? I'm not going to help you there.
|
||||
(I had to do this under Cygwin.)
|
||||
* Does your system need `-fPIC` (or other arcane invocations) to compile a
|
||||
shared library? If so, make sure that you include it in the -DCC argument in
|
||||
the build script.
|
||||
* Does your system have a vague dislike for `-fPIC`? (Like Cygwin.) You might
|
||||
need to remove it from the build script.
|
||||
* Does your system support `__attribute__((constructor))`? It needs to.
|
||||
* Check the file `err`. Maybe it will help you figure out why a runtime-
|
||||
generated program failed. The failing program should be found in `t.c`.
|
||||
* Can't run a beautifier on the source code? I'm not going to help you there.
|
||||
|
||||
I've tested it on the following platforms, in case you need to try it on one:
|
||||
|
||||
* 64-bit Windows 7 32-bit Cygwin with gcc 4.8.2 and standards c89, c90, c99,
|
||||
and c11. Note that the program ran as 32-bit due to the version of cygwin.
|
||||
* 64-bit Arch Linux with gcc 4.9.1 and standards c89, c90, c99, c11.
|
||||
* 64-bit Arch Linux with clang 3.5.0 and standards c89 and c11.
|
||||
* 64-bit Windows 7 32-bit Cygwin with gcc 4.8.2 and standards c89, c90, c99,
|
||||
and c11. Note that the program ran as 32-bit due to the version of cygwin.
|
||||
* 64-bit Arch Linux with gcc 4.9.1 and standards c89, c90, c99, c11.
|
||||
* 64-bit Arch Linux with clang 3.5.0 and standards c89 and c11.
|
||||
|
||||
I ran out of time to test it on more systems.
|
||||
|
||||
### Q&A
|
||||
|
||||
* Who am I?
|
||||
* Who am I?
|
||||
|
||||
Yes.
|
||||
Yes.
|
||||
|
||||
* Why doesn't your program require a pet fish license?
|
||||
* Why doesn't your program require a pet fish license?
|
||||
|
||||
THE LEMONLORD's pet LEMONFISH was not rendered in the game, and so does not
|
||||
require a pet fish license.
|
||||
THE LEMONLORD's pet LEMONFISH was not rendered in the game, and so does not
|
||||
require a pet fish license.
|
||||
|
||||
* Was this inspired by anything?
|
||||
* Was this inspired by anything?
|
||||
|
||||
Yes, this was inspired by a minigame from an open-source codebase of Space
|
||||
Station 13. I didn't, however, look at the minigame at all during the
|
||||
development of this entry.
|
||||
Yes, this was inspired by a minigame from an open-source codebase of Space
|
||||
Station 13. I didn't, however, look at the minigame at all during the
|
||||
development of this entry.
|
||||
|
||||
* What's the length of this REMARKS file according to the iocccsize tool?
|
||||
* What's the length of this REMARKS file according to the iocccsize tool?
|
||||
|
||||
`$ ./iocccsize -i <REMARKS.MD`
|
||||
`$ ./iocccsize -i <REMARKS.MD`
|
||||
|
||||
`5092`
|
||||
`5092`
|
||||
|
||||
|
||||
## Copyright and CC BY-SA 4.0 License:
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# Most functional
|
||||
|
||||
Freek Wiedijk\
|
||||
<freek@cs.ru.nl>
|
||||
Freek Wiedijk\
|
||||
<freek@cs.ru.nl>
|
||||
|
||||
|
||||
## To build:
|
||||
@@ -51,8 +51,10 @@ If you win a bet by demonstrating this entry, please let us know.
|
||||
- recursion implemented through Curry's paradoxical combinator `Y`
|
||||
- the readable implementation of `Y` is on lines 29-30:
|
||||
|
||||
W_f = \x.f(xx)
|
||||
Y = \f.W_f W_f
|
||||
```
|
||||
W_f = \x.f(xx)
|
||||
Y = \f.W_f W_f
|
||||
```
|
||||
|
||||
- a mixture of strict and lazy evaluation, with a `_` force function
|
||||
(John Tromp notes that if Turing's fixed-point combinator
|
||||
|
||||
+10
-6
@@ -1,7 +1,8 @@
|
||||
# Most Useful
|
||||
|
||||
Dave Burton <ioccc@snox.net>
|
||||
<http://snox.net/ioccc>
|
||||
Dave Burton\
|
||||
<ioccc@snox.net>\
|
||||
<http://snox.net/ioccc>
|
||||
|
||||
|
||||
## To build:
|
||||
@@ -194,17 +195,20 @@ long`. Changing the two `long long` typedefs to `long`, and compiling with `gcc
|
||||
-m32` yields a program that operates on 32-bit values, with wrap-around of
|
||||
shifts mod 32:
|
||||
|
||||
1<<48
|
||||
65536 0x00010000
|
||||
```
|
||||
1<<48
|
||||
65536 0x00010000
|
||||
```
|
||||
|
||||
gcc 4.2.1 without arguments compiles cleanly (e.g. cc prog.c -o prog).
|
||||
This is my workaday compiler. gcc is also clean with -ansi, and -std=c99.
|
||||
|
||||
clang 3.6.0 lives up to its namesake, resounding on non-problems.
|
||||
To stifle these complaints:
|
||||
\
|
||||
-Wno-return-type -Wno-parentheses -Wno-empty-body
|
||||
|
||||
```
|
||||
-Wno-return-type -Wno-parentheses -Wno-empty-body
|
||||
```
|
||||
|
||||
When invoked with -ansi -pedantic, there are two warnings, which can be ignored:
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# Most Crafty
|
||||
|
||||
Gil Dogon\
|
||||
<http://sokoban-gild.com>
|
||||
Gil Dogon\
|
||||
<http://sokoban-gild.com>
|
||||
|
||||
|
||||
## To build:
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# Best Handwriting
|
||||
|
||||
Etienne Duble <etienne.duble@imag.fr>\
|
||||
<http://lig-membres.imag.fr/duble>
|
||||
Etienne Duble <etienne.duble@imag.fr>\
|
||||
<http://lig-membres.imag.fr/duble>
|
||||
|
||||
|
||||
## To build:
|
||||
@@ -161,7 +161,9 @@ macro `O_o` at the top of the source file.
|
||||
In order to comply with the size rule, I encoded only a part of the visible ASCII
|
||||
chars:
|
||||
|
||||
a-z, A-Z, '.' ':' ',' ';' '!' and '?'.
|
||||
```
|
||||
a-z, A-Z, '.' ':' ',' ';' '!' and '?'.
|
||||
```
|
||||
|
||||
Uppercase and lowercase chars are rendered the same. The program also understand
|
||||
the space and the linefeed (\n). Other chars are simply ignored (most of the
|
||||
|
||||
+11
-9
@@ -158,15 +158,17 @@ This specifies a color used for rendering.
|
||||
Some interesting parameters are included in `Makefile`. Do one of the following
|
||||
command and open `http://127.0.0.1:10333`.
|
||||
|
||||
$ make gray-scott-1 && tcpserver -v 127.0.0.1 10333 ./gray-scott-1 ioccc.txt
|
||||
$ make gray-scott-1 && tcpserver -v 127.0.0.1 10333 ./gray-scott-1 center.txt
|
||||
$ make gray-scott-1 && tcpserver -v 127.0.0.1 10333 ./gray-scott-1 line.txt
|
||||
$ make gray-scott-2 && tcpserver -v 127.0.0.1 10333 ./gray-scott-2 ioccc.txt
|
||||
$ make gray-scott-3 && tcpserver -v 127.0.0.1 10333 ./gray-scott-3 ioccc.txt
|
||||
$ make gray-scott-4 && tcpserver -v 127.0.0.1 10333 ./gray-scott-4 ioccc.txt
|
||||
$ make fitzhugh-nagumo-1 && tcpserver -v 127.0.0.1 10333 ./fitzhugh-nagumo-1 ioccc.txt
|
||||
$ make fitzhugh-nagumo-2 && tcpserver -v 127.0.0.1 10333 ./fitzhugh-nagumo-2 ioccc.txt
|
||||
$ make oregonator && tcpserver -v 127.0.0.1 10333 ./oregonator ioccc.txt
|
||||
```
|
||||
make gray-scott-1 && tcpserver -v 127.0.0.1 10333 ./gray-scott-1 ioccc.txt
|
||||
make gray-scott-1 && tcpserver -v 127.0.0.1 10333 ./gray-scott-1 center.txt
|
||||
make gray-scott-1 && tcpserver -v 127.0.0.1 10333 ./gray-scott-1 line.txt
|
||||
make gray-scott-2 && tcpserver -v 127.0.0.1 10333 ./gray-scott-2 ioccc.txt
|
||||
make gray-scott-3 && tcpserver -v 127.0.0.1 10333 ./gray-scott-3 ioccc.txt
|
||||
make gray-scott-4 && tcpserver -v 127.0.0.1 10333 ./gray-scott-4 ioccc.txt
|
||||
make fitzhugh-nagumo-1 && tcpserver -v 127.0.0.1 10333 ./fitzhugh-nagumo-1 ioccc.txt
|
||||
make fitzhugh-nagumo-2 && tcpserver -v 127.0.0.1 10333 ./fitzhugh-nagumo-2 ioccc.txt
|
||||
make oregonator && tcpserver -v 127.0.0.1 10333 ./oregonator ioccc.txt
|
||||
```
|
||||
|
||||
These examples are created by drawing (and modifying) the pattern files of
|
||||
[Ready](https://github.com/GollyGang/ready), a cross-platform implementation of
|
||||
|
||||
+14
-10
@@ -32,22 +32,24 @@ cat prog.c
|
||||
|
||||
At this point you might be wondering, [WTF](http://acronyms.thefreedictionary.com/WTF)?\*
|
||||
|
||||
* What The Freak (polite form)
|
||||
* What The Freak (polite form)
|
||||
|
||||
* What's This For? (you may be wondering)
|
||||
* What's This For? (you may be wondering)
|
||||
|
||||
* What the Fish (python form)
|
||||
* What the Fish (python form)
|
||||
|
||||
How is this code obfuscated? Well look again:
|
||||
|
||||
less prog.c
|
||||
```sh
|
||||
less prog.c
|
||||
|
||||
more prog.c
|
||||
more prog.c
|
||||
```
|
||||
|
||||
Where did those underscores come from? Well [RTFS](http://acronyms.thefreedictionary.com/RTFS)!\*\*
|
||||
|
||||
** Read the Freaking Source (polite form)
|
||||
** Read The Freakin' Screen (polite form)
|
||||
** Read the Freaking Source (polite form)
|
||||
** Read The Freakin' Screen (polite form)
|
||||
|
||||
If you are still puzzled, look at prog.c with your favorite text editor.
|
||||
|
||||
@@ -56,9 +58,11 @@ If you are still puzzled, look at prog.c with your favorite text editor.
|
||||
|
||||
**Follow this instruction literally!**
|
||||
|
||||
cat prog.c
|
||||
gcc -w -o prog prog.c
|
||||
./prog
|
||||
```sh
|
||||
cat prog.c
|
||||
gcc -w -o prog prog.c
|
||||
./prog
|
||||
```
|
||||
|
||||
You will do a double take.
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ More generally use:
|
||||
```sh
|
||||
cc -o prog prog.c foo.c
|
||||
./prog
|
||||
^C # if necessary, where ^C is ctrl-C, interrrupt
|
||||
^C # if necessary, where ^C is ctrl-C, interrrupt
|
||||
```
|
||||
|
||||
to run `prog` as whatever foo.c is in the joke PDP-11 emulator.
|
||||
|
||||
+10
-8
@@ -60,14 +60,16 @@ experiment with numbers that have more or larger factors?
|
||||
|
||||
Visual factorization 1-liner. Try:
|
||||
|
||||
gcc -o prog prog.c
|
||||
./prog @
|
||||
./prog @ @
|
||||
./prog @ @ @
|
||||
./prog @ @ @ @
|
||||
./prog @ @ @ @ @ @
|
||||
./prog @ @ @ @ @ @ @ @
|
||||
./prog @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @
|
||||
```sh
|
||||
gcc -o prog prog.c
|
||||
./prog @
|
||||
./prog @ @
|
||||
./prog @ @ @
|
||||
./prog @ @ @ @
|
||||
./prog @ @ @ @ @ @
|
||||
./prog @ @ @ @ @ @ @ @
|
||||
./prog @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @
|
||||
```
|
||||
|
||||
Inspired by [Animated Factorization
|
||||
Diagrams](http://www.datapointed.net/visualizations/math/factorization/animated-diagrams/).
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
# Most Well-rounded Hash
|
||||
|
||||
Qiming Hou <hqm03ster@gmail.com>\
|
||||
<http://www.houqiming.net/>
|
||||
Qiming Hou <hqm03ster@gmail.com>\
|
||||
<http://www.houqiming.net/>
|
||||
|
||||
|
||||
## To build:
|
||||
|
||||
+26
-25
@@ -38,39 +38,40 @@ make clobber all DW=199999 DW=22 DH=16 DA=50 DI=-150
|
||||
|
||||
From the Makefile:
|
||||
|
||||
```
|
||||
# Game parameters
|
||||
#
|
||||
DU=99999 # Time between steps in microseconds.
|
||||
# Make it larger if the game is too fast for you.
|
||||
|
||||
# Game parameters
|
||||
#
|
||||
DU=99999 # Time between steps in microseconds.
|
||||
# Make it larger if the game is too fast for you.
|
||||
DW=28 # Pipe-to-pipe spacing, in columns.
|
||||
# Farther apart is easier.
|
||||
|
||||
DW=28 # Pipe-to-pipe spacing, in columns.
|
||||
# Farther apart is easier.
|
||||
DD=20 # Space between pipes.
|
||||
# The difference between DD and DW is the width of a pipe.
|
||||
# Narrow pipes are easier to fly though.
|
||||
|
||||
DD=20 # Space between pipes.
|
||||
# The difference between DD and DW is the width of a pipe.
|
||||
# Narrow pipes are easier to fly though.
|
||||
DH=8 # Height of gap in pipe.
|
||||
# Make this larger to make the game easier.
|
||||
|
||||
DH=8 # Height of gap in pipe.
|
||||
# Make this larger to make the game easier.
|
||||
DA=100 # Acceleration due to gravity (scaled by 256).
|
||||
# Smaller values make you glide slower.
|
||||
|
||||
DA=100 # Acceleration due to gravity (scaled by 256).
|
||||
# Smaller values make you glide slower.
|
||||
DI=-200 # Impulse velocity of a flap (scaled by 256).
|
||||
# Make larger if you want an less intense tapping experience!
|
||||
|
||||
DI=-200 # Impulse velocity of a flap (scaled by 256).
|
||||
# Make larger if you want an less intense tapping experience!
|
||||
DB='"<o^="' # Sprite for player when gliding.
|
||||
# HINT: Try using various emoji.
|
||||
# NOTE: The string MUST be enclosed inside double quotes.
|
||||
|
||||
DB='"<o^="' # Sprite for player when gliding.
|
||||
# HINT: Try using various emoji.
|
||||
# NOTE: The string MUST be enclosed inside double quotes.
|
||||
DF='"<ov="' # Sprite for player when flapping.
|
||||
# HINT: Try using various emoji.
|
||||
# NOTE: The string MUST be enclosed inside double quotes.
|
||||
|
||||
DF='"<ov="' # Sprite for player when flapping.
|
||||
# HINT: Try using various emoji.
|
||||
# NOTE: The string MUST be enclosed inside double quotes.
|
||||
|
||||
DG='"Tap to Flap!"' # Instruction text.
|
||||
# Change to your native tongue.
|
||||
# NOTE: The string MUST be enclosed inside double quotes.
|
||||
DG='"Tap to Flap!"' # Instruction text.
|
||||
# Change to your native tongue.
|
||||
# NOTE: The string MUST be enclosed inside double quotes.
|
||||
```
|
||||
|
||||
Enjoy!
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Most Compact
|
||||
|
||||
Chris Mills
|
||||
Chris Mills
|
||||
|
||||
|
||||
## To build:
|
||||
|
||||
+14
-6
@@ -1,7 +1,7 @@
|
||||
# Most Complete Use of CPP
|
||||
|
||||
Dominik Muth\
|
||||
<muth.ioccc@freenet.de>
|
||||
Dominik Muth\
|
||||
<muth.ioccc@freenet.de>
|
||||
|
||||
|
||||
## To build:
|
||||
@@ -73,17 +73,23 @@ Implementing your own Turing machine is easy. Take a look at the supplied header
|
||||
|
||||
Every symbol used (except "`_`") must be explicitly declared using
|
||||
|
||||
#define sym_SYMBOL(sym, _SYMBOL) sym
|
||||
```c
|
||||
#define sym_SYMBOL(sym, _SYMBOL) sym
|
||||
```
|
||||
|
||||
Example:
|
||||
|
||||
#define sym_1(sym, _1) sym
|
||||
```c
|
||||
#define sym_1(sym, _1) sym
|
||||
```
|
||||
|
||||
#### Tape
|
||||
|
||||
The initial content of the tape must be defined in the tape header using a triple like:
|
||||
|
||||
#define tape ((((,),...l2), l1), c, (r1, (r2..., (,))))
|
||||
```c
|
||||
#define tape ((((,),...l2), l1), c, (r1, (r2..., (,))))
|
||||
```
|
||||
|
||||
- `l1`, `l2`, ... are the symbols to the left
|
||||
- `c` is the symbol at the current position
|
||||
@@ -110,7 +116,9 @@ There must be a state "`A`" defined, which becomes the initial state of the mach
|
||||
|
||||
To halt the machine, use the keyword "`break`" as in
|
||||
|
||||
#define A_1 (2, break)
|
||||
```c
|
||||
#define A_1 (2, break)
|
||||
```
|
||||
|
||||
|
||||
## Copyright and CC BY-SA 4.0 License:
|
||||
|
||||
+67
-57
@@ -1,7 +1,7 @@
|
||||
# Best Documented
|
||||
|
||||
Jens Schweikhardt\
|
||||
<http://www.schweikhardt.net>
|
||||
Jens Schweikhardt\
|
||||
<http://www.schweikhardt.net>
|
||||
|
||||
|
||||
## To build:
|
||||
@@ -229,6 +229,7 @@ the myriad of possible amino acids there are 23 from which proteins are
|
||||
built. In biochemistry, each is assigned a TLI (see [Proteinogenic amino
|
||||
acid](https://en.wikipedia.org/wiki/Proteinogenic_amino_acid)):
|
||||
|
||||
```
|
||||
ala Alanine
|
||||
cys Cysteine
|
||||
asp Aspartic acid
|
||||
@@ -255,15 +256,18 @@ acid](https://en.wikipedia.org/wiki/Proteinogenic_amino_acid)):
|
||||
glx Glutamic acid or Glutamine
|
||||
xle Leucine or Isoleucine
|
||||
unk Unknown
|
||||
``
|
||||
|
||||
My own research results complete this list (not yet in Wikipedia due to
|
||||
the rule "[No original
|
||||
research](https://en.wikipedia.org/wiki/Wikipedia:No_original_research)"):
|
||||
|
||||
```
|
||||
and Androgynine
|
||||
xor Xenoricine
|
||||
not Notanamine
|
||||
tla Triletramine
|
||||
```
|
||||
|
||||
Interestingly, the TLI are the perfect mnemonics for C language source.
|
||||
For example, `met` is "Main's Exit Type" (`int`), `ala` is "A Large
|
||||
@@ -460,31 +464,33 @@ Since the program frees all memory in all possible execution paths, even when
|
||||
it must bail out,
|
||||
valgrind should be happy. An early version of my program however reported this:
|
||||
|
||||
$ valgrind --leak-check=full --show-leak-kinds=all ./prog 6
|
||||
[...]
|
||||
==14615== HEAP SUMMARY:
|
||||
==14615== in use at exit: 4,096 bytes in 1 blocks
|
||||
==14615== total heap usage: 4 allocs, 3 frees, 4,108 bytes allocated
|
||||
==14615==
|
||||
==14615== 4,096 bytes in 1 blocks are still reachable in loss record 1 of 1
|
||||
==14615== at 0x4C236C0: malloc (in /usr/local/lib/valgrind/vgpreload_memcheck-amd64-freebsd.so)
|
||||
==14615== by 0x4F62175: ??? (in /lib/libc.so.7)
|
||||
==14615== by 0x4F62073: ??? (in /lib/libc.so.7)
|
||||
==14615== by 0x4F514EE: ??? (in /lib/libc.so.7)
|
||||
==14615== by 0x4F51265: vfprintf_l (in /lib/libc.so.7)
|
||||
==14615== by 0x4F3E001: printf (in /lib/libc.so.7)
|
||||
==14615== by 0x40101E: phe (in ./prog)
|
||||
==14615== by 0x400A9F: main (in ./prog)
|
||||
==14615==
|
||||
==14615== LEAK SUMMARY:
|
||||
==14615== definitely lost: 0 bytes in 0 blocks
|
||||
==14615== indirectly lost: 0 bytes in 0 blocks
|
||||
==14615== possibly lost: 0 bytes in 0 blocks
|
||||
==14615== still reachable: 4,096 bytes in 1 blocks
|
||||
==14615== suppressed: 0 bytes in 0 blocks
|
||||
==14615==
|
||||
==14615== For counts of detected and suppressed errors, rerun with: -v
|
||||
==14615== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
|
||||
```
|
||||
valgrind --leak-check=full --show-leak-kinds=all ./prog 6
|
||||
[...]
|
||||
==14615== HEAP SUMMARY:
|
||||
==14615== in use at exit: 4,096 bytes in 1 blocks
|
||||
==14615== total heap usage: 4 allocs, 3 frees, 4,108 bytes allocated
|
||||
==14615==
|
||||
==14615== 4,096 bytes in 1 blocks are still reachable in loss record 1 of 1
|
||||
==14615== at 0x4C236C0: malloc (in /usr/local/lib/valgrind/vgpreload_memcheck-amd64-freebsd.so)
|
||||
==14615== by 0x4F62175: ??? (in /lib/libc.so.7)
|
||||
==14615== by 0x4F62073: ??? (in /lib/libc.so.7)
|
||||
==14615== by 0x4F514EE: ??? (in /lib/libc.so.7)
|
||||
==14615== by 0x4F51265: vfprintf_l (in /lib/libc.so.7)
|
||||
==14615== by 0x4F3E001: printf (in /lib/libc.so.7)
|
||||
==14615== by 0x40101E: phe (in ./prog)
|
||||
==14615== by 0x400A9F: main (in ./prog)
|
||||
==14615==
|
||||
==14615== LEAK SUMMARY:
|
||||
==14615== definitely lost: 0 bytes in 0 blocks
|
||||
==14615== indirectly lost: 0 bytes in 0 blocks
|
||||
==14615== possibly lost: 0 bytes in 0 blocks
|
||||
==14615== still reachable: 4,096 bytes in 1 blocks
|
||||
==14615== suppressed: 0 bytes in 0 blocks
|
||||
==14615==
|
||||
==14615== For counts of detected and suppressed errors, rerun with: -v
|
||||
==14615== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
|
||||
```
|
||||
|
||||
From which I concluded that `printf` allocated a single 4K block for
|
||||
which no matching free existed. But how to free memory allocated deep
|
||||
@@ -499,30 +505,32 @@ of C99 7.19.5.1, "The fclose function", was encouraging:
|
||||
|
||||
So I `fclose(stdout)` before returning and now:
|
||||
|
||||
$ valgrind --leak-check=full --show-leak-kinds=all ./prog 6
|
||||
==14571== Memcheck, a memory error detector
|
||||
==14571== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
|
||||
==14571== Using Valgrind-3.10.0 and LibVEX; rerun with -h for copyright info
|
||||
==14571== Command: ./prog 6
|
||||
==14571==
|
||||
0000000000000006
|
||||
0000000000000003 1
|
||||
000000000000000A 2
|
||||
0000000000000005 3
|
||||
0000000000000010 4
|
||||
0000000000000008 5
|
||||
0000000000000004 6
|
||||
0000000000000002 7
|
||||
0000000000000001 8
|
||||
==14571==
|
||||
==14571== HEAP SUMMARY:
|
||||
==14571== in use at exit: 0 bytes in 0 blocks
|
||||
==14571== total heap usage: 4 allocs, 4 frees, 4,120 bytes allocated
|
||||
==14571==
|
||||
==14571== All heap blocks were freed -- no leaks are possible
|
||||
==14571==
|
||||
==14571== For counts of detected and suppressed errors, rerun with: -v
|
||||
==14571== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
|
||||
```
|
||||
valgrind --leak-check=full --show-leak-kinds=all ./prog 6
|
||||
==14571== Memcheck, a memory error detector
|
||||
==14571== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
|
||||
==14571== Using Valgrind-3.10.0 and LibVEX; rerun with -h for copyright info
|
||||
==14571== Command: ./prog 6
|
||||
==14571==
|
||||
0000000000000006
|
||||
0000000000000003 1
|
||||
000000000000000A 2
|
||||
0000000000000005 3
|
||||
0000000000000010 4
|
||||
0000000000000008 5
|
||||
0000000000000004 6
|
||||
0000000000000002 7
|
||||
0000000000000001 8
|
||||
==14571==
|
||||
==14571== HEAP SUMMARY:
|
||||
==14571== in use at exit: 0 bytes in 0 blocks
|
||||
==14571== total heap usage: 4 allocs, 4 frees, 4,120 bytes allocated
|
||||
==14571==
|
||||
==14571== All heap blocks were freed -- no leaks are possible
|
||||
==14571==
|
||||
==14571== For counts of detected and suppressed errors, rerun with: -v
|
||||
==14571== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
|
||||
```
|
||||
|
||||
A squeaky clean valgrind result!
|
||||
|
||||
@@ -532,10 +540,10 @@ FlexeLint is a commercial lint tool by [Gimpel
|
||||
Software](http://www.gimpel.com/html/index.htm). It supports nearly a
|
||||
thousand checks, broadly categorized into 4 levels,
|
||||
|
||||
1. Syntax errors only (messages 1 to 399)
|
||||
2. Warnings (messages 400 to 699)
|
||||
3. Informational messages (700 to 899)
|
||||
4. Elective notes (900 to 1000 and > 9000)
|
||||
1. Syntax errors only (messages 1 to 399)
|
||||
2. Warnings (messages 400 to 699)
|
||||
3. Informational messages (700 to 899)
|
||||
4. Elective notes (900 to 1000 and > 9000)
|
||||
|
||||
There is an [on-line
|
||||
demonstrator](http://www.gimpel-online.com/OnlineTesting.html) you can
|
||||
@@ -543,6 +551,7 @@ use for checking your C programs and I highly recommend trying it. For a start,
|
||||
paste the well know first program in the form and press "Analyze Code". Note
|
||||
the FlexeLint configuration options in comments (no space between `/*` and `lint`).
|
||||
|
||||
```c
|
||||
/*lint -w4 turn on everything */
|
||||
/*lint +esym(534,*) no demonstrator defaults */
|
||||
/*lint -e966 indirectly included header file not used */
|
||||
@@ -555,7 +564,7 @@ the FlexeLint configuration options in comments (no space between `/*` and `lint
|
||||
printf("hello, world\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
Possible checks include those for MISRA 2004 compliance verification.
|
||||
The [Motor Industry Software Reliability
|
||||
@@ -581,7 +590,7 @@ the remaining messages by addressing them or suppressing them in such a way
|
||||
that the set of suppressions was minimal. At the end of the day, this is
|
||||
what remained:
|
||||
|
||||
|
||||
```
|
||||
// === Tested with FlexeLint 9.00L on FreeBSD 11 ===
|
||||
// Compiler:
|
||||
// "4.2.1 Compatible FreeBSD Clang 3.6.1 (tags/RELEASE_361/final 237755)"
|
||||
@@ -643,6 +652,7 @@ what remained:
|
||||
-elib(9047) // FILE pointer dereferenced
|
||||
-esym(9058,__*) // tag not used outside typedef
|
||||
-e9092 // NULL does not expand to a pointer (but plain 0)
|
||||
```
|
||||
|
||||
### Compulsory obfuscations
|
||||
|
||||
|
||||
@@ -173,18 +173,24 @@ standards compliant). This is used to print the usage instructions.
|
||||
|
||||
Compiling using
|
||||
|
||||
gcc -Wall -Wextra -pedantic
|
||||
```sh
|
||||
gcc -Wall -Wextra -pedantic
|
||||
```
|
||||
|
||||
gives only `-Wmisleading-indentation` which is sensible considering the source code. While
|
||||
|
||||
clang -Wall -Wextra -pedantic
|
||||
```sh
|
||||
clang -Wall -Wextra -pedantic
|
||||
```
|
||||
|
||||
is a bit more pessimistic and gives `-Wempty-body` (I like loops without
|
||||
bodies), `-Wstring-plus-int` (since apparently some people think string+int is a
|
||||
concatenation) and one of the weirder warnings I have seen from me splitting a
|
||||
negative constant with whitespace. Compiling using
|
||||
|
||||
clang -Wall -Wextra -pedantic -Weverything
|
||||
```sh
|
||||
clang -Wall -Wextra -pedantic -Weverything
|
||||
```
|
||||
|
||||
produces a few page faults of warnings and makes me feel generally bad about
|
||||
myself. :(
|
||||
|
||||
Loaded 100 of 120 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user