remove bold code
Remove markdown where test is both bold and code. This double formatting produces undesirable effects in HTML. One should make something **bold** or something `code`. but not both. The stacking of these two options produces bad effects when rendered.
This commit is contained in:
1 parent
467ad5fa9f
commit
ec6dc7187e
8 files changed
+52
-52
No files matched your search
@@ -28,7 +28,7 @@ requiring a fix.
|
||||
|
||||
* I am keeping the weasel.spec file in the entry as it was part of my
|
||||
submission but I do not explain here how to set up the build environment or how
|
||||
to build a RPM: if you know how to use **`rpmbuild`** then you should be able to
|
||||
to build a RPM: if you know how to use **rpmbuild** then you should be able to
|
||||
work it out. Again that's a crazy idea but again it was there and it was part of
|
||||
the judges' comments (which I liked a lot) which is yet another reason I kept
|
||||
it.
|
||||
|
||||
+21
-21
@@ -28,59 +28,59 @@ and non-zero).
|
||||
|
||||
### Variables:
|
||||
|
||||
* **`WAIT`**\
|
||||
* **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.
|
||||
|
||||
* **`WALLS`**\
|
||||
* **WALLS**\
|
||||
whether the walls are passable or impassable. Default passable,
|
||||
1; 0 makes walls impassable where you die if you hit a wall.
|
||||
|
||||
* **`EVADE`**\
|
||||
* **EVADE**\
|
||||
how many movements the Snake moves before the bug (well
|
||||
insect; see notes below about why bugs) will move to
|
||||
another location in the field. Default 300; 0 disables.
|
||||
|
||||
* **`SIZE`**\
|
||||
* **SIZE**\
|
||||
initial size of the Snake. Note that it grows by one per
|
||||
move so at the default 5 it will not initially be 5
|
||||
characters long! < 0 is likely an immediate win.
|
||||
|
||||
* **`MAXSIZE`**\
|
||||
* **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 **`SIZE+GROW >=
|
||||
MAXSIZE`** you win _before_ you grow to the full size!
|
||||
dimensions to prevent problems. Note that when **SIZE+GROW >=
|
||||
MAXSIZE** you win _before_ you grow to the full size!
|
||||
|
||||
* **`GROW`**\
|
||||
* **GROW**\
|
||||
size to grow every time you eat a bug. Default 5; negative
|
||||
values are allowed. 'Negativity' creates for fun gameplay modes with
|
||||
enough creativity. See [gameplay.html](gameplay.html)
|
||||
GitHub) as well as [play.sh](play.sh) for some examples.
|
||||
|
||||
* **`SHED`**\
|
||||
every **`SHED`** movements you will grow (> 0), shrink (< 0) or
|
||||
stay the same length (0) by the **`SHEDS`** (below) value. Again
|
||||
* **SHED**\
|
||||
every **SHED** movements you will grow (> 0), shrink (< 0) or
|
||||
stay the same length (0) by the **SHEDS** (below) value. Again
|
||||
with creativity you can create some fun gameplay modes. NOTE:
|
||||
the concept of shedding in this game is a misnomer; see notes
|
||||
below.
|
||||
|
||||
* **`SHEDS`**\
|
||||
every **`SHED`** movements will impact what this value means: grow
|
||||
* **SHEDS**\
|
||||
every **SHED** movements will impact what this value means: grow
|
||||
(> 0), shrink (< 0) or not at all (0). Exception: if the snake
|
||||
eats a bug the counter isn't incremented. Again with creativity
|
||||
you can create some fun gameplay modes here. For instance you
|
||||
can grow upon eating a bug but shrink every **`SHED`** movements
|
||||
and then it's a battle of whether you win by **`SIZE < 0`** or
|
||||
**`SIZE >= MAXSIZE`**. See [play.sh](play.sh) for examples.
|
||||
can grow upon eating a bug but shrink every **SHED** movements
|
||||
and then it's a battle of whether you win by **SIZE < 0** or
|
||||
**SIZE >= MAXSIZE**. See [play.sh](play.sh) for examples.
|
||||
NOTE: the concept of shedding in this game is a misnomer; see
|
||||
notes below.
|
||||
|
||||
* **`CANNIBAL`**\
|
||||
* **CANNIBAL**\
|
||||
whether you can go through the Snake or not. Default is 0
|
||||
(cannot - die if you try).
|
||||
|
||||
@@ -158,17 +158,17 @@ file modify the behaviour of Snake.
|
||||
|
||||
Here are some other features of the game:
|
||||
|
||||
* A drawing/practising mode (**`WAIT`** < 0 makes `timeout()` block).
|
||||
* A drawing/practising mode (**WAIT** < 0 makes `timeout()` block).
|
||||
|
||||
* Computer plays the game (**WAIT=0**).\
|
||||
- **EPILEPSY/STIMULATION OVERLOAD WARNING** included in the relevant
|
||||
section (this goes for a low **`EVADE`** value too).
|
||||
section (this goes for a low **EVADE** value too).
|
||||
|
||||
* Grow-Shrink mode (Positive and Negative Winning) mode (see
|
||||
[gameplay.html](gameplay.html) for more details).
|
||||
|
||||
* The dimensions of the game (this is actually a terminal thing but I document
|
||||
how to do this and its potential pitfalls) (**`LINES`** , **`COLUMNS`**).
|
||||
how to do this and its potential pitfalls) (**LINES** , **COLUMNS**).
|
||||
|
||||
There are no complicated command line invocations; it's just a matter of passing
|
||||
into the game descriptively named variables and I include a script that sets up
|
||||
@@ -432,7 +432,7 @@ a pun and every pun deserves to be shed).
|
||||
They grow through a process called moulting - shedding their skin (other
|
||||
creatures also moult). This takes place over some days and unlike humans snakes
|
||||
never stop growing (though growth slows down as they mature). I chose the
|
||||
variables **`SHED`** and **`SHEDS`** for simplicity and because the words are
|
||||
variables **SHED** and **SHEDS** for simplicity and because the words are
|
||||
shorter. I don't like the words because it's rather a misnomer but what I had
|
||||
chosen before was longer - STRETCH and STRETCHES.
|
||||
|
||||
|
||||
@@ -7,9 +7,9 @@ to distinguish what is what.
|
||||
|
||||
# Examples
|
||||
|
||||
In the below game dumps I have replaced the bug with **`B`**, the head with
|
||||
**`H`** and where it is known, the tail with **`T`**, in order to help
|
||||
distinguish where they are. Since the head is replaced with **`H`** I have noted
|
||||
In the below game dumps I have replaced the bug with **B**, the head with
|
||||
**H** and where it is known, the tail with **T**, in order to help
|
||||
distinguish where they are. Since the head is replaced with **H** I have noted
|
||||
the direction it was moving above each dump as well as at the right of the line;
|
||||
each line with a bug, the head or tail is marked with upper case text at the
|
||||
right to make it easier to find.
|
||||
|
||||
@@ -423,14 +423,14 @@ inside itself.
|
||||
|
||||
# <a name="shedding" href="#toc">Gameplay: Shedding (stretching)</a>
|
||||
|
||||
This feature will make you grow by the value of **`SHEDS`** for every **`SHED`**
|
||||
This feature will make you grow by the value of **SHEDS** for every **SHED**
|
||||
movements (the counter isn't incremented when you eat a bug). Basically growing
|
||||
without eating a bug (stretching would be better name here).
|
||||
|
||||
|
||||
# <a name="winning" href="#toc">Gameplay: Winning</a>
|
||||
|
||||
If you ever get to the **`MAXSIZE`** the game is won. You can force a win by
|
||||
If you ever get to the **MAXSIZE** the game is won. You can force a win by
|
||||
setting the max size to a smaller value than the size you specify (or the
|
||||
default) or setting the size to higher than the default (or < 0 which will end
|
||||
up being > the max size though I suppose there might be some value that makes it
|
||||
@@ -492,7 +492,7 @@ the modes below.
|
||||
## <a name="warning" href="#toc">Photosensitive epilepsy/Stimulation overload trigger warnings</a>
|
||||
|
||||
If you have **photosensitive epilepsy please be careful** especially with low values
|
||||
for both **`WAIT`** and **`EVADE`**. It appears that the [number of hertz (flashes)
|
||||
for both **WAIT** and **EVADE**. It appears that the [number of hertz (flashes)
|
||||
per second triggering seizures][] is wide but depending on the variables it
|
||||
easily can be in the range.
|
||||
|
||||
@@ -824,7 +824,7 @@ snake to move slower you have to increase the wait time!
|
||||
|
||||
## <a name="evade" href="#toc">EVADE: Bug evasion frequency</a>
|
||||
|
||||
For every **`EVADE`** snake movements the bug will try and find a new place to
|
||||
For every **EVADE** snake movements the bug will try and find a new place to
|
||||
occupy. It might be very close to it and I do not ensure it's a new place at
|
||||
all.
|
||||
|
||||
|
||||
@@ -75,8 +75,8 @@ will take to win the game. The max bugs in the `bugs` line is approximately
|
||||
`max_snake_size / growth_size` i.e. how many bugs it'll take to win at the
|
||||
maximum (capped) snake size.
|
||||
|
||||
If I pass in any of the variables **`GROW`**, **`MAXSIZE`**, **`SIZE`** and/or
|
||||
**`LINES`** or **`COLUMNS`** it bases its calculations on those variables. For
|
||||
If I pass in any of the variables **GROW**, **MAXSIZE**, **SIZE** and/or
|
||||
**LINES** or **COLUMNS** it bases its calculations on those variables. For
|
||||
example:
|
||||
|
||||
```sh
|
||||
|
||||
@@ -432,7 +432,7 @@ X:0/157 Y:0/42 S:3/18446744073709551614 B:0
|
||||
```
|
||||
|
||||
|
||||
BTW: There are two arrays that have to be **`MAXSIZE`** (technically + 1).
|
||||
BTW: There are two arrays that have to be **MAXSIZE** (technically + 1).
|
||||
|
||||
Is it possible that some value specified by the user could mess this up? I do
|
||||
not know but what I do know is that because it's unsigned it can't be negative;
|
||||
|
||||
@@ -245,7 +245,7 @@ clang** despite the fact it might appear to be gcc: no symlink and both gcc and
|
||||
clang exist but the gcc is clang which you'll see if you run `gcc --version`.
|
||||
|
||||
A tip and some fix methods from Cody: in the older days args to main() not given
|
||||
a type were implicit ints but when they're required to be `char **` this can
|
||||
a type were implicit ints but when they're required to be `char ** this can
|
||||
cause a problem. In some cases Cody was able to use a `char *` inside `main()`
|
||||
(see [1989/tromp/tromp.c](1989/tromp/tromp.c) and
|
||||
[1986/holloway/holloway.c](1986/holloway) for two examples though done slightly
|
||||
@@ -3104,7 +3104,7 @@ This program supports only "Combinator-calculus style notation" of Lazy K.
|
||||
"Unlambda style" and "Iota and Jot" style are not supported.
|
||||
|
||||
Also, it requires a space between identifiers. In short, use `(S K)` instead of
|
||||
`(SK)`, "\`sk", `**i*i*i*ii*i*i*ii`, or `11111100011100`.
|
||||
`(SK)`, "\`sk", **i*i*i*ii*i*i*ii`, or `11111100011100`.
|
||||
|
||||
Huge memory may be required to compile the program (about 300 MB on my machine).
|
||||
|
||||
|
||||
+18
-18
@@ -89,7 +89,7 @@ char x {sizeof(
|
||||
```
|
||||
|
||||
This does mean that there cannot be a second arg to `main()`
|
||||
as clang requires that to be a `char **` and the `char` redefined would not
|
||||
as clang requires that to be a `char ** and the `char` redefined would not
|
||||
allow this. Some versions of clang say that `main()` must have either 0, 2 or 3
|
||||
args but these versions do not object to 1 arg. However as the `char` macro
|
||||
seems more obscure and it is possible that a new version of clang will be even
|
||||
@@ -102,7 +102,7 @@ parameter. It has never been observed to be an error to pass in too many
|
||||
parameters to a function (`main()` or otherwise - it warns with other functions
|
||||
but does not appear to with `main()`) but only that `main()` itself has a
|
||||
certain number of args (in some versions) and that the first arg is an `int` and
|
||||
the others are `char **`s. This is why the arg was removed and the call to
|
||||
the others are `char **s. This is why the arg was removed and the call to
|
||||
`main()` was not updated beyond what had to be done to fix it for compilers that
|
||||
do not support `-traditional-cpp`.
|
||||
|
||||
@@ -363,7 +363,7 @@ program the added `input.txt` file.
|
||||
|
||||
[Cody](#cody) fixed this to compile and work with clang (it already worked with gcc).
|
||||
The problem was that clang is more strict about the type of second arg to
|
||||
`main()`. However simply changing it to a `char **` and updating the `*s` to `**s`
|
||||
`main()`. However simply changing it to a `char ** and updating the `*s` to **s`
|
||||
caused a segfault. By adding a new variable, `char *t`, initialising it to `s`
|
||||
and then using `t` instead of `s` it compiles and runs successfully under clang
|
||||
and gcc.
|
||||
@@ -732,12 +732,12 @@ publication, in the remarks, to help understand the entry, and for fun.
|
||||
## <a name="1988_phillipps"></a>[1988/phillipps](1988/phillipps/phillipps.c) ([index.html](1988/phillipps/index.html]))
|
||||
|
||||
[Cody](#cody) fixed this for modern systems. It did not compile with clang because it
|
||||
requires the second and third args of `main()` to be `char **` but even before
|
||||
requires the second and third args of `main()` to be `char ** but even before
|
||||
that with gcc it printed garbage and then crashed.
|
||||
|
||||
After fixing it for clang by changing the very `main()` (in fact it called
|
||||
itself up to 12 times!) to call the new function `pain()` (chosen because it's a
|
||||
pain that clang requires these args to be `char **` :-), which is just as
|
||||
pain that clang requires these args to be `char ** :-), which is just as
|
||||
recursive, with the correct args it now works with both gcc and clang.
|
||||
|
||||
Later Cody improved the fix to make it look a bit more like the original, using
|
||||
@@ -978,7 +978,7 @@ might just not be possible.
|
||||
The way it was fixed might be hard to see and describe but this is an attempt.
|
||||
Because `main()`'s args were all `int`s, `main()` had to call a new function
|
||||
which is allowed to have args as `int` (instead of `main()`'s args being int and
|
||||
the rest being `char **`) but this is not as straight forward as it is for other
|
||||
the rest being `char **) but this is not as straight forward as it is for other
|
||||
entries (if you look at the code you might see what is meant; the function called
|
||||
is `pain()`).
|
||||
|
||||
@@ -987,9 +987,9 @@ four**, even though the original program has four args. This is because not all
|
||||
versions of clang support four args and that is one of the issues with version 2
|
||||
and 3 as it generates `main()` to have four args and the wrong type, all `int`s.
|
||||
|
||||
In the call to the new function, `pain()`, from `main()`, one of the `char **`s
|
||||
In the call to the new function, `pain()`, from `main()`, one of the `char **s
|
||||
is used twice, once as `argc` with bitwise AND with 2, naturally first being
|
||||
cast to an `int` (`(int)ABBA&2`), and once as a `char **`, the fourth arg to
|
||||
cast to an `int` (`(int)ABBA&2`), and once as a `char **, the fourth arg to
|
||||
`pain()` (yes even though `pain()` takes all `int`s).
|
||||
|
||||
The argc,, meanwhile, `tang`, is used once and the second arg, `char **gnat` is
|
||||
@@ -997,7 +997,7 @@ used once (observe how `tang` is `gnat` spelt backwards as this is one of the
|
||||
things that makes this a masterpiece and very hard if not impossible to fix
|
||||
completely). Fortunately it is not actually necessary to use all four args (of
|
||||
`main()`) in the call which might or might not be surprising, especially as it
|
||||
uses one of the args, a `char **`, instead of an `int` (through casts), twice
|
||||
uses one of the args, a `char **, instead of an `int` (through casts), twice
|
||||
rather than just passing in for the fourth arg (the fourth arg passed in is the
|
||||
third arg to `main()`).
|
||||
|
||||
@@ -1710,8 +1710,8 @@ both numbers (using `"%o %o"` does not solve the problem).
|
||||
## <a name="1992_westley"></a>[1992/westley](1992/westley/westley.c) ([index.html](1992/westley/index.html]))
|
||||
|
||||
[Cody](#cody) fixed this to work for clang by changing the third and fourth arg of
|
||||
`main()` to be `char **` inside `main()`; clang requires args 2 - 4 to be `char
|
||||
**` and some versions do not even allow a fourth arg.
|
||||
`main()` to be `char ** inside `main()`; clang requires args 2 - 4 to be `char
|
||||
** and some versions do not even allow a fourth arg.
|
||||
|
||||
He also added the alternate version that the author gave in the remarks that is
|
||||
specifically for the USA rather than the world. This had to be fixed for clang
|
||||
@@ -1856,13 +1856,13 @@ compile time. See the index.html for details.
|
||||
## <a name="1993_vanb"></a>[1993/vanb](1993/vanb/vanb.c) ([index.html](1993/vanb/index.html]))
|
||||
|
||||
[Cody](#cody) fixed this to work with clang. The problem was that the third arg to main()
|
||||
was not a `char **`. Instead `O5()` (which was `main()` via `-DO5=main`) is now
|
||||
was not a `char **. Instead `O5()` (which was `main()` via `-DO5=main`) is now
|
||||
its own function which main() calls with the right parameters.
|
||||
|
||||
Later Cody fixed it again to look much more like the original where only a
|
||||
single line is added, that of `main()`, which calls `O5()`. This was done through
|
||||
`-include stdio.h` at the compiler (in the Makefile) and by removing the `O3`
|
||||
variable (an int) at the top of the file, instead making it a `char **` in
|
||||
variable (an int) at the top of the file, instead making it a `char ** in
|
||||
`main()` (`O5()` had three args) but then passing in `0` to `O5()` for the third
|
||||
arg (as it was 0 at file scope already this is perfectly fine and it means
|
||||
there's no need to cast it to an int in the function call though that would also
|
||||
@@ -2838,7 +2838,7 @@ by Yusuke.
|
||||
## <a name="2001_cheong"></a>[2001/cheong](2001/cheong/cheong.c) ([index.html](2001/cheong/index.html]))
|
||||
|
||||
[Cody](#cody) fixed this to work with clang by adding another function that is allowed to
|
||||
have a third arg as an int, not a `char **`. He chose `pain()` because it's a four
|
||||
have a third arg as an int, not a `char **. He chose `pain()` because it's a four
|
||||
letter word that would match the format and because it's pain that clang forces
|
||||
this. :-) This fix makes a point of the author's notes on portability no longer
|
||||
valid, BTW.
|
||||
@@ -2932,7 +2932,7 @@ Cody also added the [try.sh](2001/herrmann1/try.sh) script.
|
||||
|
||||
[Cody](#cody) fixed this to work with both 64-bit and 32-bit compilers by changing most
|
||||
of the `int`s (all but that in `main(int ...)`) to `long`s. He also fixed it to
|
||||
compile with clang by changing the args of main to be `int` and `char **`,
|
||||
compile with clang by changing the args of main to be `int` and `char **,
|
||||
respectively, and changing specific references to the `argv` arg, casting to
|
||||
`long` (was `int` but the 64-bit fix requires `long`) which was its old type.
|
||||
|
||||
@@ -3537,7 +3537,7 @@ back for arrow keys in the [alternate version](2006/night/night.alt.c).
|
||||
## <a name="2006_sloane"></a>[2006/sloane](2006/sloane/sloane.c) ([index.html](2006/sloane/index.html]))
|
||||
|
||||
[Cody](#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.
|
||||
|
||||
Cody also provided the [alternate version](2006/sloane/sloane.alt.c), which
|
||||
@@ -3823,9 +3823,9 @@ Cody also fixed a typo in the ruby script
|
||||
|
||||
[Cody](#cody) added the [try.sh](2012/grothe/try.sh) script.
|
||||
|
||||
Cody also changed `argv` to be not `const char **` but `char **`, mostly out of an
|
||||
Cody also changed `argv` to be not `const char ** but `char **, mostly out of an
|
||||
abundance of caution in case clang, which already imposes restrictions on the
|
||||
types of args to `main()` including to do with `char **`, decides to further
|
||||
types of args to `main()` including to do with `char **, decides to further
|
||||
restrict them.
|
||||
|
||||
Cody also restored the original code from the archive.
|
||||
|
||||
Reference in new issue
Block a user