Format and other fixes in 2020/ferguson1

Fixed formatting in the markdown files. I did not check for typos due to
the fact I wrote so much (which I'm only sorry about in the sense that
it's too much to go through for almost everyone and this might make some
people miss useful/interesting things. If I had 'more "time" ' maybe I
could shorten it but I don't).

Renamed crazy.log to crazy.log.md. Updated Makefile for the DATA
variable.

Corrected file names in some cases.

Fixed formatting in man page.

There is one other change I have in 2020/ferguson1 but it's also needed
in 2020/ferguson2 so I'll do that at the same time.
This commit is contained in:
Cody Boone Ferguson committed 2023-04-16 10:09:33 -07:00
1 parent a7e018d5e8
commit 49a6a4074d
11 files changed
+894 -732

No files matched your search

+113 -125
View File
@@ -2,50 +2,27 @@
.SH NAME
snake \- Feature\-rich curses implementation of the classic 'Snake' game with many gameplay modes and options for IOCCC 2020
.SH SYNOPSIS
\fBsnake\fP
\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
.br
where
.I N
is a number and
.I [01]
is either
.I 1
or
.I 0
(or more correctly zero and non-zero).
.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.
\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!
Some of the configurable features are:
.PP
Besides the environmental variables (described below) that create for a lot of gameplay modes, here are some additional features:
.PP
.RS
\fB\-\fP The speed of the snake (how many milliseconds to \fBWAIT\fP for input before moving; \fIdefault 231 milliseconds\fP and you can move faster by pressing the direction key quicker or or even holding it down).
.RE
.PP
.RS
\fB\-\fP If the bug (to eat) will move (\fBEVADE\fP) after user\-specified number of snake moves (\fIdefault 300, 0 disables\fP).
.RE
.PP
.RS
\fB\-\fP If the snake can go through \fBWALLS\fP (coming out at the opposite wall) (\fIdefault 1, yes\fP).
.RE
.PP
.RS
\fB\-\fP If the snake can go through itself (\fBCANNIBAL\fP) (\fIdefault 0, no\fP).
.RE
.PP
.RS
\fB\-\fP The initial \fBSIZE\fP of the snake (\fIdefault 5\fP).
.RE
.PP
.RS
\fB\-\fP The size the snake must become in order to win the game (\fBMAXSIZE\fP, \fIdefault 997\fP).
.RE
.PP
.RS
\fB\-\fP How much to \fBGROW\fP each time a bug is eaten (\fIdefault 5\fP, can be negative).
.RE
.PP
.RS
\fB\-\fP How many moves (\fBSHED\fP, \fIdefault 0, disabled\fP) before 'stretching' (grow) (\fBSHEDS\fP, \fIdefault 5\fP; can be negative).
This is how snakes grow in the wild so is a misnomer here because snakes don't grow in the manner that the original Snake game was designed.
.RS
\fB\- Exception\fP: If the bug is eaten the counter isn't incremented.
.RE
.RE
.PP
.RS
\fB\-\fP A drawing mode (\fBWAIT < 0\fP makes \fBtimeout()\fP set blocking read).
\fB\-\fP A drawing mode (\fBWAIT < 0\fP makes \fBtimeout()\fP block).
.RE
.PP
.RS
@@ -58,10 +35,6 @@ This is how snakes grow in the wild so is a misnomer here because snakes don't g
.RE
.PP
.RS
\fB\-\fP The dimensions of the game (this is actually a terminal thing but I document how to do this and its potential pitfalls) (\fBLINES\fP, \fBCOLUMNS\fP).
.RE
.PP
.RS
\fB\-\fP Different colours and characters for the bug, snake head, snake and walls:
.RS
\fB\-\fP Bug is \fB*\fP (white).
@@ -81,69 +54,89 @@ This is how snakes grow in the wild so is a misnomer here because snakes don't g
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.
.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 \fIgameplay.md\fP/\fIgameplay.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.
NOTE: the concept of shedding in this game is a misnomer.
\fB\- Exception\fP: if the bug is eaten the counter isn't incremented.
This is how snakes grow in the wild so is a misnomer here because snakes don't grow in the manner that the original Snake game was designed.
.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 gameplay.html
for examples.
\fB\- Exception\fP: if the bug is eaten the counter isn't incremented.
NOTE: the concept of shedding in this game is a misnomer.
\fB\-\fP How many moves (\fBSHED\fP, \fIdefault 0, disabled\fP) before 'stretching' (grow) (\fBSHEDS\fP, \fIdefault 5\fP; can be negative).
This is how snakes grow in the wild so is a misnomer here because snakes don't grow in the manner that the original Snake game was designed.
.PP
\fBGROW\fP
.RS
How much to grow each time a bug is eaten.
Negative growth is a different gameplay mode.
\fIDefault 5\fP.
.RE
\fBSIZE\fP
.RS
The initial size of the snake.
\fIDefault 5\fP.
.RE
\fBMAXSIZE\fP
.RS
The max snake size (the size the snake must become to win).
\fIDefault 997\fP.
Limits are always imposed depending on the size of the terminal.
Negative number sets to max size based on terminal size.
.RE
\fBWAIT\fP
.RS
The number of milliseconds to wait for input (how fast the snake moves).
\fIDefault 231\fP.
\fI0\fP has no delay: the computer will play by itself (though you can still change directions).
\fI< 0\fP is drawing mode (makes \fIgetch()\fP block).
.RE
\fBEVADE\fP
.RS
The number of movements before the bug tries to move to a new place (evading the snake).
\fIDefault 300\fP (0 disables).
.RE
\fBWALLS\fP
.RS
Whether the snake can go through walls.
\fIDefault 1\fP (yes).
.RE
\fBCANNIBAL\fP
.RS
Whether the snake can go through itself.
\fIDefault 0\fP (no).
.RE
\fBSHED\fP
.RS
How many moves before the snake 'moults' (shedding of skin to make room for growth).
Again this isn't technically accurate in Snake.
\fIDefault 0\fP (disabled).
.RE
\fBSHEDS\fP
.RS
The amount to grow by each time the snake sheds its skin.
\fIDefault 5\fP.
.RE
.PP
The following two modify the terminal dimensions (this is not part of the game but the terminal/curses itself):
.PP
\fBLINES\fP
.RS
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.
.RE
\fBCOLUMNS\fP
.RS
.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.
@@ -155,7 +148,7 @@ The markdown files have html counterparts; for some of these the html version is
.RS
Source file to the Snake game (IOCCC entry source file).
.RE
\fIremarks.markdown\fP
\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).
@@ -172,16 +165,16 @@ Information to help work out any possible problems as well as show how to config
.RS
A troubleshooting guide focusing more on terminals.
.RE
\fICOMPILING\fP
\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\fP
\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.markdown\fP
\fIspoilers.md\fP
.RS
Technical details that give more away about how the program works (\fIHACKING\fP also does a bit of this).
.RE
@@ -189,7 +182,7 @@ Technical details that give more away about how the program works (\fIHACKING\fP
.RS
To build the terminal capabilities test utility and the Snake game itself.
.RE
\fIsnake-colours\fP
\fIsnake-colours.sh\fP
.RS
Helper script to compile the game with player selected colours.
.RE
@@ -197,7 +190,7 @@ Helper script to compile the game with player selected colours.
.RS
List of bugs and things that might appear to be bugs that aren't, were once bugs etc.
.RE
\fIchocolate\-cake.markdown\fP
\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
@@ -210,13 +203,13 @@ Source file to test terminal support for the used capabilities the Snake game us
See this file to see the manual i.e. this file.
Don't get lost in the snake pit!
.RE
\fIcannibalism.log\fP
\fIcannibalism.log.md\fP
.RS
A screen dump of what cannibalism can look like right before winning.
.RE
\fIcrazy.log\fP
\fIcrazy.log.md\fP
.RS
A screen dump of the positive/push - negative/shrink mode.
Screen dumps of the positive/push - negative/shrink mode.
.RE
\fIplay.sh\fP
.RS
@@ -231,21 +224,16 @@ It also clears the screen before playing to try and maintain terminal sanity sho
.RE
.RE
.SH BUGS
.RS
\fB\-\fP The screen keeps showing bugs!
.RE
.RS
\fB-\fP There's no boss screen.
.RE
.RS
\fB\-\fP It was written by a human being.
.RE
.RS
\fB\-\fP Technically walls, snakeskin and the snake itself would \fBnot\fP be an obstacle in real life.
\fB\-\fP the screen keeps showing bugs!
.br
\fB\-\fP there's no boss screen.
.br
\fB\-\fP it was written by a human being.
.br
\fB\-\fP 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.
.RE
.PP
On a more serious note see the \fBbugs.md\fP file.
.SH EXAMPLES
@@ -300,4 +288,4 @@ For more gameplay information and modes check \fIgameplay.md\fP; and for an inte
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'.
\fB\<https://ioccc.xexyl.net/2020/snake\>\fP The 27th IOCCC 'Don't tread on me' award.