Files
Landon Curt Noll a78d78ccff fix use of temp-test-ioccc
Regarding use of `temp-test-ioccc` in current repo files:

We will ignore files under `tmp/` as they are going away.

We will ignore files under `bin/` as they will have their default `REPO_URL` value changed during the later parts of the **Great Fork Merge**.

We will ignore `*.html` files as the above changes to `bin/` tool will also change them during the later parts of the **Great Fork Merge**.

We will ignore `sitemap.xml` as the it will change during the later parts of the **Great Fork Merge**.

So this leaves for our consideration the files printed by this command:

```sh
find * -type f ! -name '*.html' ! -name sitemap.xml ! -path 'tmp/*' ! -path 'bin/*' -print0 | xargs -0 grep -l 'temp-test-ioccc'
```

We see 5 (3 sir), 3 cases:

* README.md index.md

The reference to `temp-test-ioccc` will be removed when a given section goes away as part of the later parts of the **Great Fork Merge**.

Nothing needs to be dome here other than to add some **XXX** comments to help remind us of what needs to be done in later parts of the **Great Fork Merge**.

* bugs.md faq.md news.md var.mk

The use of `temp-test-ioccc` is outside of a blob.

Here `https://github.com/ioccc-src/temp-test-ioccc/` may be be replaced by `https://github.com/ioccc-src/winner/` in anticipation of the **Great Fork Merge**.

There is an exception: The historic discussion abouts the history of the `temp-test-ioccc` repo needs to retain their `https://github.com/ioccc-src/temp-test-ioccc/` strings in `faq.md` and `news.md`.

* 2005/sykes/README.md

The markdown links that start with `https://github.com/ioccc-src/temp-test-ioccc/blob/master/` should instead start with `%%REPO_URL%%/`.

After the **Great Fork Merge**, the `%%REPO_URL%%/` value will refer to `https://github.com/ioccc-src/winner/blob/master/` instead.

* 2020/ferguson1/snake.1

There is not a tool to "pre-process" cat pages like there is for markdown files: no should there be.

The cat page refers to a markdown file when instead it should refer to a HTML page.

In this case we suggest that `https://github.com/ioccc-src/temp-test-ioccc/blob/` be replaced by `https://www.isthe.com/`, and `.md` be replaced by `.html` in anticipation of what it will need to be after the **Great Fork Merge**.

* YYYY/entry_dir/*.sh

The shell scripts references by the above command are "helper shell scripts.   Like man pages, there is no "pre-processor" for shell scripts, nor should there be.

Looking at these helper shell script files in detail:

```sh
find * -name '*.sh' ! -path 'tmp/*' ! -path 'bin/*' -print0 | xargs -0 grep 'temp-test-ioccc/blob/master'
```

We see that they all make references to `faq.md#something.`.

This is wrong in 2 ways:

0) They should not refer to the markdown file `faq.md` but rather to the HTML file `faq.html`.

1) They punctuate a literal string (with one exception) by adding a final period (".") to a string that requires somebody to copy and paste and exclude the final period (".").

Since these echo commands are suggesting that the user view something within the FAQ, we recommend that `echo "Tip: see https://github.com/ioccc-src/temp-test-ioccc/blob/master/faq.md#` be replaced by `echo "Tip: see https://www.ioccc.org/faq.html#` AND that the final period (".") be removed.  Thus they too will anticipate what they will need to be after the **Great Fork Merge**.
2024-05-30 11:17:04 -07:00

289 lines
11 KiB
Groff

.TH snake 1 "11 August 2020" "snake" "IOCCC 2020"
.SH NAME
snake \- Feature\-rich curses implementation of the classic 'Snake' game with many gameplay modes and options for IOCCC 2020
.SH SYNOPSIS
\fBWAIT\fP=\fIN\fP \fBWALLS\fP=\fI[01]\fP \fBEVADE\fP=\fIN\fP \fBSIZE\fP=\fIN\fP \fBMAXSIZE\fP=\fIN\fP \fBGROW\fP=\fIN\fP \fBSHEDS\fP=\fIN\fP \fBSHED\fP=\fIN\fP \fBCANNIBAL\fP=\fI[01]\fP ./snake
.br
# Start pressing some arrow keys to play
.SH DESCRIPTION
\fBsnake\fP has two cheat modes (passable walls/self[cannibalism]), a drawing/practising mode, \fIcan play by itself\fP (\fBand win!\fP), is coloured (included \fIsnake-colours.sh\fP and \fIplay.sh\fP scripts compile in player\-selected colours) and there are many other play modes (many more can be devised with the imagination and the environmental variables; see \fBENVIRONMENT\fP and the file \fIgameplay.md\fP for many examples) and options.
You can pause and there's even a built\-in test unit for some features!
.PP
Besides the environmental variables (described below) that create for a lot of gameplay modes, here are some additional features:
.PP
.RS
\fB\(bu\fP A drawing mode (\fBWAIT < 0\fP makes \fBtimeout(3)\fP block).
.RE
.PP
.RS
\fB\(bu\fP Computer plays the game (\fBWAIT=0\fP)
\fB(EPILEPSY/STIMULATION OVERLOAD TRIGGER WARNING\fP included in the relevant section of the \fIgameplay.md\fP; this goes for low \fBEVADE\fP values too).
.RE
.PP
.RS
\fB\(bu\fP Grow\-Shrink (Positive and Negative Winning) mode (see \fIgameplay.md\fP for more details).
.RE
.PP
.RS
\fB\(bu\fP Different colours and characters for the bug, snake head, snake and walls:
.RS
\fB\(bu\fP Bug is \fB*\fP (white).
.RE
.RS
\fB\(bu\fP Head is an arrow facing the direction the snake is facing (\fB<\fP, \fB^\fP, \fB>\fP, \fBv\fP) (red).
.RE
.RS
\fB\(bu\fP Body is \fBo\fP (green).
.RE
.RS
\fB\(bu\fP Walls are \fB#\fP (cyan).
.RE
.RE
.SH OPTIONS
.PP
The options are specified via the environmental variables.
.SH ENVIRONMENT
The following environmental variables modify the behaviour of the game:
.TP
.B WAIT
Positive or negative integer that changes how long to wait for a key press prior to moving again.
< 0 blocks which allows for complete control over movement at your own pace.
Default 231; you can move faster by holding down or rapidly pressing an arrow key.
.TQ
.B WALLS
Whether the walls are passable or impassable.
Default 1, passable; 0 means impassable and you will die if you hit a wall.
.TQ
.B EVADE
How many movements the Snake makes before the bug (well insect) will move to another location in the field.
Default 300; 0 disables.
.TQ
.B SIZE
Initial size of the Snake.
Default 5.
Note that it grows by one per move so at the default 5 it will not initially be 5 characters long!
< 0 is an immediate win.
.TQ
.B MAXSIZE
The maximum size the Snake can become before the game is won.
< 0 is the maximum size based on terminal dimensions; any other size will be capped based on the terminal dimensions to prevent problems.
Note that when
.B SIZE + GROW >= MAXSIZE
you win
.I before
you grow to the full size!
.TQ
.B GROW
Size to grow every time you eat a bug.
Default 5; can be negative.
"Negativity" creates for fun gameplay modes with enough creativity.
See \fB\<https://www.ioccc.org/2020/ferguson1/gameplay.html\>\fP for some examples.
\fIplay.sh\fP allows you to reconfigure the colours and play different pre\-configured gameplay modes.
.TQ
.B SHED
Every
.B SHED
movements you will grow (> 0), shrink (< 0) or stay the same length (0) by the
.B SHEDS
(below) value.
Default 0.
Again with creativity you can create some fun gameplay modes.
\fB\- Exception\fP: if the bug is eaten the counter isn't incremented.
.TQ
.B SHEDS
Every
.B SHED
movements will impact what this value means: grow (> 0), shrink (< 0) or not at all (0).
Default 0.
Again with creativity you can create some fun gameplay modes here.
For instance you can grow upon eating a bug but shrink every
.B SHED
movements and then it's a battle of whether you win by
.B SIZE
< 0
or
.B SIZE
>=
.B MAXSIZE\c
\&.
See
.I play.sh
and
.I \<https://www.ioccc.org/2020/ferguson1/gameplay.html\>
for examples.
.sp
.RS
.RS
\fBException\fP: if the bug is eaten the counter isn't incremented.
.RE
.RE
.PP
The following two modify the terminal dimensions (this is not part of the game but the terminal/curses itself).
Elsewhere I document these more and their potential pitfalls.
.TP
.B LINES
The number of rows.
Default is the maximum size of the current terminal size (\fBecho $LINES\fP will show the current value).
Please note that this is not the number of playable rows but the entire game itself.
.TQ
.B COLUMNS
The number of columns.
Default is the maximum size of the current terminal size (\fBecho $COLUMNS\fP will show the current value).
Please note that this is not be the number of playable columns but the entire game itself.
.RE
.SH FILES
The markdown files have html counterparts; for some of these the html version is probably easier to read and make use of.
.RS
\fIprog.c\fP
.RS
Source file to the Snake game (IOCCC entry source file).
.RE
\fIREADME.md\fP
.RS
Describes what the entry (game) is, what it looks like, how to play etc.
Includes a variety of other information as well as NAQs (never asked questions that I believe could actually be asked so perhaps better would be infrequently asked questions, IAQs).
.RE
\fIgameplay.md\fP
.RS
Includes information on how to play, demonstrates some of the features and describes many gameplay modes.
.RE
\fItroubleshooting.md\fP
.RS
Information to help work out any possible problems as well as show how to configure and restore terminal dimensions for the game.
.RE
\fIterminals.md\fP
.RS
A troubleshooting guide focusing more on terminals.
.RE
\fICOMPILING.md\fP
.RS
Information on Portability, C standards as well as (for the IOCCC judges) both Justifications for certain things and lints.
.RE
\fIHACKING.md\fP
.RS
Documentation on how to modify the input keys, colours, wall, bug and snake chars (to print), the status/score line and various other things.
Includes feature ideas as well as how one might implement them.
.RE
\fIspoilers.md\fP
.RS
Technical details that give more away about how the program works (\fIHACKING\fP also does a bit of this).
.RE
\fIMakefile\fP
.RS
To build the terminal capabilities test utility and the Snake game itself.
.RE
\fIsnake-colours.sh\fP
.RS
Helper script to compile the game with player selected colours.
.RE
\fIbugs.md\fP
.RS
List of bugs and things that might appear to be bugs that aren't, were once bugs etc.
.RE
\fIchocolate\-cake.md\fP
.RS
The judges love chocolate and who can blame them? This is something of a speciality of my mum's but it's a delicious cake that even my late stepmum (who only liked white chocolate) loved! Double\-layer chocolate fudge cake.
.RE
\fItermcaps.c\fP
.RS
Source file to test terminal support for the used capabilities the Snake game uses.
.RE
\fIsnake.1\fP
.RS
See this file to see the manual i.e. this file.
Don't get lost in the snake pit!
.RE
\fIcannibalism.log.md\fP
.RS
A screen dump of what cannibalism can look like right before winning.
.RE
\fIcrazy.log.md\fP
.RS
Screen dumps of the positive/push - negative/shrink mode.
.RE
\fIplay.sh\fP
.RS
Script that prompts if you want to reconfigure colours and then gives you a menu that runs some preconfigured game modes.
This script essentially combines \fIsnake-colours\fP with some preset modes that you can select from a menu.
.RE
\fIprog.2.c\fP, \fIprog.3.c\fP, \fIprog.3-j.c\fP, \fIprog.alt.c\fP
.RS
Other versions I submitted. \fIprog.2.c\fP is the second version; \fIprog.3.c\fP and \fIprog.3-j.c\fP were the third where the \fI-j\fP version was a minor change to the J define.
\fIprog.alt.c\fP is the file that has support for colour customisation of the bug (this would have broken rule 2a/b so I could not submit it as my primary version).
It also clears the screen before playing to try and maintain terminal sanity should you pass the LINES environmental variable to the program.
.RE
.RE
.SH NOTES
The concept of shedding in this game is a misnomer.
This is how snakes grow in the wild so it is a misnomer here because snakes don't grow in the manner that the original Snake game was designed.
.SH BUGS
.PP
The screen keeps showing bugs (that aren't bugs :-) )!
.PP
There's no boss screen.
.PP
It was written by a human being.
.PP
Technically walls, snakeskin and the snake itself would \fBnot\fP be an obstacle in real life.
The shed snakeskin is not an obstacle but walls can be and so can the snake itself.
Also snakes grow by moulting (technical term for shedding) so when the snake leaves its snakeskin behind it really ought to grow but instead it shrinks; this means negative shedding ought to have the snake grow and positive shedding have the snake - what?
It's a misnomer: it took fewer bytes and the negative shedding is a positive consequence of unsigned arithmetic.
.PP
On a more serious note see \fB\<https://www.ioccc.org/2020/ferguson1/bugs.html\>\fP.
.SH EXAMPLES
.PP
Test your terminal capabilities and get other various data (based on dimensions of terminal, growth size, size and max size as specified i.e. you can pass in the variables \fBLINES\fP, \fBCOLUMNS\fP, \fBMAXSIZE\fP, \fBGROW\fP and \fBSIZE\fp):
.nf
.RS
\fB
make test\fP
.fi
.RE
.PP
This is imperfect!
.PP
Allow the snake to go through itself but not through walls, make the snake move at 400ms and start out at size 7:
.nf
.RS
\fB
CANNIBAL=1 WALLS=0 WAIT=400 SIZE=7 ./snake\fP
.fi
.RE
.PP
Let the snake go through itself and the walls, make the bug stay put until it's eaten, have the snake grow by 7 every 150 snake movements, start out at size 4 and grow by 7 every time a bug is eaten:
.PP
.RS
.nf
\fBCANNIBAL=1 WALLS=1 EVADE=0 SHED=150 SHEDS=7 SIZE=4 GROW=7 ./snake\fP
.fi
.RE
.PP
Allow the game to play by itself, winning, after starting the game (move in a direction) (\fBDON'T TRY IF YOU HAVE EPILEPSY!\fP):
.nf
.RS
\fB
CANNIBAL=1 WAIT=0 MAXSIZE=30 SIZE=0 EVADE=1\fP ./snake
.fi
.RE
.PP
That allows the snake to go through itself, makes the max size fairly small (to make it easier to win and quicker), sets the size to 0 (start with only the head) and make the bug move every time the snake moves (and does not catch it). Once you move the snake a direction it moves so quickly that because the bug is evading the snake inevitably runs into the bug thus growing in size etc.
.PP
Run script that prompts for the colours to be used, compiles and then runs the game (with environmental variables passed in):
.nf
.RS
\fBCANNIBAL=1 SIZE=15 MAXSIZE=45 WALLS=0 ./snake-colours\fI
.fi
.RE
.PP
That will compile the game to be the colours you select and then enable cannibalism, set the starting size to 15, max size to 45 and walls are made impassable.
.PP
For many more gameplay information, modes and features check:
.br
\fB\<https://www.ioccc.org/2020/ferguson1/gameplay.html\>\fP
and for an interactive script that prompts for some of those modes see the \fIplay.sh\fP script.
.SH AUTHOR
Written by Cody Boone Ferguson for IOCCC 2020 (the 27th IOCCC).
.SH SEE ALSO
.PP
\fB\<https://ioccc.xexyl.net/2020/snake\>\fP The 27th IOCCC 'Don't tread on me award' winning entry.