From b5201c2ed18398c7b1e398768a7840713faf239b Mon Sep 17 00:00:00 2001
From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com>
Date: Sat, 24 Aug 2024 09:03:41 -0700
Subject: [PATCH 1/6] Format fixes in 2005/aidan/index.html
---
2005/aidan/README.md | 10 +++++-----
2005/aidan/index.html | 10 +++++-----
2 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/2005/aidan/README.md b/2005/aidan/README.md
index 9ed40be70..cb5c9e1f0 100644
--- a/2005/aidan/README.md
+++ b/2005/aidan/README.md
@@ -4,7 +4,7 @@
make
```
-There is an alternate version based on the author's remarks. See [alternate
+There is an alternate version based on the author's remarks. See [Alternate
code](#alternate-code).
@@ -28,8 +28,8 @@ where `seed` is a number.
## Alternate code:
-This code is formatted differently and is not the approach used by the author
-which is slower, inelegant and not as obscure, as the author put it.
+This code is formatted differently and is not the approach used by the author;
+it is slower, inelegant and not as obscure, as the author put it.
### Alternate build:
@@ -60,8 +60,8 @@ more while it puzzles out some puzzles: all in a puzzling way!
to the `switch` statement. And if you think you can puzzle
it out better, try solving [insane1.sudoku](%%REPO_URL%%/2005/aidan/insane1.sudoku) all by yourself!
-NOTE: the tarball named by the author was removed after the files were extracted
-into the directory instead. These files were added to the list.
+**NOTE**: the tarball named by the author was removed after the files were
+extracted into the directory instead. These files were added to the list.
## Author's remarks:
diff --git a/2005/aidan/index.html b/2005/aidan/index.html
index 4e8d31561..68b908f3c 100644
--- a/2005/aidan/index.html
+++ b/2005/aidan/index.html
@@ -409,7 +409,7 @@ Location: GB - United Kingdom of Great
There is an alternate version based on the author’s remarks. See alternate
+ There is an alternate version based on the author’s remarks. See Alternate
code. This code is formatted differently and is not the approach used by the author
-which is slower, inelegant and not as obscure, as the author put it. This code is formatted differently and is not the approach used by the author;
+it is slower, inelegant and not as obscure, as the author put it.To build:
- makeTo use:
. ./aidan < puzzle
@@ -419,8 +419,8 @@ codeTry:
./try.shAlternate code:
-Alternate build:
make altAlternate use:
@@ -433,8 +433,8 @@ more while it puzzles out some puzzles: all in a puzzling way!
goto the source and notice the lack of functions. Jump
to the switch statement. And if you think you can puzzle
it out better, try solving insane1.sudoku all by yourself!
NOTE: the tarball named by the author was removed after the files were extracted -into the directory instead. These files were added to the list.
+NOTE: the tarball named by the author was removed after the files were +extracted into the directory instead. These files were added to the list.
This program can solve a type of logic puzzle known as a Sudoku, and also From a4fd6665a1f5c65abaf9f93a2cb4baafe3451c93 Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Sat, 24 Aug 2024 09:06:21 -0700 Subject: [PATCH 2/6] Add another vi(m) swap file glob to .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index f7c58f554..58ffea6c6 100644 --- a/.gitignore +++ b/.gitignore @@ -41,6 +41,7 @@ manifest.numbers .su[a-z] .*.sv[a-z] .*.sw[a-z] +.sw[a-zA-Z0-9] .tmp.* year_prize.csv year_prize.numbers From 938c906bf299abdf606472c0ce0c85c4a0325871 Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Sat, 24 Aug 2024 09:25:04 -0700 Subject: [PATCH 3/6] Format fixes in 2005/anon/index.html --- 2005/anon/README.md | 196 ++++++++++++++++----------- 2005/anon/index.html | 308 +++++++++++++++++++++++++++++++++---------- 2 files changed, 359 insertions(+), 145 deletions(-) diff --git a/2005/anon/README.md b/2005/anon/README.md index 185057e91..23e0f8be2 100644 --- a/2005/anon/README.md +++ b/2005/anon/README.md @@ -4,8 +4,8 @@ make ``` -NOTE: there is an alternate version for vi(m) like movements. See [alternate -version](#alternate-code) below. If your terminal has problems with the +**NOTE**: there is an alternate version for vi(m) like movements. See [Alternate +code](#alternate-code) below. If your terminal has problems with the `stty(1)` commands try: ``` @@ -62,7 +62,7 @@ something strange. This might also happen if you specify excessively large board dimensions. Try `100 100 100` for instance and see what happens! -## Alternate version: +## Alternate code: The alternate version uses `vi(m)` like movement keys. @@ -84,14 +84,19 @@ To compile the version without `stty(1)`: Use `anon.alt` as you would `anon` with the change in movements: -``` - k | Move empty spot up - h | Move empty spot left - j | Move empty spot down - l | Move empty spot right - J | Move empty spot forwards - K | Move empty spot backwards -``` + +* `k` + - Move empty spot up +* `h` + - Move empty spot left +* `j` + - Move empty spot down +* `l` + - Move empty spot right +* `J` + - Move empty spot forwards +* `K` + - Move empty spot backwards ## Judges' remarks: @@ -130,9 +135,9 @@ To play with a 3D board, do something like this: ./anon 3 3 3 ``` -**WARNING: do NOT run the program with more than 3 command-line arguments. +**WARNING**: do NOT run the program with more than 3 command-line arguments. This will trigger a bug that will cause it to crash or do something strange. -:-)** +:-) Also, resist the temptation to create very large puzzles. The program does not attempt to resize your terminal for you, and will produce confusing output. It @@ -143,34 +148,38 @@ The empty space on the board is represented by a space filled with `#` characters instead of digits. To slide the tiles around, use the following keys: -``` - i | Slide the tile above the current empty space downwards. - j | Slide the tile to the left of the current empty space to the right. - k | Slide the tile below the current empty space upwards. - l | Slide the tile to the right of the current empty space to the left. - o | Slide the tile behind the current empty space forwards. - n | Slide the tile in front of the current empty space backwards. -``` +* `i` + - Slide the tile above the current empty space downwards. +* `j` + - Slide the tile to the left of the current empty space to the right. +* `k` + - Slide the tile below the current empty space upwards. +* `l` + - Slide the tile to the right of the current empty space to the left. +* `o` + - Slide the tile behind the current empty space forwards. +* `n` + - Slide the tile in front of the current empty space backwards. -To quit the game: - -``` - q | Quit the game. -``` +To quit the game, hit `q`. Note that, for example, sliding the tile above the current empty spot downwards will fill up the empty spot, and create a new empty spot above where the current empty spot was. Hence, you could think of the movement keys in terms of how they effectively "move" the empty spot: -``` - i | Move empty spot up - j | Move empty spot left - k | Move empty spot down - l | Move empty spot right - n | Move empty spot forwards - o | Move empty spot backwards -``` +* `i` + - Move empty spot up +* `j` + - Move empty spot left +* `k` + - Move empty spot down +* `l` + - Move empty spot right +* `n` + - Move empty spot forwards +* `o` + - Move empty spot backwards **NOTE:** as a measure of alleviating counter-productivity due to addiction to this game, particularly for those hardcore gamers who insist on solving a @@ -315,13 +324,13 @@ To avoid having to handle issues of `int` sizes, memory alignment, what exactly is on the stack between successive locations of `argc`, etc., the program (ab)uses the fact that `argc` must necessarily be allocated on an aligned address, and therefore, the range of memory between two `argc`s is aligned, and -therefore safe to use as an array of `long`s.[\*] The program also compares the +therefore safe to use as an array of `long`s.[^1] The program also compares the pointers as `long*` pointers, so that it will not have to deal with mapping bytes to larger types. The initial memory allocation is done by recursively calling `main()` until there is enough space on the stack (the exact number of recursive calls is, of course, architecture-dependent). -[\*] `long` was chosen instead of `int`, in order to skirt around pointer-size +[^1]: `long` was chosen instead of `int`, in order to skirt around pointer-size issues on architectures like ia64. It really can be made anything large enough to hold both `int`s and pointers. `:-)` @@ -330,10 +339,10 @@ array (pun intended), the program begins its real code. It uses `argc` to keep track of what it's supposed to be doing (since `main()` is the only function), and `argv` to point to the base of this array (which is computed differently based on how the architecture allocates the stack). Since this fills up the -only two variables in the program, everything else is stored in the `MASS` [\*\*] +only two variables in the program, everything else is stored in the `MASS` [^2] array. -[\*\*] for "Memory Allocated by Stack Smashing" :-) +[^2]: for "Memory Allocated by Stack Smashing" :-) Note that from this point on, all bets are off as to what the contents of the runtime stack are below the current recursive call to `main()`. We are @@ -450,29 +459,46 @@ program, and what the various state numbers are meant to do: #### MASS usage map -``` - 0 | Function return value - 1 | Function argument 1 - 2 | Function argument 2 - 3 | Function argument 3 - 4 | Scratch register 1 - 5 | Scratch register 2 - 6 | Scratch register 3 - 7 | Scratch register 4 - 8 | Value of original argv :-) - 9 | Value of original argc :-) - 11 | Zero register (always set to 0) - 12 | Width of board - 13 | Length of board - 14 | Height of board - 15 | Current position of hole - 16 | Random seed for rand_r(3) - 18 | Scratch register used by state 18 :-) - 31 | field width for printing tiles - 32 | Start of board data -``` +* `0` + - Function return value +* `1` + - Function argument 1 +* `2` + - Function argument 2 +* `3` + - Function argument 3 +* `4` + - Scratch register 1 +* `5` + - Scratch register 2 +* `6` + - Scratch register 3 +* `7` + - Scratch register 4 +* `8` + - Value of original argv :-) +* `9` + - Value of original argc :-) +* `11` + * Zero register (always set to 0) +* `12` + - Width of board +* `13` + - Length of board +* `14` + - Height of board +* `15` + - Current position of hole +* `16` + - Random seed for rand_r(3) +* `18` + - Scratch register used by state 18 :-) +* `31` + - Field width for printing tiles +* `32` + - Start of board data -(**CAVEAT:** not all of these mappings ended up in the final version of the +(**CAVEAT**: not all of these mappings ended up in the final version of the program, mainly due to size limitations which entailed the trimming off of a lot of neat features in the game. It is left as an exercise for the reader to figure out which of these are actually used.) @@ -484,24 +510,38 @@ to be on all tested architectures.) #### State number assignments -``` - 1 | showhelp - 2 | showhelp - 3 | is 2D: start init - 4 | is 3D: start init - 5 | find allocation type - 6 | MASS init, bottom-up - 7 | MASS init, top-down - 8 | main program - 9 | generate() outer loop - 13 | render() - 14 | render() loop - 15 | exit(0) - 16 | pick a tile that hasn't occurred yet - 17 | inner loop of 16. - 18 | main loop - 19 | checkwin() loop -``` +* `1` + - `showhelp` +* `2` + - `showhelp` +* `3` + - is 2D: start init +* `4` + - is 3D: start init +* `5` + - find allocation type +* `6` + - MASS init, bottom-up +* `7` + - MASS init, top-down +* `8` + - main program +* `9` + - `generate()` outer loop +* `13` + - `render()` +* `14` + - `render()` loop +* `15` + - `exit(0)` +* `16` + - pick a tile that hasn't occurred yet +* `17` + - inner loop of `16`. +* `18` + - main loop +* `19` + - `checkwin()` loop Note that some of the manually-implemented states (those not implemented by `do()`) respond to multiple state numbers. Also note that states 1-4 diff --git a/2005/anon/index.html b/2005/anon/index.html index 6def24221..b69b26d6b 100644 --- a/2005/anon/index.html +++ b/2005/anon/index.html @@ -409,8 +409,8 @@ Location: ZZ - Unknown location
make
-NOTE: there is an alternate version for vi(m) like movements. See alternate -version below. If your terminal has problems with the +
NOTE: there is an alternate version for vi(m) like movements. See Alternate
+code below. If your terminal has problems with the
stty(1) commands try:
make anon-no_stty
This will compile anon.c as anon to not use
@@ -438,7 +438,7 @@ hook you) and spending too much time playing. :-)
If you specify more than three args the program might also crash or do
something strange. This might also happen if you specify excessively large board
dimensions. Try 100 100 100 for instance and see what happens!
The alternate version uses vi(m) like movement keys.
make alt
@@ -446,12 +446,32 @@ dimensions. Try 100 100 100 for instance and see what happens!
make alt-no_stty
Use anon.alt as you would anon with the change in movements:
k | Move empty spot up
- h | Move empty spot left
- j | Move empty spot down
- l | Move empty spot right
- J | Move empty spot forwards
- K | Move empty spot backwards
+k
+h
+j
+l
+J
+K
+Taking the 4x4 board with 15 tiles to a whole new level, this entry takes this puzzle to a whole new dimension! While you puzzle out this puzzle, we invite @@ -473,9 +493,9 @@ For example, to play the original version of the Fifteen Puzzle:
./anon 4 4
To play with a 3D board, do something like this:
./anon 3 3 3
-WARNING: do NOT run the program with more than 3 command-line arguments.
+ WARNING: do NOT run the program with more than 3 command-line arguments.
This will trigger a bug that will cause it to crash or do something strange.
-:-)
Also, resist the temptation to create very large puzzles. The program does not attempt to resize your terminal for you, and will produce confusing output. It may also crash on you if you insist on running it with excessively large board @@ -483,24 +503,63 @@ dimensions. :-) (10x10x10 is considered a safe upper limit.)
The empty space on the board is represented by a space filled with #
characters instead of digits. To slide the tiles around, use the following
keys:
i | Slide the tile above the current empty space downwards.
- j | Slide the tile to the left of the current empty space to the right.
- k | Slide the tile below the current empty space upwards.
- l | Slide the tile to the right of the current empty space to the left.
- o | Slide the tile behind the current empty space forwards.
- n | Slide the tile in front of the current empty space backwards.
-To quit the game:
- q | Quit the game.
+i
+j
+k
+l
+o
+n
+To quit the game, hit q.
Note that, for example, sliding the tile above the current empty spot downwards will fill up the empty spot, and create a new empty spot above where the current empty spot was. Hence, you could think of the movement keys in terms of how they effectively “move” the empty spot:
- i | Move empty spot up
- j | Move empty spot left
- k | Move empty spot down
- l | Move empty spot right
- n | Move empty spot forwards
- o | Move empty spot backwards
+i
+j
+k
+l
+n
+o
+NOTE: as a measure of alleviating counter-productivity due to addiction to this game, particularly for those hardcore gamers who insist on solving a 10x10x10 puzzle during work hours, and also to give an upper bound to user @@ -612,22 +671,18 @@ call is greater or less than in the parent call.)
is on the stack between successive locations ofargc, etc., the program
(ab)uses the fact that argc must necessarily be allocated on an aligned
address, and therefore, the range of memory between two argcs is aligned, and
-therefore safe to use as an array of longs.[*] The program also compares the
+therefore safe to use as an array of longs.1 The program also compares the
pointers as long* pointers, so that it will not have to deal with mapping
bytes to larger types. The initial memory allocation is done by recursively
calling main() until there is enough space on the stack (the exact number of
recursive calls is, of course, architecture-dependent).
-[*] long was chosen instead of int, in order to skirt around pointer-size
-issues on architectures like ia64. It really can be made anything large enough
-to hold both ints and pointers. :-)
After the stack is deemed to have grown deep enough to be a sufficiently long
array (pun intended), the program begins its real code. It uses argc to keep
track of what it’s supposed to be doing (since main() is the only function),
and argv to point to the base of this array (which is computed differently
based on how the architecture allocates the stack). Since this fills up the
-only two variables in the program, everything else is stored in the MASS [**]
+only two variables in the program, everything else is stored in the MASS 2
array.
[**] for “Memory Allocated by Stack Smashing” :-)
Note that from this point on, all bets are off as to what the contents of the
runtime stack are below the current recursive call to main(). We are
overwriting frame pointers, return addresses, etc., with data. Hence, the
@@ -717,26 +772,85 @@ key press. What could be more fun than to define such a case in terms of a
are the mappings of various locations of the MASS to their usage in the
program, and what the various state numbers are meant to do:
0 | Function return value
- 1 | Function argument 1
- 2 | Function argument 2
- 3 | Function argument 3
- 4 | Scratch register 1
- 5 | Scratch register 2
- 6 | Scratch register 3
- 7 | Scratch register 4
- 8 | Value of original argv :-)
- 9 | Value of original argc :-)
- 11 | Zero register (always set to 0)
- 12 | Width of board
- 13 | Length of board
- 14 | Height of board
- 15 | Current position of hole
- 16 | Random seed for rand_r(3)
- 18 | Scratch register used by state 18 :-)
- 31 | field width for printing tiles
- 32 | Start of board data
-(CAVEAT: not all of these mappings ended up in the final version of the +
0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+11
+12
+13
+14
+15
+16
+18
+31
+32
+(CAVEAT: not all of these mappings ended up in the final version of the program, mainly due to size limitations which entailed the trimming off of a lot of neat features in the game. It is left as an exercise for the reader to figure out which of these are actually used.)
@@ -745,22 +859,72 @@ theMASS, because otherwise they may overwrite their original value
memory allocation code saves them. Index 8 is deemed “safe enough”. (It seems
to be on all tested architectures.)
1 | showhelp
- 2 | showhelp
- 3 | is 2D: start init
- 4 | is 3D: start init
- 5 | find allocation type
- 6 | MASS init, bottom-up
- 7 | MASS init, top-down
- 8 | main program
- 9 | generate() outer loop
- 13 | render()
- 14 | render() loop
- 15 | exit(0)
- 16 | pick a tile that hasn't occurred yet
- 17 | inner loop of 16.
- 18 | main loop
- 19 | checkwin() loop
+1
+showhelp2
+showhelp3
+4
+5
+6
+7
+8
+9
+generate() outer loop13
+render()14
+render() loop15
+exit(0)16
+17
+16.18
+19
+checkwin() loopNote that some of the manually-implemented states (those not implemented by
do()) respond to multiple state numbers. Also note that states 1-4
conveniently correspond to what the program should do when 1-4 arguments are
@@ -784,6 +948,16 @@ smiley. :-)
This is FAQ version 28.0.3 2024-07-27.
+This is FAQ version 28.0.4 2024-08-24.
try.sh and try.alt.sh scripts and why should I use them?To enable this feature:
make clobber all CC=clang
-or:
- make clobber all 'CWARN+= -Weverything'
-though it should be noted that if one tries -Weverything with compilers that
-are not clang they might see something like:
echo 'int main(void) {}' > foo.c ; cc -Weverything foo.c -o foo
- cc: error: unrecognized command-line option '-Weverything'
-which means that it can’t even be compiled. Thus the proper way to do it is the
-first way, make clobber all CC=clang.
IOCCC authors who have access to clang might wish to try their
hand at compiling with -Weverything while using a minimum of -Wno-foo
statements. Sometimes there is a technical or pedantic issue that
@@ -2863,7 +2856,7 @@ warnings, and we find a warning situation, this may diminish the value of your
entry as it is not as documented. Thus it might be wise to point this out and
if you can test it in multiple platforms (or versions of clang, see
below note) this would be advisable.
NOTE: different versions of clang have other differences as well. For instance
+
NOTE: different versions of clang have other differences as well. For instance
a defect of clang that required numerous entries to be fixed for clang is that it
requires that main()’s arguments to be of a specific type. However some
versions of clang are more strict in the number of args allowed. These reasons
@@ -3178,9 +3171,9 @@ provided by the author and any other file in the winning entry, found under the
entry’s subdirectory.
If you downloaded 1984/mullender/1984_mullender.tar.bz2, for instance, you might
then do:
cd 1984/mullender
- make everything
- ./mullender.alt cd 1984/mullender
+ make everything
+ ./mullender.altto compile all versions and then run the alternate version (if you have
a PDP-11 or VAX-11 you would be able to run the original version). For more help
on compiling entries, see also the
@@ -3221,8 +3214,8 @@ if you switched to each entry’s directory and ran make everything
If you download the 1984 tarball, i.e. 1984/1984.tar.bz2, then you might
extract it and then switch to the directory and compile everything of each
entry:
cd 1984
- make everything cd 1984
+ make everythingFor more help on compiling entries, see also the FAQ on “IOCCC Makefile rules”.
Of course in this case you can also switch to individual entries and look at the @@ -3252,6 +3245,23 @@ and there are some other benefits as well which you would miss if you did not use them. Nevertheless, if you prefer to do it manually, whether to help you process or appreciate the entry more, then please do so.
Jump to: top
+There are unfortunately some warnings that cannot be disabled; they are always
+enabled whatever warning options you have enabled. Also, there is a warning that
+is enabled whenever you act on char *s, saying it is unsafe buffer usage, even
+when it’s not (this might be enabled by -Weverything but it might not be; for
+more details on why we use -Weverything in Clang see the FAQ on
+“-Weverything”), and it is not detrimental to your submission
+if you disable this.
So in short, no you should not worry about these as they are sometimes +inevitable in obfuscated code and even non-obfuscated code.
+If you can work past this it might be good but this is not something that +should be worried about too much as this is on the compiler developers, not you.
+Jump to: top
char *s, saying it is unsafe buffer
when it’s not (this might be enabled by -Weverything but it might not be; for
more details on why we use -Weverything in Clang see the FAQ on
“-Weverything”), and it is not detrimental to your submission
-if you disable this.
+if you disable this). This warning happens to be -Wno-unsafe-buffer-usage.
So in short, no you should not worry about these as they are sometimes inevitable in obfuscated code and even non-obfuscated code.
If you can work past this it might be good but this is not something that diff --git a/faq.md b/faq.md index 4af54b92b..674291323 100644 --- a/faq.md +++ b/faq.md @@ -3764,7 +3764,7 @@ is enabled whenever you act on `char *`s, saying it is unsafe buffer usage, even when it's not (this might be enabled by `-Weverything` but it might not be; for more details on why we use `-Weverything` in Clang see the FAQ on "[`-Weverything`](#weverything)"), and it is not detrimental to your submission -if you disable this. +if you disable this). This warning happens to be `-Wno-unsafe-buffer-usage`. So in short, no you should not worry about these as they are sometimes inevitable in obfuscated code and even non-obfuscated code. From 7f88c03cd7b49be2ada9d6d11c8d3cff39c7d301 Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Sat, 24 Aug 2024 10:19:54 -0700 Subject: [PATCH 6/6] Add note to guidelines about forced warnings --- next/guidelines.html | 18 ++++++++++++++++-- next/guidelines.md | 20 ++++++++++++++++++-- 2 files changed, 34 insertions(+), 4 deletions(-) diff --git a/next/guidelines.html b/next/guidelines.html index a070e98f4..05369a497 100644 --- a/next/guidelines.html +++ b/next/guidelines.html @@ -424,7 +424,7 @@ writing by contacting the judges.
IMPORTANT: Be SURE to read the IOCCC rules.