Merge pull request #1531 from xexyl/sykes106

This commit is contained in:
Landon Curt Noll authored and GitHub committed 2023-11-24 13:20:10 -07:00
commit 3cfbcd7b38
24 files changed
+572 -146

No files matched your search

+21 -13
View File
@@ -5,6 +5,17 @@ make
``` ```
### Bugs and (Mis)features:
The current status of this entry is:
```
STATUS: uses gets() - change to fgets() if possible
```
For more detailed information see [2006 birken in bugs.md](/bugs.md#2006-birken).
## To use: ## To use:
```sh ```sh
@@ -15,10 +26,7 @@ make
### Try: ### Try:
```sh ```sh
./birken < counter.tofu ./try.sh
./birken < adder.tofu
./birken < buffer.tofu
./birken < computer.tofu
``` ```
etc. etc.
@@ -30,22 +38,22 @@ Q: EDAMAME?
A: Electronic Design Automation - Mechanical Abstract Machine Emulator A: Electronic Design Automation - Mechanical Abstract Machine Emulator
What is TUFO? It's not a veggy friendly food, nor it is Verilog or What is TOFU? It's not a veggie friendly food, nor it is
VHDL. It is not even Pascal! [Verilog](https://en.wikipedia.org/wiki/Verilog) or
[VHDL](https://en.wikipedia.org/wiki/VHDL) It is not even
[Pascal](https://en.wikipedia.org/wiki/Pascal_(programming_language))!
NOTE: On some systems, file(1) claims one of the .tofu files is Pascal NOTE: On some systems, `file(1)` claims one of the `.tofu` files is Pascal
source. :-) source. :-)
It may not be the most readable hardware description language, but it is It may not be the most readable hardware description language, but it is
one of the easiest 55 page long manual to learn. :-) one of the easiest 55 page long manuals to learn. :-)
For a small but non-trivial design, try implementing a For a small but non-trivial design, try implementing a
[Linear Feedback Shift Register](http://en.wikipedia.org/wiki/LFSR) [Linear Feedback Shift Register](http://en.wikipedia.org/wiki/LFSR)
And for those who are still confused: And for those who are still confused, see <http://en.wikipedia.org/wiki/Edamame>
and <http://en.wikipedia.org/wiki/Tofu>.
> <http://en.wikipedia.org/wiki/Edamame>
> <http://en.wikipedia.org/wiki/Tofu>
## Author's remarks: ## Author's remarks:
@@ -64,7 +72,7 @@ The primary obfuscation is the data structure chosen for parsing the
input file and for executing the simulation. Oh man... coding that input file and for executing the simulation. Oh man... coding that
data structure gave me such a bad headache. But, I figure, who needs data structure gave me such a bad headache. But, I figure, who needs
more than a pair anyway? Subtle obfuscations abound. Bonus points go more than a pair anyway? Subtle obfuscations abound. Bonus points go
out the one who discovers the hidden program within the source. out to the one who discovers the hidden program within the source.
Note that the shape of the source is a wave, not a waveform. Note that the shape of the source is a wave, not a waveform.
+68
View File
@@ -0,0 +1,68 @@
#!/usr/bin/env bash
#
# try.sh - demonstrate IOCCC winner 2006/birken
#
# make sure CC is set so that when we do make CC="$CC" it isn't empty. Doing it
# this way allows us to have the user specify a different compiler in an easy
# way.
if [[ -z "$CC" ]]; then
CC="cc"
fi
make CC="$CC" all >/dev/null || exit 1
# clear screen after compilation so that only the entry is shown
clear
read -r -n 1 -p "Press any key to run: ./birken < adder.tofu 2>/dev/null: "
./birken < adder.tofu 2>/dev/null
echo 1>&2
read -r -n 1 -p "Press any key to run: ./birken < buffer.tofu 2>/dev/null: "
./birken < buffer.tofu 2>/dev/null
echo 1>&2
echo "NOTE: the next one has longer output." 1>&2
read -r -n 1 -p "Press any key to run: ./birken < computer.tofu 2>/dev/null: "
./birken < computer.tofu 2>/dev/null
echo 1>&2
read -r -n 1 -p "Press any key to run: ./birken < counter.tofu 2>/dev/null: "
./birken < counter.tofu 2>/dev/null
echo 1>&2
read -r -n 1 -p "Press any key to run: ./birken < divider.tofu 2>/dev/null: "
./birken < divider.tofu 2>/dev/null
echo 1>&2
read -r -n 1 -p "Press any key to run: ./birken < lfsr.tofu 2>/dev/null: "
./birken < lfsr.tofu 2>/dev/null
echo 1>&2
read -r -n 1 -p "Press any key to run: ./birken < memory.tofu 2>/dev/null: "
./birken < memory.tofu 2>/dev/null
echo 1>&2
read -r -n 1 -p "Press any key to run: ./birken < multiplier.tofu 2>/dev/null: "
./birken < multiplier.tofu 2>/dev/null
echo 1>&2
read -r -n 1 -p "Press any key to run: ./birken < multiplier2.tofu 2>/dev/null: "
./birken < multiplier2.tofu 2>/dev/null
echo 1>&2
read -r -n 1 -p "Press any key to run: ./birken < oneline.tofu 2>/dev/null: "
./birken < oneline.tofu 2>/dev/null
echo 1>&2
read -r -n 1 -p "Press any key to run: ./birken < shift.tofu 2>/dev/null: "
./birken < shift.tofu 2>/dev/null
echo 1>&2
read -r -n 1 -p "Press any key to run: ./birken < zuse.tofu 2>/dev/null: "
./birken < zuse.tofu 2>/dev/null
echo 1>&2
read -r -n 1 -p "Press any key to run: ./birken < zuse2.tofu 2>/dev/null: "
./birken < zuse2.tofu 2>/dev/null
+20 -2
View File
@@ -5,6 +5,19 @@ make
``` ```
### Bugs and (Mis)features:
The current status of this entry is:
```
STATUS: INABIAF - please **DO NOT** fix
```
For more detailed information see [2006 borsanyi in bugs.md](/bugs.md#2006-borsanyi).
## To use: ## To use:
```sh ```sh
@@ -27,7 +40,7 @@ yourself! :-)
The resulting GIF file is likely to puzzle optical character The resulting GIF file is likely to puzzle optical character
recognition tools. The amount of imagination necessary to recognition tools. The amount of imagination necessary to
recognise the @ character will certainly challenge a few recognise the `@` character will certainly challenge a few
anti-CAPTCHA tools. anti-CAPTCHA tools.
@@ -50,6 +63,7 @@ line. To avoid complications with patent issues the [LZW
compression](https://en.wikipedia.org/wiki/Lempel-Ziv-Welch) feature is not compression](https://en.wikipedia.org/wiki/Lempel-Ziv-Welch) feature is not
used. A typical email address is stored in less than 1-2 kilobytes. used. A typical email address is stored in less than 1-2 kilobytes.
### Usage: ### Usage:
```sh ```sh
@@ -63,8 +77,10 @@ the characters: `a-z_A-Z0-9@.-`.
The program is (like email addresses are) case insensitive. The program is (like email addresses are) case insensitive.
### Obfuscation: ### Obfuscation:
Multicore support is a must in present-day applications. This Multicore support is a must in present-day applications. This
entry supports up to 25 cores. The odd names in the bottom entry supports up to 25 cores. The odd names in the bottom
part of the program do have a meaning, they are not there just part of the program do have a meaning, they are not there just
@@ -73,6 +89,7 @@ small, in fact, everything is a macro. Are you familiar with
the GIF format? Studying this program will give you a (very) the GIF format? Studying this program will give you a (very)
little insight. little insight.
### Questions: ### Questions:
After analyzing the source code, try to answer these questions: After analyzing the source code, try to answer these questions:
@@ -81,9 +98,10 @@ After analyzing the source code, try to answer these questions:
2. Can you alter the look of the output characters? 2. Can you alter the look of the output characters?
3. What limits the number of input characters to 42? 3. What limits the number of input characters to 42?
### Portability: ### Portability:
The program uses posix threads (using the linker flag `-lpthread`). The program uses POSIX threads (using the linker flag `-lpthread`).
The program accepts email addresses not longer than 42 bytes The program accepts email addresses not longer than 42 bytes
composed from letters, digits, and the `@._-` symbols. An address composed from letters, digits, and the `@._-` symbols. An address
not obeying these rules will cause undefined behaviour. The not obeying these rules will cause undefined behaviour. The
+3 -3
View File
@@ -15,7 +15,7 @@ make
### Try: ### Try:
```sh ```sh
./hamre '-1+4/3*(2+1/(3/2*(7/2-7/3+1/6)))/2' ./try.sh
``` ```
@@ -37,10 +37,10 @@ numbers](https://en.wikipedia.org/wiki/Rational_number). Believe it or not, that
is a useful tool to have around, and I haven't found a useful version, much less is a useful tool to have around, and I haven't found a useful version, much less
an obfuscated one. an obfuscated one.
It is rather feature complete as [rational calculators go. The It is rather feature complete as rational calculators go. The
supported operators are: `+`, `-` (binary and unary), `*`, `/` and `()`. Run it supported operators are: `+`, `-` (binary and unary), `*`, `/` and `()`. Run it
by supplying an expression as the first argument, and the normalized by supplying an expression as the first argument, and the normalized
result will be written to stdout. result will be written to `stdout`.
```sh ```sh
./hamre '-1+4/3*(2+1/(3/2*(7/2-7/3+1/6)))/2' ./hamre '-1+4/3*(2+1/(3/2*(7/2-7/3+1/6)))/2'
+58
View File
@@ -0,0 +1,58 @@
#!/usr/bin/env bash
#
# try.sh - demonstrate IOCCC winner 2006/hamre
#
# make sure CC is set so that when we do make CC="$CC" it isn't empty. Doing it
# this way allows us to have the user specify a different compiler in an easy
# way.
if [[ -z "$CC" ]]; then
CC="cc"
fi
make CC="$CC" all >/dev/null || exit 1
# clear screen after compilation so that only the entry is shown
clear
echo "$ ./hamre '-1*42/3*(42*42*42)/42'" 1>&2
./hamre '-1*42/3*(42*42*42)/42'
echo 1>&2
read -r -n 1 -p "Press any key to continue: "
echo "$ ./hamre '-1+4/3*(2+1/(3/2*(7/2-7/3+1/6)))/2'" 1>&2
./hamre '-1+4/3*(2+1/(3/2*(7/2-7/3+1/6)))/2'
echo 1>&2
read -r -n 1 -p "Press any key to continue: "
echo "$ ./hamre '1/0' 1>&2" 1>&2
./hamre '1/0' 1>&2
echo 1>&2
echo "...why did you not get an answer?" 1>&2
echo 1>&2
LIFE=12
UNIVERSE=15
EVERYTHING=15
read -r -n 1 -p "Press any key to continue: "
echo "For the next two notice how similar they are: why do they give different answers?" 1>&2
echo "$ LIFE=12; UNIVERSE=15; EVERYTHING=15; ./hamre \"\$LIFE/\$UNIVERSE/\$EVERYTHING\"" 1>&2
./hamre "$LIFE/$UNIVERSE/$EVERYTHING"
echo "$ LIFE=12; UNIVERSE=15; EVERYTHING=15; ./hamre \"\$LIFE / \$UNIVERSE / \$EVERYTHING\"" 1>&2
./hamre "$LIFE / $UNIVERSE / $EVERYTHING"
echo 1>&2
read -r -n 1 -p "Press any key to continue: "
echo "And why do these next two give different answers?" 1>&2
echo "$ LIFE=12; UNIVERSE=15; EVERYTHING=15; ./hamre \"\$LIFE + \$UNIVERSE + \$EVERYTHING\"" 1>&2
./hamre "$LIFE + $UNIVERSE + $EVERYTHING"
echo "$ LIFE=12; UNIVERSE=15; EVERYTHING=15; ./hamre \"\$LIFE+\$UNIVERSE+\$EVERYTHING\"" 1>&2
./hamre "$LIFE+$UNIVERSE+$EVERYTHING"
echo "As it turns out, \$LIFE+\$UNIVERSE+\$EVERYTHING == 42/1 == 42!" 1>&2
exit 0
+12 -8
View File
@@ -8,14 +8,14 @@ make
## To use: ## To use:
```sh ```sh
./meyer ./meyer [SEED]
``` ```
### Try: ### Try:
```sh ```sh
./meyer ./meyer [SEED]
``` ```
For your first input try: For your first input try:
@@ -24,9 +24,14 @@ For your first input try:
a 0 1 a 0 1
``` ```
where `a` is the row (`a`-`i`), `0` is the column (`0`-`8`) and `1` is the
number (`1`-`9`).
NOTE: if you do not input three different 'words' it will block. You can input NOTE: if you do not input three different 'words' it will block. You can input
more text to fulfil the program's requirements. more text to fulfil the program's requirements.
NOTE: if your move is invalid it will prompt you again but not show the board.
## Judges' remarks: ## Judges' remarks:
@@ -65,13 +70,13 @@ it is obvious, that object-oriented code isn't '`WYWIWID`' ('what
you write is what it does'). It may be tempting to think that you write is what it does'). It may be tempting to think that
``` ```
Object o; Object o;
``` ```
might do something similar as might do something similar as
```c ```c
struct not_an_object o; struct not_an_object o;
``` ```
But this program reveals that it doesn't. Even worse, this program only But this program reveals that it doesn't. Even worse, this program only
@@ -86,14 +91,13 @@ include:
- virtual method tables (all the virtual method tables have been combined to a - virtual method tables (all the virtual method tables have been combined to a
single [vtable](https://en.wikipedia.org/wiki/Virtual_method_table)). single [vtable](https://en.wikipedia.org/wiki/Virtual_method_table)).
- runtime method binding. - runtime method binding.
- - [inheritance](https://en.wikipedia.org/wiki/Inheritance_(object-oriented_programming))
[inheritance](https://en.wikipedia.org/wiki/Inheritance_(object-oriented_programming)) and [polymorphism](https://en.wikipedia.org/wiki/Polymorphism_(computer_science)).
and
[polymorphism](https://en.wikipedia.org/wiki/Polymorphism_(computer_science)).
It is left as an exercise to the reader to find a corresponding It is left as an exercise to the reader to find a corresponding
implementation in a popular object-oriented programming language. implementation in a popular object-oriented programming language.
### Starting the game ### Starting the game
```sh ```sh
+1
View File
@@ -1,3 +1,4 @@
monge monge
monge.alt
monge.orig monge.orig
prog.orig prog.orig
+6 -3
View File
@@ -42,7 +42,7 @@ CSILENCE= -Wno-bitwise-op-parentheses -Wno-conditional-type-mismatch \
-Wno-declaration-after-statement -Wno-dollar-in-identifier-extension \ -Wno-declaration-after-statement -Wno-dollar-in-identifier-extension \
-Wno-error -Wno-implicit-function-declaration \ -Wno-error -Wno-implicit-function-declaration \
-Wno-incompatible-pointer-types -Wno-int-conversion -Wno-parentheses \ -Wno-incompatible-pointer-types -Wno-int-conversion -Wno-parentheses \
-Wno-return-type -Wno-strict-prototypes -Wno-return-type -Wno-strict-prototypes -Wno-implicit-int
# Common C compiler warning flags # Common C compiler warning flags
# #
@@ -119,8 +119,8 @@ OBJ= ${PROG}.o
DATA= DATA=
TARGET= ${PROG} TARGET= ${PROG}
# #
ALT_OBJ= ALT_OBJ= ${PROG}.alt.o
ALT_TARGET= ALT_TARGET= ${PROG}.alt
################# #################
@@ -143,6 +143,9 @@ ${PROG}: ${PROG}.c
alt: data ${ALT_TARGET} alt: data ${ALT_TARGET}
@${TRUE} @${TRUE}
${PROG}.alt: ${PROG}.alt.c
${CC} ${CFLAGS} $< -o $@ ${LDFLAGS}
# data files # data files
# #
data: ${DATA} data: ${DATA}
+82 -21
View File
@@ -6,6 +6,9 @@ Make sure you have the SDL1 (not SDL2!) development environment installed.
make make
``` ```
There is alternate code that lets you redefine the width and height and number
of iterations to use. See [alternate code](#alternate-code) below.
### Bugs and (Mis)features: ### Bugs and (Mis)features:
@@ -42,6 +45,49 @@ That's not a bug, that's a feature.
``` ```
## Alternate code:
This alternate code lets you specify the width and height of the image as well
as the number of iterations to perform.
### Alternate build:
To use the default values, the same as [monge.c](monge.c), just do:
```sh
make alt
```
But if you wish to actually make use of it you will want to redefine one or more
of the variables `W`, `H` and `I`. The defaults are (respectively) 400, 300 and
\128. If you wish to change the image size to 500x500 but keep the iterations
the same then do:
```sh
make clobber CDEFINE="-DW=500 -DH=500" alt
```
If you wish to keep the dimensions the same but change the iterations to 512:
```sh
make clobber CDEFINE="-DI=512" alt
```
If you specify a value less than 1 for any of these it sets it back to the
default. The value 1 was selected arbitrarily and such a small number as 1 will
not do anything useful but as long as it's at least 1 it'll not be redefined.
Does not try taking care of overflows but such large values would be impractical
anyway.
### Alternate use:
Use `monge.alt` exactly as you would `monge` above.
## Judges' remarks: ## Judges' remarks:
For those who are familiar with the previous [IOCCC winners](/winners.html), For those who are familiar with the previous [IOCCC winners](/winners.html),
@@ -81,6 +127,7 @@ needed.
4. Enjoy, unless you're more interested in trying to understand how it works. :) 4. Enjoy, unless you're more interested in trying to understand how it works. :)
### Introduction ### Introduction
This is a fractal generator that supports custom formulas and real time zoom. This is a fractal generator that supports custom formulas and real time zoom.
@@ -103,68 +150,81 @@ as you like (as understood by the C function `isspace()`).
Supported operations and functions are: Supported operations and functions are:
```
Operation | Description Operation | Description
:-------- | :---------- :-------- | :----------
`+,-,*,/` | Arithmetic operations, priority of `*`,`/` over `+,-` is +,-,*,/ | Arithmetic operations, priority of * , / over +,- is
respected. | respected.
| |
`<,>` | Compares the real parts of two complex numbers (the imaginary part <,> | Compares the real parts of two complex numbers (the imaginary part
| is ignored). Any number of conditions is allowed, the iteration | is ignored). Any number of conditions is allowed, the iteration
| will just stop as soon as one of them fails. | will just stop as soon as one of them fails.
`Abs2` | Calculates the squared norm, i.e.: `Abs2(a+b*i)` is `(a*a+b*b)+0*i`. Abs2 | Calculates the squared norm, i.e.: Abs2(a+b*i) is (a*a+b*b)+0*i.
`Re` | Extract the real part, i.e.: `Re(a+b*i)` is `a+0*i`. Re | Extract the real part, i.e.: Re(a+b*i) is a+0*i.
`Im` | Extract the imaginary part, i.e.: `Im(a+b*i) is b+0*i`. Im | Extract the imaginary part, i.e.: Im(a+b*i) is b+0*i.
`Exp` | Calculates the complex exponential, i.e. `Exp(a+b*i)` is Exp | Calculates the complex exponential, i.e. Exp(a+b*i) is
| `e^a*(cos(b)+sin(b)*i)` | e^a*(cos(b)+sin(b)*i).
`Ln` | Calculates the principal value of the natural logarithm, i.e. Ln | Calculates the principal value of the natural logarithm, i.e.
`Ln(a+b*i)` is `ln(a*a+b*b)/2` + `atan(b/a)*i` Ln(a+b*i) is ln(a*a+b*b)/2 + atan(b/a)*i.
```
Here are a few examples of fractals you can draw: Here are a few examples of fractals you can draw:
- Mandelbrot: - Mandelbrot:
./monge "z=1" "z=z*z+c; Abs2(z)<4" ```sh
./monge "z=1" "z=z*z+c; Abs2(z)<4"
```
- Mandelbrot (return time variation): - Mandelbrot (return time variation):
./monge "z=c" "z=z*z+c; Abs2(z-c)>0.0001" ```sh
./monge "z=c" "z=z*z+c; Abs2(z-c)>0.0001"
```
- Julia, for `c=0.31+i*0.5`: - Julia, for `c=0.31+i*0.5`:
./monge "z=c; c=0.31+i*0.5" "z=z*z+c; Abs2(z)<4" ```sh
./monge "z=c; c=0.31+i*0.5" "z=z*z+c; Abs2(z)<4"
```
- Julia (return time variation), `for c=0.31+i*0.5`: - Julia (return time variation), `for c=0.31+i*0.5`:
./monge "z=c; c=0.31+i*0.5" "z=z*z+c; Abs2(z-c)>0.0001" ```sh
./monge "z=c; c=0.31+i*0.5" "z=z*z+c; Abs2(z-c)>0.0001"
```
- Newton, for `x^3-1`: - Newton, for `x^3-1`:
./monge "z=c" "p=z; z=0.6666*z+0.3333/(z*z); Abs2(p-z) > 0.001" ```sh
./monge "z=c" "p=z; z=0.6666*z+0.3333/(z*z); Abs2(p-z) > 0.001"
```
- Newton-Mandelbrot: - Newton-Mandelbrot:
``` ```sh
./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: - Phoenix, Mandelbrot version:
``` ```sh
./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`: - Phoenix, Julia version for `c=0.56667-i*0.5`:
``` ```sh
./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 ### Compilation and portability
This program will only work on x86 (with an x87 FPU) or x86_64 machines, This program will only work on x86 (with an x87 FPU) or x86_64 machines,
but it requires the SDL library. but it requires the SDL library.
Another system requirement is the `mmap()` function (as `#define`d at the Another system requirement is the `mmap(2)` function (as `#define`d at the
beginning of the program). If it is not available the macro `M(a)` will have to beginning of the program). If it is not available the macro `M(a)` will have to
be replaced with a system dependent function that allocates readable, writable be replaced with a system dependent function that allocates readable, writable
*AND* executable memory (it will not be possible to make this program run on *AND* executable memory (it will not be possible to make this program run on
@@ -186,17 +246,18 @@ changing the definitions of `W`, `H` and `I` at the beginning of the code.
- Many SDL identifiers are hardcoded as number, this is safe up to ABI - Many SDL identifiers are hardcoded as number, this is safe up to ABI
incompatibility. incompatibility.
- Better optimization could be done treating known real numbers as just one - Better optimization could be done treating known real numbers as just one
double, instead of adding a 0 imaginary part to treat them as complex `double`, instead of adding a 0 imaginary part to treat them as complex
numbers. numbers.
- There should be some way to switch from Mandelbrot to Julia with chosen - There should be some way to switch from Mandelbrot to Julia with chosen
parameter. parameter.
### Spoiler ### Spoiler
Sure, I don't want to deprive you of the pleasure of digging Sure, I don't want to deprive you of the pleasure of digging
into the infernal mess created by my corrupted mind (writing into the infernal mess created by my corrupted mind (writing
this remark I noticed that I was ending sentences with ';' instead this remark I noticed that I was ending sentences with ';' instead
that with '.', and I worried for my sanity), but just in case... of with '.', and I worried for my sanity), but just in case...
I used many obfuscation techniques, including a few ones that I used many obfuscation techniques, including a few ones that
are different from the tricks used in most common IOCCC program are different from the tricks used in most common IOCCC program
+79
View File
@@ -0,0 +1,79 @@
#include <stdlib.h>
#include <SDL.h>
#include <sys/mman.h>
#define M(a) mmap(0, a, PROT_EXEC|PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANON, -1, 0)
#ifndef W
#define W 400
#elif W < 1
#undef W
#define W 400
#endif
#ifndef H
#define H 300
#elif H < 1
#undef H
#define H 300
#endif
#ifndef I
#define I 128
#elif I < 1
#undef I
#define I 128
#endif
#define L char*
#define _ Sint32
#define h(a,b) for(a=0; a<b; a++)
#define O while(
#define b D[j][i][
#define J(b) a(#b)
SDL_Event
e;
SDL_Surface
*F; float f, m,
n,d,D[H][W][6],
v; L A; L X; L
V,G[H][W]; L
E ; L Q; double
R=2/( W-1. ),T=2/(H-1.),c,g, z=2 ,*
K,*Z,*S; _ B, C, o,i,j,q,k,l,x,y,*u,Y=512; P(
L f){ *(u=V)=f-X-5; V+=4; } a(L e){ O l=*e++)
l-38?l==36?s(2),o--:l-37?*V++=l==35?k=*e++
,k* 16+*e++-81:l^128:o>7?J(Yv]#JJ), P(S++):o++
:s(4); } s(_ n){ O o<n){ J(]#IB); P(--S); J(]);
*V ++=217+o++; } } p(L e,_ q,L *t){ _ x=9; do{ A="%]#IB"
; _ i =*e; 5==q?*K=strtod(e,t),e-*t?e=*t,a(A),P(K++), J(%Yn)
: i<6 ?p ( e+1,4,t),i-5||J(Y`YIY`YI), e=*t:i>96?a(A),P(Z+i-97),a
(A),P (Z+*e++-71) :(p(index( e, 40)+1,1,t), i^82?i^73?i^65?i^69?i^76?1:J
(%YhY`%YmY}]YYB%YBXHYIXH$^A$YqYJ$Ys):J(%Y{YJ%Yj^IY@Y|\\iYIYp%Yh$^AY}$]Y\\J$^I)
: J(XHYIXH^AYn):J(]YYn) : J (]XYn),e= index( *t,41 )+ 1): p ( e , q+ 1, &e); A
= "&%YCXJYLXIYK\\J$^I$^k$^A"; (x -=3)<1?J(&]X]Y),1L <<31<0? J(Zi_`#JO):J(_i]X),x
?J (#HH):J(#HC),J(#AD#IJPC) ,o-=4:--x?--x?--x?x-3?J(&%YA%YAXHYIXH^AYh$^q\\J$^IY`)
, a(A): 1:a(A):J(&$^j$^j):J(&$^B$^B); } O q==(x=*(*t=e++))/2); } main(_ r,L*U){
X =V=(Z =(S=(K=M(Y*32))+Y)+ Y)+Y; J(h#AA#AA#AA#AA#FJ:+-*/); h(q,2){ A =E =Q=U[ q+1]; O * A=*A^B++
[ ";<>+-*/" ]?*A:B,(B%=7)||(isspace(*E=*A)||++E,*A++)); E=V; O B=*Q){ if(Q[1]-61)p(
Q,1,&Q); else{ p(Q+2,1,&Q); h(j,2){ J(]#JJ); P(Z+B-71-j*26); o--; } } *Q&&Q++; }
} J(#PPJ#AP#IF); P (E -V+X +1); J(#IJPC); 0[u =X+7] =I; SDL_Init( 32 ); F=
SDL_SetVideoMode(W,H,8 ,0); A=F->pixels; B=F->pitch; O 1){ C^=3; h(j,H)h(i,
W )b C+2]=9; if(r=(k =SDL_GetMouseState(&x,&y))&5){ f=z/50; f=k&1 ?f:-f ;
c+=(x*T-T/R)*f; g += f*y*T-f; z*=f=1-f/z; v=1/f; h(j,H)h(i,W)h(q,4){ k=
x+(i- x)* f +q/2; l=y+(j-y)*f+q%2; if(k>=0&k<W&l>=0&l<H){ m=x+(k+D[
l][k ][ 3-C]-x)*v-i; n=y+( l+D[l][k][4 -C]-y)*v-j; d= m*m+ n*n;
if ( d<b C+2]){ b C]=m; b C+1]=n; b C+2]=d; G[j][i]=A[l*B+
k ]; } } } } h(j,H)h(i,W)if(q=b C+2]){ Z[2]=(i *T-T /
R)*z+c; Z[28]=z-j *T*z-g; Z[8]= 0; Z[34]=1; q =((_(*
)( ))X)(); A[j* B+i]=q? *u-q:0; h(q,3)b C+q]=0;
} else A[j*B+i]=G[j][i]; SDL_UpdateRect(F,
0,0,W,H); O(r?SDL_PollEvent:SDL_WaitEvent)(&e
)) { k=e.type; l=e.key.keysym.sym; if ( k==
12|k== 2& l ==27)return; if(
e.type-5?k==
2&(l==270|l==
269)?*u=l-270
? *u/2:*u*2:0:1
) break;
}
} }
+22 -25
View File
@@ -4,6 +4,9 @@
make make
``` ```
There is an alternate version that supports arrow keys. See the [alternate
code](#alternate-code) section below.
## To use: ## To use:
@@ -11,26 +14,23 @@ make
./night ./night
``` ```
There is an alternate version that supports arrow keys. See the alternate code
section below.
### Try:
```sh
echo "Do or do not. There is no try."
```
## Alternate code: ## Alternate code:
To compile: This version allows you to use arrow keys instead of the more awkward `wasd`
keys.
### Alternate build:
```sh ```sh
make alt make alt
``` ```
### Alternate use:
Use `night.alt` as you would `night` above. Use `night.alt` as you would `night` above.
@@ -41,22 +41,16 @@ algorithm](https://towardsdatascience.com/introduction-to-genetic-algorithms-inc
involved. Somewhere. But what does it do? Well, it might take you a while to involved. Somewhere. But what does it do? Well, it might take you a while to
navigate the results, let alone the code. navigate the results, let alone the code.
### Cheating
There is a nice way to cheat. If you don't want to figure it out you can look at
[Yusuke Endoh](/winners.html#Yusuke_Endoh)'s analysis of this entry at
(translation from Japanese so it's not perfect)
<https://mame-github-io.translate.goog/ioccc-ja-spoilers/2006/night.html?_x_tr_sl=auto&_x_tr_tl=en&_x_tr_hl=en-US&_x_tr_pto=wapp>.
## Author's remarks: ## Author's remarks:
Don't worry; this is not a self-reproducing program, as you might at Don't worry; this is not a self-reproducing program, as you might at
first guess from the layout. I would never be so foolhardy as to first guess from the layout. I would never be so foolhardy as to
submit an entry on an over-used theme! submit an entry on an overused theme!
Oh, wait a second... it is a maze-generating program. Oops! Oh, wait a second... it is a maze-generating program. Oops!
### What it does: ### What it does:
This program solves an optimization problem, namely, generating a challenging This program solves an optimization problem, namely, generating a challenging
@@ -86,6 +80,7 @@ Finally, in the world of DNA, the medium is truly the message. There's
a short message encoded in here that will only appear when you a short message encoded in here that will only appear when you
complete the optimal maze in the required 64 moves. complete the optimal maze in the required 64 moves.
### Issues: ### Issues:
These depend on your compiler, and they were all intentionally These depend on your compiler, and they were all intentionally
@@ -94,13 +89,14 @@ added for obfuscation purposes. No, really!
My compiler warns of nulls in a string literal, and the redefinition My compiler warns of nulls in a string literal, and the redefinition
of the macro `T`. of the macro `T`.
On one compiler, compilation took about two minutes. With one compiler, compilation took about two minutes.
`sizeof(unsigned short)` must be 2, and `sizeof(unsigned long)` must be 4. `sizeof(unsigned short)` must be 2, and `sizeof(unsigned long)` must be 4.
`CLOCKS_PER_SEC` is assumed to be `1000000`. If it's a lot less than that, `CLOCKS_PER_SEC` is assumed to be `1000000`. If it's a lot less than that,
expect delays. expect delays.
### Algorithmic obfuscation: ### Algorithmic obfuscation:
The representation of the maze layout in a 32-bit integer type is The representation of the maze layout in a 32-bit integer type is
@@ -113,6 +109,7 @@ The recursive function `CGAC()` replaces a nested for loop in a handy way.
The maze-solving function `TGA()` returns no solution both if no solution The maze-solving function `TGA()` returns no solution both if no solution
exists, and if the search space grows too large, with a single test. exists, and if the search space grows too large, with a single test.
### Stylistic obfuscation: ### Stylistic obfuscation:
Four-letter alphabets are confusing. I don't know how Four-letter alphabets are confusing. I don't know how
@@ -124,11 +121,11 @@ Who needs `!=` when you've got `^`?
Who needs `if` when you've got `while`? Who needs `if` when you've got `while`?
For that matter, who needs fixed-iteration-count for and while when For that matter, who needs fixed-iteration-count `for` and `while` when you can
you can just duplicate code with the preprocessor? Duplication by this just duplicate code with the preprocessor? Duplication by this macro causes one
macro causes one particular graphics line to be replicated 512 particular graphics line to be replicated 512 times. On my system the
times. On my system the preprocessed code is over 80KB in length, preprocessed code is over 80KB in length, hindering the preprocessor's ability
hindering the preprocessor's ability to deobfuscate. to deobfuscate.
Keypad support was removed to save space. To restore, modify the Keypad support was removed to save space. To restore, modify the
following two macros to: following two macros to:
+1 -1
View File
@@ -59,7 +59,7 @@ ARCH=
# Defines that are needed to compile # Defines that are needed to compile
# #
CDEFINE= -DS=65000 CDEFINE= -DS=75000
# Include files that are needed to compile # Include files that are needed to compile
# #
+7 -5
View File
@@ -20,7 +20,7 @@ see the [original code](#original-code) section.
This alternate version, which we recommend that you use in order to see what is This alternate version, which we recommend that you use in order to see what is
happening with modern systems, and to not flash too quickly, which can be happening with modern systems, and to not flash too quickly, which can be
problematic for some people, can be configured to different speeds by way of the problematic for some people, can be configured to different speeds by way of the
value used in `usleep()`. The default is `-DS=65000` but you can easily change value used in `usleep()`. The default is `-DS=75000` but you can easily change
it. To do so try: it. To do so try:
```sh ```sh
@@ -73,13 +73,13 @@ at first blush, this looks like a self-reproducing program.
## Author's remarks: ## Author's remarks:
This program doesn't require any special build options, other than that it This program doesn't require any special build options, other than that it
uses `sin()` and `cos()` and hence requires the math library. uses `sin(3)` and `cos(3)` and hence requires the math library.
You will almost certainly get a compiler warning because I declared a bunch You will almost certainly get a compiler warning because I declared a bunch
of global ints without types. The code looks better this way, though, I of global `int`s without types. The code looks better this way, though, I
think. There are also no `#include`s, so there may be warnings for think. There are also no `#include`s, so there may be warnings for
undeclared references to `printf()`, etc. There's a chance that my failure to undeclared references to `printf(3)`, etc. There's a chance that my failure to
include `math.h` or declare `sin()` or `cos()` will make the include `math.h` or declare `sin(3)` or `cos(3)` will make the
[donut](https://en.wikipedia.org/wiki/Doughnut) not render [donut](https://en.wikipedia.org/wiki/Doughnut) not render
properly -- it's worked on every system I've tried so far though. properly -- it's worked on every system I've tried so far though.
@@ -98,6 +98,7 @@ escape codes for clearing the screen and moving the cursor back to the top-left.
The donut isn't raytraced. It's much simpler than that. The donut isn't raytraced. It's much simpler than that.
### How is it obfuscated? ### How is it obfuscated?
There are three main pieces to this program: the donut, the checkerboard, and There are three main pieces to this program: the donut, the checkerboard, and
@@ -109,6 +110,7 @@ into the smallest I could make it by any means necessary.
The logo can actually be compressed much better (ironically, by doing The logo can actually be compressed much better (ironically, by doing
something simpler), but I didn't discover this until well after submitting. something simpler), but I didn't discover this until well after submitting.
### Puzzles ### Puzzles
In increasing order of difficulty: In increasing order of difficulty:
+2 -2
View File
@@ -1,6 +1,6 @@
stewart stewart
stewart.html stewart.html
maze.xbm *.xbm
maze.png *.png
stewart.orig stewart.orig
prog.orig prog.orig
+56 -39
View File
@@ -12,6 +12,16 @@ make
convert file.xbm file.png convert file.xbm file.png
``` ```
where `file` is one of:
```
altar box box2 box3 build carpet circles cross cross2 cross3
crystal curve diamonds diamonds2 dragon dragon2 dragon3
fern gasket gasket_mod gasket_mod2 ioccc maze octagon
pentagon pentagons rings rings2 spirals spirals2 spirals3
spirals4 squares stars stars2 tree tree2 tree3 tree4 triangle
```
NOTE: you cannot specify a different width from height; it's one number. NOTE: you cannot specify a different width from height; it's one number.
NOTE: `convert(1)` belongs to [ImageMagick](https://imagemagick.org/index.php). NOTE: `convert(1)` belongs to [ImageMagick](https://imagemagick.org/index.php).
@@ -20,17 +30,17 @@ NOTE: `convert(1)` belongs to [ImageMagick](https://imagemagick.org/index.php).
### Try: ### Try:
```sh ```sh
./stewart 400 1000000 maze > maze.xbm\ ./stewart 400 1000000 maze > maze.xbm
convert maze.xbm maze.png convert maze.xbm maze.png
./stewart 1024 1000000 gasket > gasket.xbm
convert gasket.xbm gasket.png
./stewart 1024 1500000 dragon3 > dragon3.xbm
convert dragon3.xbm dragon3.png
``` ```
where `FILE` is one of: Now open the images in your favourite graphics viewer or a web browser.
altar box box2 box3 build carpet circles cross cross2 cross3
crystal curve diamonds diamonds2 dragon dragon2 dragon3
fern gasket gasket_mod gasket_mod2 ioccc maze octagon
pentagon pentagons rings rings2 spirals spirals2 spirals3
spirals4 squares stars stars2 tree tree2 tree3 tree4 triangle
## Judges' remarks: ## Judges' remarks:
@@ -47,19 +57,24 @@ a reasonably experienced user who can parse formats in their mind. :-)
The program should be run with the following The program should be run with the following
``` ```sh
./stewart <m> <n> <ifs> ./stewart <m> <n> <ifs>
m = The size of the picture (picture will be m X m in size).
n = The number of iterations to run (More will make for a
clearer picture).
ifs = The file to use as input.
``` ```
The program will spit out a [XBM image](https://en.wikipedia.org/wiki/X_BitMap) on standard out. where:
Minimal checking is done on the arguments mainly that there are 3.
Wrong arguments will cause the program to bomb out.
Ex: ```
m = The size of the picture (picture will be m X m in size).
n = The number of iterations to run (More will make for a
clearer picture).
ifs = The file to use as input.
```
The program will spit out an [XBM image](https://en.wikipedia.org/wiki/X_BitMap)
on standard out. Minimal checking is done on the arguments mainly that there
are 3. Wrong arguments will cause the program to bomb out.
#### Example:
```sh ```sh
./stewart 1024 1000000 gasket > gasket.xbm ./stewart 1024 1000000 gasket > gasket.xbm
@@ -68,7 +83,7 @@ Ex:
### Compilation/Testing ### Compilation/Testing
The program compiles without warning with `gcc -ansi -Wall`. The program compiles without warning with `gcc -ansi -Wall`.
`lint` also seems to like the code. This must be a bug in lint. `lint` also seems to like the code. This must be a bug in `lint`.
The program was tested on Linux on a x86 and NetBSD on an alpha. The program was tested on Linux on a x86 and NetBSD on an alpha.
Only gcc was tested for compilers (4.0.3 and 3.3.3). Only gcc was tested for compilers (4.0.3 and 3.3.3).
@@ -93,13 +108,13 @@ another kind of fractal, those from the [Iterated Function System
The format of the input file is as follows: The format of the input file is as follows:
``` ```
<num ifs> <x min> <y min> <x max> <y max> <num ifs> <x min> <y min> <x max> <y max>
<a> <b> <c> <d> <e> <f> <p> <a> <b> <c> <d> <e> <f> <p>
<a> <b> <c> <d> <e> <f> <p> <a> <b> <c> <d> <e> <f> <p>
<a> <b> <c> <d> <e> <f> <p> <a> <b> <c> <d> <e> <f> <p>
. .
. .
. .
``` ```
This file describe an IFS. This file describe an IFS.
@@ -107,20 +122,20 @@ This file describe an IFS.
One of the most well known would be the [Sierpinski Gasket](gasket): One of the most well known would be the [Sierpinski Gasket](gasket):
``` ```
3 0 0 1 1 3 0 0 1 1
.5 0 0 .5 0 0 .33 .5 0 0 .5 0 0 .33
.5 0 0 .5 .5 0 .33 .5 0 0 .5 .5 0 .33
.5 0 0 .5 .25 .433 .34 .5 0 0 .5 .25 .433 .34
``` ```
or the [fern](fern): or the [fern](fern):
``` ```
4 -5.5 0 5.5 11 4 -5.5 0 5.5 11
0 0 0 .16 0 0 .01 0 0 0 .16 0 0 .01
.85 .04 -.04 .85 0 1.6 .85 .85 .04 -.04 .85 0 1.6 .85
.2 -.26 .23 .22 0 1.6 .07 .2 -.26 .23 .22 0 1.6 .07
-.15 .28 .26 .24 0 .44 .07 -.15 .28 .26 .24 0 .44 .07
``` ```
etc... etc...
@@ -136,9 +151,9 @@ Basically the break down is:
`num` is the number of equations in the `IFS`. `num` is the number of equations in the `IFS`.
`x` (min, max) and `y` (min, max) define the ranges that will be displayed `x` (min, max) and `y` (min, max) define the ranges that will be displayed
in the `xbm`. in the XBM image file.
The `a b c d e f` are used to iterative find points that lie in the `IFS` The `a b c d e f` are used to iterative find points that lie in the IFS
from the algorithm from the algorithm
``` ```
@@ -156,7 +171,7 @@ the args for `main()`). This causes me to do much casting and pointer
arithmetic to get the correct location and completely does away with arithmetic to get the correct location and completely does away with
any meaning the variables could have. This also makes the code more any meaning the variables could have. This also makes the code more
convenient to read in the current form vs preprocessed. After convenient to read in the current form vs preprocessed. After
preprocessing there will almost be 300 casts in the code and I believe preprocessing there will be almost 300 casts in the code and I believe
they are all needed... (I would double check but my brain is kinda they are all needed... (I would double check but my brain is kinda
mushy right now from chasing down a segfault in the code.) mushy right now from chasing down a segfault in the code.)
@@ -165,6 +180,7 @@ all that common for a program to do. I mean google only has something
like 66,000 hits for "Iterated function system" so that means it is like 66,000 hits for "Iterated function system" so that means it is
obscure, right? obscure, right?
### Some other minor obfuscations ### Some other minor obfuscations
Since I formatted it as a "normal" program I did inject something that Since I formatted it as a "normal" program I did inject something that
@@ -181,12 +197,13 @@ information about the algorithm.
The use of many magic numbers. I figured if I get yelled about them in The use of many magic numbers. I figured if I get yelled about them in
a review they must be bad, right? a review they must be bad, right?
### Silly things ### Silly things
The use of decimal numbers where one would expect hex. Octal numbers The use of decimal numbers where one would expect hex. Octal numbers
where one would expect decimal. Shifts instead of divides. where one would expect decimal. Shifts instead of divides.
Using `xbm` as the output format. This might confuse someone who doesn't Using xbm as the output format. This might confuse someone who doesn't
have an X background. It happens to be easy but is probably a very bad have an X background. It happens to be easy but is probably a very bad
choice from a file size standpoint. 1024x1024 image is 641k in size. choice from a file size standpoint. 1024x1024 image is 641k in size.
+15
View File
@@ -5,6 +5,19 @@ make
``` ```
### Bugs and (Mis)features:
The current status of this entry is:
```
STATUS: INABIAF - please **DO NOT** fix
```
For more detailed information see [2006 sykes1 in bugs.md](/bugs.md#2006-sykes1).
## To use: ## To use:
```sh ```sh
@@ -215,6 +228,7 @@ In the ASCII output care must be taken with drawing the edges of each
this is taken care of by color, which is graded from the back to the this is taken care of by color, which is graded from the back to the
front to ensure edge visibility. front to ensure edge visibility.
### Notes ### Notes
The whole program has just one function - `main()` - which is recursively The whole program has just one function - `main()` - which is recursively
@@ -241,6 +255,7 @@ requirements.
The program is known to compile and run under gcc and Intel cc, as well The program is known to compile and run under gcc and Intel cc, as well
as PellesC on Windows. as PellesC on Windows.
### Bugs ### Bugs
The program is not at all a valid html document, but fortunately The program is not at all a valid html document, but fortunately
+2 -1
View File
@@ -40,7 +40,8 @@ include ../../var.mk
# #
CSILENCE= -Wno-bitwise-op-parentheses -Wno-char-subscripts -Wno-error \ CSILENCE= -Wno-bitwise-op-parentheses -Wno-char-subscripts -Wno-error \
-Wno-implicit-function-declaration -Wno-implicit-int -Wno-main \ -Wno-implicit-function-declaration -Wno-implicit-int -Wno-main \
-Wno-pedantic -Wno-deprecated-non-prototype -Wno-pedantic -Wno-deprecated-non-prototype -Wno-unused-parameter \
-Wno-parentheses
# Common C compiler warning flags # Common C compiler warning flags
# #
+1 -1
View File
@@ -15,7 +15,7 @@ make
### Try: ### Try:
```sh ```sh
./sykes2.sh ./try.sh
``` ```
This will repeatedly remake the program and run it then sleep for one second for This will repeatedly remake the program and run it then sleep for one second for
+1 -1
View File
@@ -1 +1 @@
main(_){_^448&&main(-~_);putchar(--_%64?32|-~7[__TIME__-_/8%8][">'txiZ^(~z?"-48]>>";;;====~$::199"[_*2&8|_/64]/(_&2?1:8)%8&1:10);} main(_,v)char**v;{_^448&&main(-~_,v);putchar(--_%64?32|-~7[__TIME__-_/8%8][">'txiZ^(~z?"-48]>>";;;====~$::199"[_*2&8|_/64]/(_&2?1:8)%8&1:10);}
-9
View File
@@ -1,9 +0,0 @@
#!/usr/bin/env bash
while :; do
clear
rm -f sykes2
make sykes2 2>/dev/null 1>&2
./sykes2
sleep 1
done
+21
View File
@@ -0,0 +1,21 @@
#!/usr/bin/env bash
#
# try.sh - demonstrate IOCCC winner 2006/sykes2
#
# make sure CC is set so that when we do make CC="$CC" it isn't empty. Doing it
# this way allows us to have the user specify a different compiler in an easy
# way.
if [[ -z "$CC" ]]; then
CC="cc"
fi
make CC="$CC" sykes2 || exit 1
while :; do
clear
rm -f sykes2
make sykes2 2>/dev/null 1>&2 || exit 1
./sykes2
sleep 1
done
+1 -1
View File
@@ -35,7 +35,7 @@ be expected, and some dump core?
## Author's remarks: ## Author's remarks:
Can you place a knight on a chess board and make it Can you place a knight on a chess board and make it
to visit the 64 squares without repeating them? visit the 64 squares without repeating them?
If not, this program does it, just run it with an argument If not, this program does it, just run it with an argument
giving initial position. giving initial position.
+62 -1
View File
@@ -2305,22 +2305,83 @@ used decimal mode, or any of the "undocumented" instructions.
# 2006 # 2006
## 2006 birken
### STATUS: uses gets() - change to fgets() if possible
### Source code: [2006/birken/birken.c](2006/birken/birken.c)
### Information: [2006/birken/README.md](2006/birken/README.md)
This entry uses `gets(3)` which is unsafe and provides annoying warnings, most
obnoxious in macOS as it shows it at runtime (redirecting `stderr` to
`/dev/null` will silence it). The following diff will almost work but it crashes
with at least `computer.tofu` input file:
```diff
12a13
#define gets(c) fgets((c),PI,stdin)&&(((c)[strlen((c))-1]='\0'),c!=NULL)
```
## 2006 borsanyi
### STATUS: INABIAF - please **DO NOT** fix
### Source code: [2006/borsanyi/borsanyi.c](2006/borsanyi/borsanyi.c)
### Information: [2006/borsanyi/README.md](2006/borsanyi/README.md)
The string specified must be <= 42 characters and may only consist of the
characters in the regex `a-z_A-Z0-9@.-`. Breaking these constraints will end up
with possibly corrupt GIF files.
## 2006 monge ## 2006 monge
### STATUS: doesn't work with some platforms - please help us fix ### STATUS: doesn't work with some platforms - please help us fix
### Source code: [2006/monge/monge.c](2006/monge/monge.c) ### Source code: [2006/monge/monge.c](2006/monge/monge.c)
### Information: [2006/monge/README.md](2006/monge/README.md) ### Information: [2006/monge/README.md](2006/monge/README.md)
This program requires being able to read, write and execute memory. With the This program requires x86 (with an x87 FPU) or x86_64 machine and it requires
the SDL1 library.
This program also requires being able to read, write and execute memory. With the
Apple silicon chips this is not allowed. Fixing this might be quite challenging Apple silicon chips this is not allowed. Fixing this might be quite challenging
but you are welcome to try and fix it. but you are welcome to try and fix it.
If you do fix this it might be good to fix the alternate code as well or else
provide it as an additional alt version. Fixing this is very likely to be very
challenging and in some systems it will not be possible to fix but you are
welcome to try and fix it if you wish to!
### STATUS: INABIAF - please **DO NOT** fix ### STATUS: INABIAF - please **DO NOT** fix
Incorrect formulas will ungracefully crash the program. Incorrect formulas will ungracefully crash the program.
## 2006 sykes1
### STATUS: INABIAF - please **DO NOT** fix
### Source code: [2006/sykes1/sykes1.c](2006/sykes1/sykes1.c)
### Information: [2006/sykes1/README.md](2006/sykes1/README.md)
The author stated:
```
If you pick a number higher than 19186, the program will return a
solution but it will be a rotation of one of the first 19186. This is
because the cross shaped piece fits 48 ways in the 4x4 cube, but only
2 of those ways are unique - you can rotate one of those to make any
of the other 46. The algorithm used always places the cross piece
first, so the first two placings of that piece result in the 19186
unique solutions.
If you pick a number higher than 460464 (24x19186) the program will
return without outputting a solution. If you can wait that long.
```
## 2006 toledo2 ## 2006 toledo2
### STATUS: INABIAF - please **DO NOT** fix ### STATUS: INABIAF - please **DO NOT** fix
+31 -10
View File
@@ -2952,6 +2952,8 @@ it.
Cody fixed a segfault in macOS with this entry. The problem was a missing `+1` Cody fixed a segfault in macOS with this entry. The problem was a missing `+1`
for strlen() with malloc(). This prevented it from working. for strlen() with malloc(). This prevented it from working.
Cody also added the [try.sh](2006/birken/try.sh) script.
## [2006/borsanyi](2006/borsanyi/borsanyi.c) ([README.md](2006/borsanyi/README.md])) ## [2006/borsanyi](2006/borsanyi/borsanyi.c) ([README.md](2006/borsanyi/README.md]))
@@ -2964,15 +2966,24 @@ implicitly linked in.
Cody fixed this so that it will not crash without an arg after it was suggested Cody fixed this so that it will not crash without an arg after it was suggested
this should be fixed. this should be fixed.
Cody also added the [try.sh](2006/hamre/try.sh) script.
## [2006/monge](2006/monge/monge.c) ([README.md](2006/monge/README.md])) ## [2006/monge](2006/monge/monge.c) ([README.md](2006/monge/README.md]))
Cody pointed out that without SDL1 (**not** SDL2) this will not link because two Cody added the [alternate code](2006/monge/README.md#alternate-code) that lets
functions that are used were removed from SDL2. Since SDL1 is still available one resize the image and redefine the number of iterations.
and since changing the code to use SDL2 would be more complicated he decided to
change the Makefile to use `sdl-config` not `sdl2-config`. Nevertheless he Cody also fixed the Makefile to use `sdl-config` (which is what the author
points out that the entry requires x86/x86_64 CPUs. Without it it might very stated too though that was noticed later), not `sdl2-config` as two functions
well segfault (for instance it segfaulted on his MacBook Pro with the M1 chip). that are used were removed from SDL2, thus making it not link. Since SDL2 is
still available and since changing the code to use SDL2 is much more complicated
and also makes the entry less like the original it was simply made to link in
SDL1.
Nevertheless this entry does require x86/x86_64 CPUS. This is a documented
feature but one which we will accept fixes to. See [2006/monge in
bugs.md](/bugs.md#2006-monge).
## [2006/night](2006/night/night.c) ([README.md](2006/night/README.md])) ## [2006/night](2006/night/night.c) ([README.md](2006/night/README.md]))
@@ -2987,9 +2998,9 @@ Cody fixed this entry to work with clang which has a defect with the args to
`main()`: it requires specific types: `int` and `char **` for the first and `main()`: it requires specific types: `int` and `char **` for the first and
latter args. latter args.
The [alternate version](2006/sloane/sloane.alt.c), which allows one to see what Cody also provided the [alternate version](2006/sloane/sloane.alt.c), which
is going on in modern systems, and which we recommend one use _first_, was allows one to see what is going on in modern systems, and which we recommend one
provided by Cody. use _first_.
Curiously, although clang requires the types of args to be strictly correct, Curiously, although clang requires the types of args to be strictly correct,
some versions do allow only one arg. This was done at first because it's not some versions do allow only one arg. This was done at first because it's not
@@ -3006,7 +3017,7 @@ Cody also made sure that the Makefile links in `libm` as not all systems do this
by default. by default.
Since the author suggested that the lack of certain `#include`s might break the Since the author suggested that the lack of certain `#include`s might break the
program in some systems he added `-include ...` to the Makefile as well. program in some systems he also added `-include ...` to the Makefile as well.
## [2006/stewart](2006/stewart/stewart.c) ([README.md](2006/stewart/README.md])) ## [2006/stewart](2006/stewart/stewart.c) ([README.md](2006/stewart/README.md]))
@@ -3026,6 +3037,16 @@ The video was also no longer available but Cody found an alternative and added
it to the repo as well. it to the repo as well.
## [2006/sykes2](2006/sykes2/sykes2.c) ([README.md](2006/sykes2/README.md]))
Cody, out of an abundance of caution for `clang`'s defects, made `main()` have
to args instead of 1 as some versions report that `main()` must have 0, 2 or 3
args, even though at least one of those versions allows 1 arg only.
Cody also added the [try.sh](2006/sykes2/try.sh) script for easier use of the
entry to show the clock update in real time.
## [2006/toledo2](2006/toledo2/toledo2.c) ([README.md](2006/toledo2/README.md])) ## [2006/toledo2](2006/toledo2/toledo2.c) ([README.md](2006/toledo2/README.md]))
Cody fixed a segfault in this program which was making it fail to work under Cody fixed a segfault in this program which was making it fail to work under