fix links in entry HTML files other than index.html
Fixed internal links in entry HTML files other than index.html. Removed links to markdown files that otherwise used to generate HTML files other than index.html. Ran `make gen_other_html` to perform the above.
This commit is contained in:
1 parent
2d3712ed36
commit
99cf726783
38 files changed
+644
-357
No files matched your search
@@ -139,14 +139,14 @@
|
||||
<p>The source code of the font is <a href="glyphs.txt">glyphs.txt</a>, which is a sequence of
|
||||
chunks that is a ASCII code (65-90) followed by points data: <code>x,y,ctrl</code>.</p>
|
||||
<p>If <code>ctrl</code> is 1, the point is used as control point for quadratic bezier curve.</p>
|
||||
<p><a href="code.c">code.c</a> is the main logic for the program, which has some placeholders
|
||||
<p><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/endoh2/code.c">code.c</a> is the main logic for the program, which has some placeholders
|
||||
for font data and something.</p>
|
||||
<p>It decompresses the font data and renders a given text by projection. It
|
||||
exploits <code>C99</code>’s <code>double complex</code> type to represent 2D points, but carefully
|
||||
coded so that it does not require any <code>math.h</code> functions; you don’t have to pass
|
||||
<code>-lm</code> to <code>cc</code>.</p>
|
||||
<p><a href="tmpl.txt">tmpl.txt</a> is a template for the program. <a href="gen.rb">gen.rb</a> composes
|
||||
the all items and generates <a href="prog.c">prog.c</a>.</p>
|
||||
<p><a href="tmpl.txt">tmpl.txt</a> is a template for the program. <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/endoh2/gen.rb">gen.rb</a> composes
|
||||
the all items and generates <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/endoh2/prog.c">prog.c</a>.</p>
|
||||
<hr style="width:10%;text-align:left;margin-left:0">
|
||||
<p>Jump to: <a href="#">top</a></p>
|
||||
<!--
|
||||
|
||||
@@ -7,7 +7,7 @@ chunks that is a ASCII code (65-90) followed by points data: `x,y,ctrl`.
|
||||
|
||||
If `ctrl` is 1, the point is used as control point for quadratic bezier curve.
|
||||
|
||||
[code.c](code.c) is the main logic for the program, which has some placeholders
|
||||
[code.c](%%REPO_URL%%/2020/endoh2/code.c) is the main logic for the program, which has some placeholders
|
||||
for font data and something.
|
||||
|
||||
It decompresses the font data and renders a given text by projection. It
|
||||
@@ -15,8 +15,8 @@ exploits `C99`'s `double complex` type to represent 2D points, but carefully
|
||||
coded so that it does not require any `math.h` functions; you don't have to pass
|
||||
`-lm` to `cc`.
|
||||
|
||||
[tmpl.txt](tmpl.txt) is a template for the program. [gen.rb](gen.rb) composes
|
||||
the all items and generates [prog.c](prog.c).
|
||||
[tmpl.txt](tmpl.txt) is a template for the program. [gen.rb](%%REPO_URL%%/2020/endoh2/gen.rb) composes
|
||||
the all items and generates [prog.c](%%REPO_URL%%/2020/endoh2/prog.c).
|
||||
|
||||
|
||||
<hr style="width:10%;text-align:left;margin-left:0">
|
||||
|
||||
@@ -139,7 +139,8 @@ C99+ and ncurses; note that for some platforms (e.g. Red Hat based Linux) you
|
||||
will need two different packages: the library itself but also the dev package
|
||||
that has the header files etc. If you use the Makefile obviously you need <code>make</code>
|
||||
too.</p>
|
||||
<p>In <a href="gameplay.md">gameplay.md</a> I show how to easily customise the colours, set up
|
||||
<p>In <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/ferguson1/gameplay.html">gameplay.html</a>
|
||||
I show how to easily customise the colours, set up
|
||||
different gameplay modes and various other things. The troubleshooting.md
|
||||
and terminals.md as well as bugs.md include a variety of information
|
||||
should you run into trouble.</p>
|
||||
@@ -162,7 +163,7 @@ matters; I only have Intel CPUs and arm64 (MacBook Pro M1).</p>
|
||||
<p>You don’t need Xcode itself and it appears that the command line tools (as above
|
||||
should install) already has ncurses so there shouldn’t be anything else that
|
||||
needs to be done. But I’m not actually sure of this - I’m seeing conflicting
|
||||
information and it’s been too long; anyway there’s always <a href="https://www.macports.org">MacPorts</a> and also
|
||||
information and it’s been too long; anyway there’s always [MacPorts][] and also
|
||||
Homebrew which should be sufficient; I do <em>NOT</em> recommend Homebrew however:
|
||||
it takes ownership of /usr/local: as in the user you run it as is the new owner
|
||||
so that you don’t need sudo because … Well never mind.</p>
|
||||
|
||||
@@ -4,7 +4,8 @@ will need two different packages: the library itself but also the dev package
|
||||
that has the header files etc. If you use the Makefile obviously you need `make`
|
||||
too.
|
||||
|
||||
In [gameplay.md](gameplay.md) I show how to easily customise the colours, set up
|
||||
In [gameplay.html](%%REPO_URL%%/2020/ferguson1/gameplay.html)
|
||||
I show how to easily customise the colours, set up
|
||||
different gameplay modes and various other things. The troubleshooting.md
|
||||
and terminals.md as well as bugs.md include a variety of information
|
||||
should you run into trouble.
|
||||
@@ -110,8 +111,6 @@ If it's an unsigned int I believe you will have to opt for an unsigned long (so
|
||||
Anything else I do not know other than just changing the typedef and updating to
|
||||
the proper function (and/or cast to the right type).
|
||||
|
||||
[MacPorts]: https://www.macports.org
|
||||
|
||||
|
||||
<hr style="width:10%;text-align:left;margin-left:0">
|
||||
|
||||
|
||||
@@ -217,9 +217,9 @@ but that changes the background of the program anyway.</p>
|
||||
COLOR_MAGENTA
|
||||
COLOR_CYAN
|
||||
COLOR_WHITE</code></pre>
|
||||
<p>See Linux Journal for more information article
|
||||
<a href="https://www.linuxjournal.com/content/programming-color-ncurses" class="uri">https://www.linuxjournal.com/content/programming-color-ncurses</a> for more
|
||||
details.</p>
|
||||
<p>See <a href="https://www.linuxjournal.com/content/programming-color-ncurses">Linux Journal for more information
|
||||
article</a>
|
||||
for more details.</p>
|
||||
<h2 id="modifying-the-characters-for-the-wall-bug-and-snake">Modifying the characters for the wall, bug and snake</h2>
|
||||
<p>For the wall, bug and snake body characters you can replace the following in the
|
||||
source code (<strong>include the single quotes!</strong>) respectively:</p>
|
||||
|
||||
@@ -100,9 +100,9 @@ The standard colour identifiers are:
|
||||
```
|
||||
|
||||
|
||||
See Linux Journal for more information article
|
||||
<https://www.linuxjournal.com/content/programming-color-ncurses> for more
|
||||
details.
|
||||
See [Linux Journal for more information
|
||||
article](https://www.linuxjournal.com/content/programming-color-ncurses)
|
||||
for more details.
|
||||
|
||||
|
||||
## Modifying the characters for the wall, bug and snake
|
||||
|
||||
+25
-11
@@ -162,7 +162,9 @@ size 10 of course (but in fact if you observe the snake won’t appear to be
|
||||
of size 20 yet).</p>
|
||||
<p>There probably are combinations that can test these types of things I just
|
||||
don’t at this time remember any I might have done.</p>
|
||||
<h1 id="the-snake-doesnt-seem-to-be-moving"><a name="stillsnake" href="#toc">The snake doesn’t seem to be moving</a></h1>
|
||||
<div id="stillsnake">
|
||||
<h1 id="the-snake-doesnt-seem-to-be-moving"><a href="#toc">The snake doesn’t seem to be moving</a></h1>
|
||||
</div>
|
||||
<p>One way to show this is in full is to set the initial size and growth size to a
|
||||
high value; then try each one individually. For example:</p>
|
||||
<pre><code> SIZE=100 ./prog</code></pre>
|
||||
@@ -172,7 +174,7 @@ When it has reached the full size then the entire body of the snake will
|
||||
start to move too (i.e. if the tail isn’t moving it is growing or else paused).</p>
|
||||
<p>In several tests I set the initial size to a high value, the max to a higher
|
||||
value still and enabled cannibalism and much of the screen was full of the snake
|
||||
before it started to move. The <a href="cannibalism.log.md">cannibalism.log.md</a> has some examples of both
|
||||
before it started to move. The [cannibalism.log.md][] has some examples of both
|
||||
cannibalism and a long snake that didn’t move for most of the game.</p>
|
||||
<p>If however you let the snake get to the full size then eat a bug there can
|
||||
be a moment of lingering where it appears the snake moves for a few places
|
||||
@@ -186,11 +188,15 @@ occupied or not.</p>
|
||||
<p>Basically if the snake head is moving you can consider the snake to be
|
||||
moving or growing and that’s the important point (if you have the default
|
||||
status line you can also see the coordinates being updated to show this).</p>
|
||||
<h1 id="getch-also-accepts-input-from-some-input-hardware-other-than-keyboards"><a name="getch" href="#toc">getch() also accepts input from some input hardware other than keyboards</a></h1>
|
||||
<div id="getch">
|
||||
<h1 id="getch-also-accepts-input-from-some-input-hardware-other-than-keyboards"><a href="#toc">getch() also accepts input from some input hardware other than keyboards</a></h1>
|
||||
</div>
|
||||
<p>On my MacBook Pro the trackpad has actually triggered directions; if I were to
|
||||
swipe up and then down the snake would run into itself. I believe this has to do
|
||||
with the function call <code>keypad(v, 1);</code> which enables arrow keys.</p>
|
||||
<h1 id="size0-is-the-same-as-size1-and-other-oddities"><a name="size" href="#toc">SIZE=0 is the same as SIZE=1 and other oddities</a></h1>
|
||||
<div id="size">
|
||||
<h1 id="size0-is-the-same-as-size1-and-other-oddities"><a href="#toc">SIZE=0 is the same as SIZE=1 and other oddities</a></h1>
|
||||
</div>
|
||||
<p>What this means is that for both you will only have the snake head. At this point
|
||||
you can safely go back on yourself even without cannibalism enabled. This is
|
||||
intentional; a snake size of 0 is pointless but why should it not be playable
|
||||
@@ -222,7 +228,7 @@ way negative size will force a win.</p>
|
||||
head several places until you end up getting to the max size (by way of it
|
||||
being unsigned). This isn’t a bug even if it might seem like one. In fact
|
||||
this is the basis of the grow/shrink mode of play that I talk about in the
|
||||
<a href="gameplay.html">gameplay.html</a> (<a href="gameplay.md">gameplay.md</a> on GitHub) file.</p>
|
||||
<a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/ferguson1/gameplay.html">gameplay.html</a> file.</p>
|
||||
<p>Here’s another thing to be aware of. Let’s say you do:</p>
|
||||
<pre><code> SIZE=1 GROW=-1 ./prog</code></pre>
|
||||
<p>How many bugs will it take before you win? In fact it’s two: you would see the
|
||||
@@ -230,7 +236,9 @@ head twice: the second time once you ‘shrink’ down to size 0; it would then
|
||||
that if you get another bug you will be at the ‘max size’:</p>
|
||||
<pre><code> YOU WIN!
|
||||
X:81/156 Y:35/41 S:997/997 B:2</code></pre>
|
||||
<h1 id="i-was-a-few-places-behind-my-tail-and-i-ran-into-it"><a name="bitetail" href="#toc">‘I was a few places behind my tail and I ran into it!’</a></h1>
|
||||
<div id="bitetail">
|
||||
<h1 id="i-was-a-few-places-behind-my-tail-and-i-ran-into-it"><a href="#toc">‘I was a few places behind my tail and I ran into it!’</a></h1>
|
||||
</div>
|
||||
<p>I.e. what happens if you’re growing - for example after just eating a bug - and
|
||||
you’re racing towards your tail? If you’re behind it should be fine since you’re
|
||||
going the same speed as the snake is, right? Not quite. Because you’re growing
|
||||
@@ -238,7 +246,9 @@ you might end up running into your tail (depending on how much you’ve left to
|
||||
grow and how far away from your tail)! This happened to me once and it surprised
|
||||
me and I figured I better note it.</p>
|
||||
<p><strong>Remember: the tail at that point isn’t moving yet; the snake is growing!</strong></p>
|
||||
<h1 id="with-negative-growth-the-snake-drops-from-the-middle-of-the-body"><a name="middleofsnake" href="#toc">With negative growth the snake drops from the middle of the body</a></h1>
|
||||
<div id="middleofsnake">
|
||||
<h1 id="with-negative-growth-the-snake-drops-from-the-middle-of-the-body"><a href="#toc">With negative growth the snake drops from the middle of the body</a></h1>
|
||||
</div>
|
||||
<p>For instance it might look like this (the first line is as it happens, the
|
||||
second pointing to where it happens and the third being what’s left after the
|
||||
rest of the snake has gone through). Doing <code>SHED=100 SHEDS=-1</code>:</p>
|
||||
@@ -261,8 +271,10 @@ go there! :)</p>
|
||||
that’s how they grow in the wild so it’s a misnomer. The shrinking was only
|
||||
‘discovered’ because it’s an unsigned number but happily it allows for different
|
||||
gameplay modes.</p>
|
||||
<h1 id="it-looks-like-the-bug-is-in-the-snake"><a name="buginsnake" href="#toc">It looks like the bug is in the snake</a></h1>
|
||||
<p>I show a different example in the <a href="crazy.log.md">crazy.log.md</a> file but what defines a coordinate
|
||||
<div id="buginsnake">
|
||||
<h1 id="it-looks-like-the-bug-is-in-the-snake"><a href="#toc">It looks like the bug is in the snake</a></h1>
|
||||
</div>
|
||||
<p>I show a different example in the [crazy.log.md][] file but what defines a coordinate
|
||||
which the snake occupies? If the snake breaks apart then the only part
|
||||
of the screen the snake is occupying is the place which is actually moving: if
|
||||
the snake decreases in size by 3 then the three respective characters you can go
|
||||
@@ -271,7 +283,9 @@ something like:</p>
|
||||
<pre><code> <*oooooooo</code></pre>
|
||||
<p>This is because the snake is no longer there: in fact in this run the snake was
|
||||
quite a bit lower on the screen and 25 in length.</p>
|
||||
<h1 id="on-the-safety-of-the-bug-placement-loop"><a name="bugplacement" href="#toc">On the safety of the bug placement loop</a></h1>
|
||||
<div id="bugplacement">
|
||||
<h1 id="on-the-safety-of-the-bug-placement-loop"><a href="#toc">On the safety of the bug placement loop</a></h1>
|
||||
</div>
|
||||
<p>Ilya Kurdyukov shared concern for the loop in the bug placement routine: is it
|
||||
safe? What he refers to is that it’s a potential infinite loop. But is it? I
|
||||
understand the concern and it’s something I played with a lot to be sure that it
|
||||
@@ -308,7 +322,7 @@ that 49 is the max snake size. How is this derived and why?</p>
|
||||
(<code>playable_rows * playable_columns</code>). I have played with this many
|
||||
times and I do not believe there should be a problem. If there is it’s from a
|
||||
very poor implementation of rand() and I discuss this in
|
||||
<a href="troubleshooting.html">troubleshooting.html</a> (<a href="troubleshooting.md">troubleshooting.md</a> on GitHub).</p>
|
||||
<a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/ferguson1/troubleshooting.html">troubleshooting.html</a>.</p>
|
||||
<p>There I also give some test outputs without the cap in place to give an idea of
|
||||
when it became a problem (or would have). In short this is known but I do not
|
||||
think it will be a problem and I have given resolutions. In any event without
|
||||
|
||||
+29
-18
@@ -38,7 +38,9 @@ There probably are combinations that can test these types of things I just
|
||||
don't at this time remember any I might have done.
|
||||
|
||||
|
||||
# <a name="stillsnake" href="#toc">The snake doesn't seem to be moving</a>
|
||||
<div id="stillsnake">
|
||||
# <a href="#toc">The snake doesn't seem to be moving</a>
|
||||
</div>
|
||||
|
||||
One way to show this is in full is to set the initial size and growth size to a
|
||||
high value; then try each one individually. For example:
|
||||
@@ -73,13 +75,17 @@ moving or growing and that's the important point (if you have the default
|
||||
status line you can also see the coordinates being updated to show this).
|
||||
|
||||
|
||||
# <a name="getch" href="#toc">getch() also accepts input from some input hardware other than keyboards</a>
|
||||
<div id="getch">
|
||||
# <a href="#toc">getch() also accepts input from some input hardware other than keyboards</a>
|
||||
</div>
|
||||
|
||||
On my MacBook Pro the trackpad has actually triggered directions; if I were to
|
||||
swipe up and then down the snake would run into itself. I believe this has to do
|
||||
with the function call `keypad(v, 1);` which enables arrow keys.
|
||||
|
||||
# <a name="size" href="#toc">SIZE=0 is the same as SIZE=1 and other oddities</a>
|
||||
<div id="size">
|
||||
# <a href="#toc">SIZE=0 is the same as SIZE=1 and other oddities</a>
|
||||
</div>
|
||||
|
||||
What this means is that for both you will only have the snake head. At this point
|
||||
you can safely go back on yourself even without cannibalism enabled. This is
|
||||
@@ -133,7 +139,7 @@ And you'll see that you start to be the normal size but then you leave your
|
||||
head several places until you end up getting to the max size (by way of it
|
||||
being unsigned). This isn't a bug even if it might seem like one. In fact
|
||||
this is the basis of the grow/shrink mode of play that I talk about in the
|
||||
[gameplay.html][] ([gameplay.md][] on GitHub) file.
|
||||
[gameplay.html][] file.
|
||||
|
||||
Here's another thing to be aware of. Let's say you do:
|
||||
|
||||
@@ -150,7 +156,9 @@ that if you get another bug you will be at the 'max size':
|
||||
X:81/156 Y:35/41 S:997/997 B:2
|
||||
```
|
||||
|
||||
# <a name="bitetail" href="#toc">'I was a few places behind my tail and I ran into it!'</a>
|
||||
<div id="bitetail">
|
||||
# <a href="#toc">'I was a few places behind my tail and I ran into it!'</a>
|
||||
</div>
|
||||
|
||||
I.e. what happens if you're growing - for example after just eating a bug - and
|
||||
you're racing towards your tail? If you're behind it should be fine since you're
|
||||
@@ -162,7 +170,9 @@ me and I figured I better note it.
|
||||
**Remember: the tail at that point isn't moving yet; the snake is growing!**
|
||||
|
||||
|
||||
# <a name="middleofsnake" href="#toc">With negative growth the snake drops from the middle of the body</a>
|
||||
<div id="middleofsnake">
|
||||
# <a href="#toc">With negative growth the snake drops from the middle of the body</a>
|
||||
</div>
|
||||
|
||||
For instance it might look like this (the first line is as it happens, the
|
||||
second pointing to where it happens and the third being what's left after the
|
||||
@@ -196,7 +206,9 @@ that's how they grow in the wild so it's a misnomer. The shrinking was only
|
||||
'discovered' because it's an unsigned number but happily it allows for different
|
||||
gameplay modes.
|
||||
|
||||
# <a name="buginsnake" href="#toc">It looks like the bug is in the snake</a>
|
||||
<div id="buginsnake">
|
||||
# <a href="#toc">It looks like the bug is in the snake</a>
|
||||
</div>
|
||||
|
||||
I show a different example in the [crazy.log.md][] file but what defines a coordinate
|
||||
which the snake occupies? If the snake breaks apart then the only part
|
||||
@@ -212,7 +224,9 @@ something like:
|
||||
This is because the snake is no longer there: in fact in this run the snake was
|
||||
quite a bit lower on the screen and 25 in length.
|
||||
|
||||
# <a name="bugplacement" href="#toc">On the safety of the bug placement loop</a>
|
||||
<div id="bugplacement">
|
||||
# <a href="#toc">On the safety of the bug placement loop</a>
|
||||
</div>
|
||||
|
||||
Ilya Kurdyukov shared concern for the loop in the bug placement routine: is it
|
||||
safe? What he refers to is that it's a potential infinite loop. But is it? I
|
||||
@@ -257,7 +271,7 @@ With 10 rows and columns it's calculated as `7 * 7` (i.e. it's
|
||||
(`playable_rows * playable_columns`). I have played with this many
|
||||
times and I do not believe there should be a problem. If there is it's from a
|
||||
very poor implementation of rand() and I discuss this in
|
||||
[troubleshooting.html][] ([troubleshooting.md][] on GitHub).
|
||||
[troubleshooting.html][].
|
||||
|
||||
There I also give some test outputs without the cap in place to give an idea of
|
||||
when it became a problem (or would have). In short this is known but I do not
|
||||
@@ -268,16 +282,13 @@ The obvious question is why didn't I put in a break? Because of the IOCCC size
|
||||
rule 2 and what would it do anyway? I guess it would win but to my mind that is
|
||||
a bug and I prefer putting in restrictions to try and make it very unlikely.
|
||||
|
||||
[crazy.log.md]: crazy.log.md
|
||||
[gameplay.md]: gameplay.md
|
||||
[troubleshooting.md]: troubleshooting.md
|
||||
[troubleshooting.html]: troubleshooting.html
|
||||
[gameplay.html]: gameplay.html
|
||||
[gameplay.md]: gameplay.md
|
||||
[cannibalism.log.md]: cannibalism.log.md
|
||||
[crazy.log.html]: %%REPO_URL%%/2020/ferguson1/crazy.log.html
|
||||
[gameplay.html]: %%REPO_URL%%/2020/ferguson1/gameplay.html
|
||||
[troubleshooting.html]: %%REPO_URL%%/2020/ferguson1/troubleshooting.html
|
||||
[gameplay.html]: %%REPO_URL%%/2020/ferguson1/gameplay.html
|
||||
[cannibalism.log.html]: %%REPO_URL%%/2020/ferguson1/cannibalism.log.html
|
||||
[https://en.wikipedia.org/wiki/Halfwidth_and_fullwidth_forms]: https://en.wikipedia.org/wiki/Halfwidth_and_fullwidth_forms
|
||||
[spoilers]: spoilers.markdown
|
||||
[screenshot of halfwidth vs fullwidth]: halfwidth_vs_fullwidth.png
|
||||
[spoilers.html]: %%REPO_URL%%/2020/ferguson1/spoilers.html
|
||||
|
||||
|
||||
<hr style="width:10%;text-align:left;margin-left:0">
|
||||
|
||||
@@ -134,7 +134,8 @@
|
||||
<!-- START: this line starts content for HTML phase 21 by: bin/pandoc-wrapper.sh via bin/md2html.sh -->
|
||||
|
||||
<!-- BEFORE: 1st line of markdown file: 2020/ferguson1/cannibalism.log.md -->
|
||||
<h1 id="extreme-cannibalism-in-2020-ioccc-dont-tread-on-me-snake-game">Extreme cannibalism in <a href="/2020/ferguson1/prog.c">2020 IOCCC ‘Don’t tread on me’ Snake game</a></h1>
|
||||
<h1 id="extreme-cannibalism-in-a-snake-game">Extreme cannibalism in a Snake game</h1>
|
||||
<p>See the <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/ferguson1/prog.c">2020 IOCCC ‘Don’t tread on me’ Snake game source code</a>.</p>
|
||||
<p>To give an idea what cannibalism can look like (it’s I believe a unique feature
|
||||
to any other version of Snake), this file shows just how extreme cannibalism can
|
||||
get with a long snake. I made a few changes, described below, to make it easier
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
# Extreme cannibalism in [2020 IOCCC 'Don't tread on me' Snake game](/2020/ferguson1/prog.c)
|
||||
# Extreme cannibalism in a Snake game
|
||||
|
||||
See the [2020 IOCCC 'Don't tread on me' Snake game source code](%%REPO_URL%%/2020/ferguson1/prog.c).
|
||||
|
||||
To give an idea what cannibalism can look like (it's I believe a unique feature
|
||||
to any other version of Snake), this file shows just how extreme cannibalism can
|
||||
|
||||
@@ -140,7 +140,7 @@ something of my mum’s speciality. It’s complicated and I should warn that no
|
||||
has seemed to get it down as well as she has but it’s well worth the effort if
|
||||
you love chocolate and have the time and patience.</p>
|
||||
<p>My late stepmum who only liked white ‘chocolate’ loved this cake! The picture
|
||||
below is after it’s been iced. The image <a href="ioccc-cake.jpg">ioccc-cake.jpg</a> was a
|
||||
below is after it’s been iced. The image <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/ferguson1/cake.jpg">cake.jpg</a> was a
|
||||
feeble attempt at drawing <code>IOCCC</code> into the cake before icing, a different time.
|
||||
The picture below was taken for my birthday (14 February) in 2022 as it’s the
|
||||
best one I have:</p>
|
||||
@@ -161,9 +161,9 @@ there of course. Please make sure to mention me so I get a push notification as
|
||||
I don’t check it very often. Thanks and again enjoy!</p>
|
||||
<h2 id="measurements">Measurements</h2>
|
||||
<p>This was originally taken from an American magazine for women so the
|
||||
measurements are in the US standards. A nice resource (that has much more than
|
||||
just cooking) is <a href="http://www.onlineconversion.com/cooking.htm" class="uri">http://www.onlineconversion.com/cooking.htm</a>. This will
|
||||
particularly matter for cups, teaspoons, tablespoons and ounces.</p>
|
||||
measurements are in the US standards. There is a
|
||||
<a href="http://www.onlineconversion.com/cooking.htm">nice resource</a> that has much more than
|
||||
just cooking). This will particularly matter for cups, teaspoons, tablespoons and ounces.</p>
|
||||
<h2 id="bakers-chocolate">Baker’s chocolate</h2>
|
||||
<p>Baker’s chocolate is a brand name and the product in question is unsweetened
|
||||
chocolate bars used for baking. According to a <a href="https://www.davidlebovitz.com/chocolate-faqs/">chocolates FAQ</a> it might be
|
||||
|
||||
@@ -6,7 +6,7 @@ has seemed to get it down as well as she has but it's well worth the effort if
|
||||
you love chocolate and have the time and patience.
|
||||
|
||||
My late stepmum who only liked white 'chocolate' loved this cake! The picture
|
||||
below is after it's been iced. The image [ioccc-cake.jpg](ioccc-cake.jpg) was a
|
||||
below is after it's been iced. The image [cake.jpg](%%REPO_URL%%/2020/ferguson1/cake.jpg) was a
|
||||
feeble attempt at drawing `IOCCC` into the cake before icing, a different time.
|
||||
The picture below was taken for my birthday (14 February) in 2022 as it's the
|
||||
best one I have:
|
||||
@@ -35,9 +35,9 @@ I don't check it very often. Thanks and again enjoy!
|
||||
## Measurements
|
||||
|
||||
This was originally taken from an American magazine for women so the
|
||||
measurements are in the US standards. A nice resource (that has much more than
|
||||
just cooking) is <http://www.onlineconversion.com/cooking.htm>. This will
|
||||
particularly matter for cups, teaspoons, tablespoons and ounces.
|
||||
measurements are in the US standards. There is a
|
||||
[nice resource](http://www.onlineconversion.com/cooking.htm) that has much more than
|
||||
just cooking). This will particularly matter for cups, teaspoons, tablespoons and ounces.
|
||||
|
||||
|
||||
## Baker's chocolate
|
||||
@@ -197,7 +197,7 @@ bowl can sit in.
|
||||
thick BUT not too thick. **Make *SURE* ICING DOES *NOT* GET WET!** The idea is to
|
||||
**MAKE THE BOWL IT'S IN COLD *BUT TO NOT LET THE ICING GET WET!***
|
||||
|
||||
[IOCCC and chocolate]: ioccc-and-chocolate.pdf
|
||||
[IOCCC and chocolate]: %%REPO_URL%%/2020/ferguson1/cake.jpg
|
||||
[chocolates FAQ]: https://www.davidlebovitz.com/chocolate-faqs/
|
||||
|
||||
|
||||
|
||||
+102
-49
@@ -138,7 +138,7 @@
|
||||
have included much more than just the input keys and a few printouts of the
|
||||
game. For normal play you probably don’t even need this file at all unless it be
|
||||
for the input keys.</p>
|
||||
<p><a name="toc"></a></p>
|
||||
<div id="toc">
|
||||
<ol type="1">
|
||||
<li><p><a href="#support">Testing terminal environment/capabilities</a></p></li>
|
||||
<li><p><a href="#input">Input keys</a></p></li>
|
||||
@@ -179,14 +179,19 @@ for the input keys.</p>
|
||||
</ul></li>
|
||||
<li><p><a href="#conclusions">Conclusion (and inspirational words for everyone)</a></p></li>
|
||||
</ol>
|
||||
<h1 id="testing-terminal-environmentcapabilities">1. <a name="support" href="#toc">Testing terminal environment/capabilities</a></h1>
|
||||
</div>
|
||||
<div id="support">
|
||||
<h1 id="testing-terminal-environmentcapabilities">1. <a href="#toc">Testing terminal environment/capabilities</a></h1>
|
||||
</div>
|
||||
<p>Most people probably won’t have any issue at all but for those who have any
|
||||
problems with the terminal see the <a href="terminals.html">terminals.html</a> (<a href="terminals.md">terminals.md</a> on
|
||||
GitHub) file for more information on the terminal capabilities testing utility I
|
||||
problems with the terminal see the <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/ferguson1/terminals.html">terminals.html</a>
|
||||
file for more information on the terminal capabilities testing utility I
|
||||
include.</p>
|
||||
<p>For troubleshooting other problems see <a href="troubleshooting.html">troubleshooting.html</a>
|
||||
(<a href="troubleshooting.md">troubleshooting.md</a> on GitHub) and <a href="bugs.html">bugs.html</a> (<a href="bugs.md">bugs.md</a> on GitHub).</p>
|
||||
<h1 id="input-keys">2. <a name="input" href="#toc">Input keys</a></h1>
|
||||
<p>For troubleshooting other problems see <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/ferguson1/troubleshooting.html">troubleshooting.html</a>
|
||||
and <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/ferguson1/bugs.html">bugs.html</a>.</p>
|
||||
<div id="input">
|
||||
<h1 id="input-keys">2. <a href="#toc">Input keys</a></h1>
|
||||
</div>
|
||||
<ul>
|
||||
<li>Left, right, up and down <strong>arrow keys</strong>: move that direction.</li>
|
||||
<li><code>q</code> (and <code>Q</code>): quit the game.</li>
|
||||
@@ -195,14 +200,16 @@ Note that no other keys will resume the game; however if you press a key
|
||||
that <code>getch()</code> picks up on and the game is not paused then it will be as if
|
||||
you pressed the current direction key (assuming you already moved the snake).</li>
|
||||
</ul>
|
||||
<h1 id="gameplay">3. <a name="gameplay" href="#toc">Gameplay</a></h1>
|
||||
<h1 id="gameplay">3. <a href="#toc">Gameplay</a></h1>
|
||||
<p>Here I will show the initial screen as well as what a few things look like. If
|
||||
you don’t feel you need this but you want to configure colours jump to <a href="#colours">colour
|
||||
selection</a>. You can also jump to <a href="#modes">gameplay modes</a> or <a href="#variables">game
|
||||
variables</a>.</p>
|
||||
<p>The bug colour by default is white; the snake head colour is red and the snake
|
||||
body colour is green. The walls are cyan.</p>
|
||||
<h2 id="gameplay-the-initial-screen"><a name="initial" href="#toc">Gameplay: The initial screen</a></h2>
|
||||
<div id="initial">
|
||||
<h2 id="gameplay-the-initial-screen"><a href="#toc">Gameplay: The initial screen</a></h2>
|
||||
</div>
|
||||
<p>When you load the game you will see a screen that looks something like the
|
||||
below. Note that the top line is the score/status line: the top wall is at line
|
||||
1 and the left wall is column 0. Below I use the coordinates in the X/Y order
|
||||
@@ -242,7 +249,9 @@ size.</p></li>
|
||||
it will always have an upper limit depending on the terminal size.</p></li>
|
||||
<li><p>The number of bugs eaten so far is 0.</p></li>
|
||||
</ul>
|
||||
<h2 id="gameplay-playing-the-game"><a name="playing" href="#toc">Gameplay: Playing the game</a></h2>
|
||||
<div id="playing">
|
||||
<h2 id="gameplay-playing-the-game"><a href="#toc">Gameplay: Playing the game</a></h2>
|
||||
</div>
|
||||
<pre><code> X:39/49 Y:8/16 S:5/658 B:0
|
||||
##################################################
|
||||
# #
|
||||
@@ -300,7 +309,9 @@ Let’s do that:</p>
|
||||
##################################################</code></pre>
|
||||
<p>Observe that the bug was eaten and a new bug spawned elsewhere. I went left
|
||||
three and then up one and could slither on to the bug.</p>
|
||||
<h1 id="gameplay-walls"><a name="walls" href="#toc">Gameplay: Walls</a></h1>
|
||||
<div id="walls">
|
||||
<h1 id="gameplay-walls"><a href="#toc">Gameplay: Walls</a></h1>
|
||||
</div>
|
||||
<p>By default walls are passable (<strong>WALLS=1</strong>). Let’s get to full size and go
|
||||
through the top wall:</p>
|
||||
<pre><code> X:36/49 Y:15/16 S:10/658 B:1
|
||||
@@ -363,7 +374,9 @@ might look like (I set the starting size to 150 and had only just started):</p>
|
||||
<p>If I continue going up I will see:</p>
|
||||
<pre><code>OUCH!
|
||||
X:20/49 Y:1/16 S:150/658 B:0</code></pre>
|
||||
<h1 id="gameplay-cannibalism"><a name="cannibalism" href="#toc">Gameplay: Cannibalism</a></h1>
|
||||
<div id="cannibalism">
|
||||
<h1 id="gameplay-cannibalism"><a href="#toc">Gameplay: Cannibalism</a></h1>
|
||||
</div>
|
||||
<p>By default cannibalism is disabled (<strong>CANNIBAL=0</strong>) so if you run into yourself it might look
|
||||
something like:</p>
|
||||
<pre><code> X:45/49 Y:10/16 S:10/658 B:1
|
||||
@@ -448,16 +461,20 @@ will see that the arrow has moved over:</p>
|
||||
left go right etc.) and then after some length (but before you get beyond the
|
||||
snake) turn (so that you go perpendicular) and then watch as the snake starts
|
||||
unwinding at one place and then suddenly unwinds another direction.</p>
|
||||
<p>An example of extreme cannibalism is in the <a href="cannibalism.log.html">cannibalism.log.html</a>
|
||||
(<a href="cannibalism.log.md">cannibalism.log.md</a> on GitHub) file. It explains information about the file
|
||||
<p>An example of extreme cannibalism is in the <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/ferguson1/cannibalism.log.html">cannibalism.log.html</a>
|
||||
file. It explains information about the file
|
||||
including how to find the bug, head and tail of the snake, at least where it was
|
||||
documented. The first run has several dumps. The final example has the snake
|
||||
inside itself.</p>
|
||||
<h1 id="gameplay-shedding-stretching"><a name="shedding" href="#toc">Gameplay: Shedding (stretching)</a></h1>
|
||||
<div id="shedding">
|
||||
<h1 id="gameplay-shedding-stretching"><a href="#toc">Gameplay: Shedding (stretching)</a></h1>
|
||||
</div>
|
||||
<p>This feature will make you grow by the value of <strong>SHEDS</strong> for every <strong>SHED</strong>
|
||||
movements (the counter isn’t incremented when you eat a bug). Basically growing
|
||||
without eating a bug (stretching would be better name here).</p>
|
||||
<h1 id="gameplay-winning"><a name="winning" href="#toc">Gameplay: Winning</a></h1>
|
||||
<div id="winning">
|
||||
<h1 id="gameplay-winning"><a href="#toc">Gameplay: Winning</a></h1>
|
||||
</div>
|
||||
<p>If you ever get to the <strong>MAXSIZE</strong> 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
|
||||
@@ -467,7 +484,7 @@ less than again - I’m not going to try and figure that out however). Anyway:</
|
||||
YOU WIN!
|
||||
X:24/49 Y:8/16 S:658/658 B:0</code></pre>
|
||||
<p>Observe that the size isn’t the default 997: because the screen size is too
|
||||
small for that value (see <a href="terminals.md">terminals.md</a>).</p>
|
||||
small for that value (see [terminals.md][]).</p>
|
||||
<p>The reason I chose 997 is that it leaves a bit of a challenge for some (maybe
|
||||
most) people but it’s still winnable. Previously even I couldn’t have won unless
|
||||
maybe a much bigger screen, if both cheat modes were disabled. I probably could
|
||||
@@ -485,19 +502,25 @@ but then it occurred to me that there are prime numbers close to 1000 so why not
|
||||
choose one instead (that was less than 1000)? And so I did. Another fun fact: at
|
||||
the default starting size and growth size of 5 the number of bugs needed before
|
||||
the game is won is 199 - also a prime!</p>
|
||||
<h1 id="gameplay-quitting"><a name="quitting" href="#toc">Gameplay: Quitting</a></h1>
|
||||
<div id="quitting">
|
||||
<h1 id="gameplay-quitting"><a href="#toc">Gameplay: Quitting</a></h1>
|
||||
</div>
|
||||
<p>If you wish to quit you can hit ‘q’ (case-insensitive). For example:</p>
|
||||
<pre><code> X:24/49 Y:8/16 S:5/658 B:0</code></pre>
|
||||
<h1 id="gameplay-modes">4. <a name="modes" href="#toc">Gameplay modes</a></h1>
|
||||
<p>Here I list a number of different modes of play. In the <a href="bugs.html">bugs.html</a>
|
||||
(<a href="bugs.md">bugs.md</a> on GitHub) file I even show how there’s a built-in test unit for some
|
||||
<div id="modes">
|
||||
<h1 id="gameplay-modes">4. <a href="#toc">Gameplay modes</a></h1>
|
||||
</div>
|
||||
<p>Here I list a number of different modes of play. In the <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/ferguson1/bugs.html">bugs.html</a>
|
||||
file I even show how there’s a built-in test unit for some
|
||||
modes! There are certainly other modes that could be imagined: the modes below
|
||||
happened over time and some were simply an accidental discovery or something I
|
||||
thought of by a chance; others were thought out from the beginning but were
|
||||
improved over time.</p>
|
||||
<p>The <a href="play.sh">play.sh</a> script sets up some of these automatically; I describe it after
|
||||
<p>The <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/ferguson1/play.sh">play.sh</a> script sets up some of these automatically; I describe it after
|
||||
the modes below.</p>
|
||||
<h2 id="photosensitive-epilepsystimulation-overload-trigger-warnings"><a name="warning" href="#toc">Photosensitive epilepsy/Stimulation overload trigger warnings</a></h2>
|
||||
<div id="warning">
|
||||
<h2 id="photosensitive-epilepsystimulation-overload-trigger-warnings"><a href="#toc">Photosensitive epilepsy/Stimulation overload trigger warnings</a></h2>
|
||||
</div>
|
||||
<p>If you have <strong>photosensitive epilepsy please be careful</strong> especially with low values
|
||||
for both <strong>WAIT</strong> and <strong>EVADE</strong>. It appears that the <a href="https://www.epilepsysociety.org.uk/photosensitive-epilepsy#.Xjgpwi2ZOgQ">number of hertz (flashes)
|
||||
per second triggering seizures</a> is wide but depending on the variables it
|
||||
@@ -507,7 +530,9 @@ exercise caution. This could trigger seizures and <strong>it might also be too m
|
||||
stimulation for some people.</strong></p>
|
||||
<p><strong>Please be careful of these if these types of things have ever affected you or if
|
||||
you have any form of epilepsy. Thank you.</strong></p>
|
||||
<h2 id="gameplay-mode-drawing-practice-mode"><a name="drawing" href="#toc">Gameplay mode: Drawing / Practice mode</a></h2>
|
||||
<div id="drawing">
|
||||
<h2 id="gameplay-mode-drawing-practice-mode"><a href="#toc">Gameplay mode: Drawing / Practice mode</a></h2>
|
||||
</div>
|
||||
<p>If you want to draw the snake wherever you like on the screen you can do this by
|
||||
modifying the wait time (for input) to -1 (or any value < 0): then the snake
|
||||
does not move until you press a movement key. For example:</p>
|
||||
@@ -527,7 +552,7 @@ to be a problem simply do:</p>
|
||||
<p>Or something like that (maybe make the size bigger but that’s up to you). You
|
||||
could also set the max size to be the highest possible by saying</p>
|
||||
<pre><code> MAXSIZE=-1</code></pre>
|
||||
<p>Which I’ve done in the <a href="play.sh">play.sh</a> script.</p>
|
||||
<p>Which I’ve done in the <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/ferguson1/play.sh">play.sh</a> script.</p>
|
||||
<p>I discuss how this mode works in [spoilers.markdown][].</p>
|
||||
<p>Here’s an example run where I spelt ‘SNAKE’. As you can see it’s far from
|
||||
perfect: the snake after all does not leave gaps and the game does not support
|
||||
@@ -538,7 +563,9 @@ for. But you can consider this mode drawing or practice mode.</p>
|
||||
oooo o oo ooooooo oooo ooooo
|
||||
o o ooo oo o ooo o
|
||||
oooo o oo ooo oooooooo></code></pre>
|
||||
<h2 id="gameplay-mode-computer-playing-automatic-mode-photosensitive-epilepsystimulation-overload-trigger"><a name="auto" href="#toc">Gameplay mode: Computer playing / Automatic mode (Photosensitive epilepsy/Stimulation overload trigger)</a></h2>
|
||||
<div id="auto">
|
||||
<h2 id="gameplay-mode-computer-playing-automatic-mode-photosensitive-epilepsystimulation-overload-trigger"><a href="#toc">Gameplay mode: Computer playing / Automatic mode (Photosensitive epilepsy/Stimulation overload trigger)</a></h2>
|
||||
</div>
|
||||
<p><strong>Photosensitive epilepsy/stimulation overload trigger warning:</strong>
|
||||
For those who have epilepsy or are susceptible to stimulation overload from
|
||||
flashing lights please do be careful with this mode. Depending on your
|
||||
@@ -563,7 +590,9 @@ by itself.</p>
|
||||
seems to take longer for it to get a bug as it gets longer. I believe these
|
||||
happen because the bug has to find a X and Y coordinate that’s not occupied and
|
||||
so with fewer available it has a harder time finding a place in that one line.</p>
|
||||
<h3 id="computer-player-variations"><a name="auto-variations" href="#toc">Computer player variations</a></h3>
|
||||
<div id="auto-variations">
|
||||
<h3 id="computer-player-variations"><a href="#toc">Computer player variations</a></h3>
|
||||
</div>
|
||||
<p>Here’s how to make the bug move every time the snake moves:</p>
|
||||
<pre><code> CANNIBAL=1 WALLS=1 WAIT=0 EVADE=1 ./prog</code></pre>
|
||||
<h4 id="help-the-computer-win-fairly-quickly">Help the computer win fairly quickly</h4>
|
||||
@@ -577,7 +606,7 @@ thought of):</p>
|
||||
shows to be 10 characters depends on whether or not it gets a bug before it can
|
||||
get to that length - and then it’ll start shrinking until it’s just the head
|
||||
then the head again (i.e. 1 then 0 in size) and then win! This is also in the
|
||||
<a href="play.sh">play.sh</a> script.</p>
|
||||
<a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/ferguson1/play.sh">play.sh</a> script.</p>
|
||||
<h4 id="adjusting-the-timespeed">Adjusting the time/speed</h4>
|
||||
<p>Of course you can also do something like:</p>
|
||||
<pre><code> WAIT=5 WALLS=1 CANNIBAL=1 ./prog</code></pre>
|
||||
@@ -597,7 +626,9 @@ horizontally the snake ran into itself at:</p>
|
||||
X:57/156 Y:20/41 S:155/997 B:30</code></pre>
|
||||
<p>What if you set the size to a high value? The lowest? There are bound to be
|
||||
other games to play with this feature!</p>
|
||||
<h2 id="gameplay-mode-grow-shrink-mode-positive-and-negative-winning"><a name="grow-shrink" href="#toc">Gameplay mode: Grow-Shrink mode (Positive and Negative Winning)</a></h2>
|
||||
<div id="grow-shrink">
|
||||
<h2 id="gameplay-mode-grow-shrink-mode-positive-and-negative-winning"><a href="#toc">Gameplay mode: Grow-Shrink mode (Positive and Negative Winning)</a></h2>
|
||||
</div>
|
||||
<p>In this mode you’re simultaneously growing and shrinking but because the max
|
||||
size is unsigned you can win both by shrinking to the point of losing your body
|
||||
or growing to the full size directly. This is how it works:</p>
|
||||
@@ -615,16 +646,18 @@ actually tried it.</p>
|
||||
<p>The parameters above were chosen after playing with the mode a bit to find a
|
||||
value that wouldn’t take that much time but still would pose a challenge. One
|
||||
could reverse it so that one shrinks more than growing.</p>
|
||||
<p>The <a href="crazy.log.html">crazy.log.html</a> (<a href="crazy.log.md">crazy.log.md</a> on GitHub) file has several screen
|
||||
<p>The <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/ferguson1/crazy.log.html">crazy.log.html</a> file has several screen
|
||||
dumps with this idea.</p>
|
||||
<p>You could also have it so that eating a bug makes you shrink and moving so many
|
||||
moves you grow. I tried this and for me it was far more fun. The <a href="play.sh">play.sh</a>
|
||||
moves you grow. I tried this and for me it was far more fun. The <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/ferguson1/play.sh">play.sh</a>
|
||||
also has this mode:</p>
|
||||
<pre><code> SIZE=100 SHEDS=5 GROW=-10 SHED=50 MAXSIZE=250 ./prog</code></pre>
|
||||
<p>Obviously there are many other variations. The <a href="play.sh">play.sh</a> script has some
|
||||
<p>Obviously there are many other variations. The <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/ferguson1/play.sh">play.sh</a> script has some
|
||||
of them (the above is option 5; others are 4, 15 and 16 but only options 4 and 5
|
||||
are called Grow / Shrink).</p>
|
||||
<h2 id="hypnotic-sleepy-mode-photosensitive-epilepsystimulation-overload-trigger"><a name="hypnotic" href="#toc">Hypnotic / Sleepy mode (<strong>Photosensitive epilepsy/Stimulation overload trigger</strong>)</a></h2>
|
||||
<div id="hypnotic">
|
||||
<h2 id="hypnotic-sleepy-mode-photosensitive-epilepsystimulation-overload-trigger"><a href="#toc">Hypnotic / Sleepy mode (<strong>Photosensitive epilepsy/Stimulation overload trigger</strong>)</a></h2>
|
||||
</div>
|
||||
<p><strong>Photosensitive epilepsy/stimulation overload trigger warning:</strong>
|
||||
For those who have epilepsy or are susceptible to stimulation overload from
|
||||
flashing lights and patterns please do be careful with this mode. Depending on your
|
||||
@@ -637,14 +670,18 @@ snake moving too.</p>
|
||||
<pre><code> EVADE=1 CANNIBAL=1 ./prog</code></pre>
|
||||
<p>And just moving the snake about not trying to catch any bugs - just let whatever
|
||||
happens happen.</p>
|
||||
<h2 id="gameplay-mode-stimulation-calming-mode"><a name="stim" href="#toc">Gameplay mode: Stimulation / Calming mode</a></h2>
|
||||
<div id="stim">
|
||||
<h2 id="gameplay-mode-stimulation-calming-mode"><a href="#toc">Gameplay mode: Stimulation / Calming mode</a></h2>
|
||||
</div>
|
||||
<p>If you just need something to stimulate your mind to keep you calm or simply you
|
||||
want to play a game without having to worry about winning or losing you can set
|
||||
the growth size to 0 and then just move the snake round and round eating bugs
|
||||
until you want to quit. You can enable cannibalism so that you don’t have to
|
||||
worry about even running into yourself and losing:</p>
|
||||
<pre><code> GROW=0 CANNIBAL=1 ./prog</code></pre>
|
||||
<h2 id="gameplay-mode-expansibility"><a name="expansibility" href="#toc">Gameplay mode: Expansibility</a></h2>
|
||||
<div id="expansibility">
|
||||
<h2 id="gameplay-mode-expansibility"><a href="#toc">Gameplay mode: Expansibility</a></h2>
|
||||
</div>
|
||||
<p>As I was writing this document and the game modes I have thought of other game
|
||||
modes (they were added) and I have come back to this document to add more modes.
|
||||
That’s the beauty of the variables I have implemented: together with the
|
||||
@@ -657,43 +694,55 @@ not be too hard either. And a game developer who does not play their games is a
|
||||
game developer who is detached from their player base and the wants and needs
|
||||
are therefore disregarded if even heard. I have played this game a lot for this
|
||||
reason as well as I simply enjoy it and thinking up new modes.</p>
|
||||
<h1 id="scripts">5. <a name="scripts" href="#toc">Scripts</a></h1>
|
||||
<h1 id="scripts">5. <a href="#toc">Scripts</a></h1>
|
||||
<p>The following scripts are provided to simplify and automate some of the things
|
||||
this file discusses as well as allowing to easily change the colours.</p>
|
||||
<h2 id="colours-selection-snake-colours"><a name="colours" href="#toc">Colours selection: snake-colours</a></h2>
|
||||
<p>To do this use the <a href="snake-colours">snake-colours</a> script like so:</p>
|
||||
<pre><code> ./snake-colours</code></pre>
|
||||
<div id="colours">
|
||||
<h2 id="colours-selection-snake-colours"><a href="#toc">Colours selection: snake-colours</a></h2>
|
||||
</div>
|
||||
<p>To do this use the <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/ferguson1/snake-colours.sh">snake-colours.sh</a> script like so:</p>
|
||||
<pre><code> ./snake-colours.sh</code></pre>
|
||||
<p>If you want to pass in specific variables you can do that too e.g.:</p>
|
||||
<pre><code> CANNIBAL=1 ./snake-colours</code></pre>
|
||||
<pre><code> CANNIBAL=1 ./snake-colours.sh</code></pre>
|
||||
<p>The script will prompt you for the colour of the walls, snake head, body and the
|
||||
bug.</p>
|
||||
<h2 id="automate-the-above-gameplay-modes"><a name="preset" href="#toc">Automate the above gameplay modes</a></h2>
|
||||
<p>The <a href="play.sh">play.sh</a> script has the gameplay modes described in this file and is menu
|
||||
<div id="preset">
|
||||
<h2 id="automate-the-above-gameplay-modes"><a href="#toc">Automate the above gameplay modes</a></h2>
|
||||
</div>
|
||||
<p>The <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/ferguson1/play.sh">play.sh</a> script has the gameplay modes described in this file and is menu
|
||||
based (there might be differences and some of the modes I include a variation).
|
||||
The script tests the terminal (allowing you to continue even if problems are
|
||||
detected), prompts you if you want to select colours (like those in
|
||||
snake-colours above) and then gives you a list of game modes to play. You can
|
||||
snake-colours.sh above) and then gives you a list of game modes to play. You can
|
||||
pass in the game variables but note that if you pass in a variable that the mode
|
||||
you choose uses then the script will override what you pass in.</p>
|
||||
<p>To use you can do something like:</p>
|
||||
<pre><code> ./play.sh</code></pre>
|
||||
<p>Or to make it so walls are an obstacle:</p>
|
||||
<pre><code> WALLS=0 ./play.sh</code></pre>
|
||||
<h1 id="notes-about-some-of-the-game-variables">6. <a name="variables" href="#toc">Notes about some of the game variables</a></h1>
|
||||
<div id="variables">
|
||||
<h1 id="notes-about-some-of-the-game-variables">6. <a href="#toc">Notes about some of the game variables</a></h1>
|
||||
</div>
|
||||
<p>The game variables can be used for a variety of things including different
|
||||
gameplay modes (as shown above) but here are some general notes about a few of them.</p>
|
||||
<h2 id="wait-snake-speed"><a name="wait" href="#toc">WAIT: Snake speed</a></h2>
|
||||
<div id="wait">
|
||||
<h2 id="wait-snake-speed"><a href="#toc">WAIT: Snake speed</a></h2>
|
||||
</div>
|
||||
<p>Besides the different game modes, if you find it too fast/slow you can change it
|
||||
to a value that’s better for you. Remember it’s a wait time so if you want the
|
||||
snake to move slower you have to increase the wait time!</p>
|
||||
<h2 id="evade-bug-evasion-frequency"><a name="evade" href="#toc">EVADE: Bug evasion frequency</a></h2>
|
||||
<div id="evade">
|
||||
<h2 id="evade-bug-evasion-frequency"><a href="#toc">EVADE: Bug evasion frequency</a></h2>
|
||||
</div>
|
||||
<p>For every <strong>EVADE</strong> 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.</p>
|
||||
<p>Each time the bug is placed the counter will be reset whether from eating the
|
||||
bug or not reaching it in time. Default 300 moves.</p>
|
||||
<p>This can help you get out of a trap but it can also sometimes make it harder.</p>
|
||||
<h2 id="size-maxsize-initial-max-snake-sizes"><a name="sizes" href="#toc">SIZE / MAXSIZE: Initial / Max snake sizes</a></h2>
|
||||
<div id="sizes">
|
||||
<h2 id="size-maxsize-initial-max-snake-sizes"><a href="#toc">SIZE / MAXSIZE: Initial / Max snake sizes</a></h2>
|
||||
</div>
|
||||
<p>997 might be a bit high for many people. Or maybe you don’t have enough time. Or
|
||||
you’re not in the mood to lose. Or you want to get close to a size you were last
|
||||
time but quickly. It might be in conjunction with drawing mode.</p>
|
||||
@@ -702,10 +751,14 @@ the snake will ‘populate’ in the snake arrays and the visible size: as I hav
|
||||
discussed here and there the snake doesn’t grow immediately so it takes time
|
||||
before the snake is visibly that many characters. In other words just because it
|
||||
says SIZE 29 doesn’t mean it will instantly be 29 characters on the screen.</p>
|
||||
<h2 id="grow-sheds-growth-shedding-sizes"><a name="growth" href="#toc">GROW / SHEDS : Growth / Shedding sizes</a></h2>
|
||||
<div id="growth">
|
||||
<h2 id="grow-sheds-growth-shedding-sizes"><a href="#toc">GROW / SHEDS : Growth / Shedding sizes</a></h2>
|
||||
</div>
|
||||
<p>Similar to the initial size. Notice that the above point on size applies here:
|
||||
it will take the number of movements before it is ‘its full size’.</p>
|
||||
<h1 id="conclusion-and-inspirational-words-for-everyone">7. <a name="conclusions" href="#toc">Conclusion (and inspirational words for everyone)</a></h1>
|
||||
<div id="conclusions">
|
||||
<h1 id="conclusion-and-inspirational-words-for-everyone">7. <a href="#toc">Conclusion (and inspirational words for everyone)</a></h1>
|
||||
</div>
|
||||
<p>I believe that this file has given more than enough information for anyone to
|
||||
get an idea of what is possible with my implementation of Snake. I realise also
|
||||
that most people won’t have read this far and that’s quite all right; I’m very
|
||||
|
||||
+113
-58
@@ -3,8 +3,7 @@ have included much more than just the input keys and a few printouts of the
|
||||
game. For normal play you probably don't even need this file at all unless it be
|
||||
for the input keys.
|
||||
|
||||
<a name="toc"></a>
|
||||
|
||||
<div id="toc">
|
||||
1. [Testing terminal environment/capabilities](#support)
|
||||
|
||||
2. [Input keys](#input)
|
||||
@@ -46,20 +45,25 @@ for the input keys.
|
||||
|
||||
|
||||
7. [Conclusion (and inspirational words for everyone)](#conclusions)
|
||||
</div>
|
||||
|
||||
|
||||
# 1. <a name="support" href="#toc">Testing terminal environment/capabilities</a>
|
||||
<div id="support">
|
||||
# 1. <a href="#toc">Testing terminal environment/capabilities</a>
|
||||
</div>
|
||||
|
||||
Most people probably won't have any issue at all but for those who have any
|
||||
problems with the terminal see the [terminals.html][] ([terminals.md][] on
|
||||
GitHub) file for more information on the terminal capabilities testing utility I
|
||||
problems with the terminal see the [terminals.html][]
|
||||
file for more information on the terminal capabilities testing utility I
|
||||
include.
|
||||
|
||||
For troubleshooting other problems see [troubleshooting.html][]
|
||||
([troubleshooting.md][] on GitHub) and [bugs.html][] ([bugs.md][] on GitHub).
|
||||
and [bugs.html][].
|
||||
|
||||
|
||||
# 2. <a name="input" href="#toc">Input keys</a>
|
||||
<div id="input">
|
||||
# 2. <a href="#toc">Input keys</a>
|
||||
</div>
|
||||
|
||||
- Left, right, up and down **arrow keys**: move that direction.
|
||||
- `q` (and `Q`): quit the game.
|
||||
@@ -68,7 +72,10 @@ For troubleshooting other problems see [troubleshooting.html][]
|
||||
that `getch()` picks up on and the game is not paused then it will be as if
|
||||
you pressed the current direction key (assuming you already moved the snake).
|
||||
|
||||
# 3. <a name="gameplay" href="#toc">Gameplay</a>
|
||||
|
||||
<div id="gameplay">
|
||||
# 3. <a href="#toc">Gameplay</a>
|
||||
</div>
|
||||
|
||||
Here I will show the initial screen as well as what a few things look like. If
|
||||
you don't feel you need this but you want to configure colours jump to [colour
|
||||
@@ -79,7 +86,9 @@ The bug colour by default is white; the snake head colour is red and the snake
|
||||
body colour is green. The walls are cyan.
|
||||
|
||||
|
||||
## <a name="initial" href="#toc">Gameplay: The initial screen</a>
|
||||
<div id="initial">
|
||||
## <a href="#toc">Gameplay: The initial screen</a>
|
||||
</div>
|
||||
|
||||
When you load the game you will see a screen that looks something like the
|
||||
below. Note that the top line is the score/status line: the top wall is at line
|
||||
@@ -128,7 +137,9 @@ to the number in the diagram:
|
||||
- The number of bugs eaten so far is 0.
|
||||
|
||||
|
||||
## <a name="playing" href="#toc">Gameplay: Playing the game</a>
|
||||
<div id="playing">
|
||||
## <a href="#toc">Gameplay: Playing the game</a>
|
||||
</div>
|
||||
|
||||
|
||||
```
|
||||
@@ -202,7 +213,9 @@ Observe that the bug was eaten and a new bug spawned elsewhere. I went left
|
||||
three and then up one and could slither on to the bug.
|
||||
|
||||
|
||||
# <a name="walls" href="#toc">Gameplay: Walls</a>
|
||||
<div id="walls">
|
||||
# <a href="#toc">Gameplay: Walls</a>
|
||||
</div>
|
||||
|
||||
By default walls are passable (**WALLS=1**). Let's get to full size and go
|
||||
through the top wall:
|
||||
@@ -286,8 +299,9 @@ X:20/49 Y:1/16 S:150/658 B:0
|
||||
```
|
||||
|
||||
|
||||
|
||||
# <a name="cannibalism" href="#toc">Gameplay: Cannibalism</a>
|
||||
<div id="cannibalism">
|
||||
# <a href="#toc">Gameplay: Cannibalism</a>
|
||||
</div>
|
||||
|
||||
By default cannibalism is disabled (**CANNIBAL=0**) so if you run into yourself it might look
|
||||
something like:
|
||||
@@ -395,19 +409,24 @@ snake) turn (so that you go perpendicular) and then watch as the snake starts
|
||||
unwinding at one place and then suddenly unwinds another direction.
|
||||
|
||||
An example of extreme cannibalism is in the [cannibalism.log.html][]
|
||||
([cannibalism.log.md][] on GitHub) file. It explains information about the file
|
||||
file. It explains information about the file
|
||||
including how to find the bug, head and tail of the snake, at least where it was
|
||||
documented. The first run has several dumps. The final example has the snake
|
||||
inside itself.
|
||||
|
||||
# <a name="shedding" href="#toc">Gameplay: Shedding (stretching)</a>
|
||||
|
||||
<div id="shedding">
|
||||
# <a href="#toc">Gameplay: Shedding (stretching)</a>
|
||||
</div>
|
||||
|
||||
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>
|
||||
<div id="winning">
|
||||
# <a href="#toc">Gameplay: Winning</a>
|
||||
</div>
|
||||
|
||||
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
|
||||
@@ -445,7 +464,9 @@ the default starting size and growth size of 5 the number of bugs needed before
|
||||
the game is won is 199 - also a prime!
|
||||
|
||||
|
||||
# <a name="quitting" href="#toc">Gameplay: Quitting</a>
|
||||
<div id="quitting">
|
||||
# <a href="#toc">Gameplay: Quitting</a>
|
||||
</div>
|
||||
|
||||
If you wish to quit you can hit 'q' (case-insensitive). For example:
|
||||
|
||||
@@ -454,10 +475,12 @@ If you wish to quit you can hit 'q' (case-insensitive). For example:
|
||||
```
|
||||
|
||||
|
||||
# 4. <a name="modes" href="#toc">Gameplay modes</a>
|
||||
<div id="modes">
|
||||
# 4. <a href="#toc">Gameplay modes</a>
|
||||
</div>
|
||||
|
||||
Here I list a number of different modes of play. In the [bugs.html][]
|
||||
([bugs.md][] on GitHub) file I even show how there's a built-in test unit for some
|
||||
file I even show how there's a built-in test unit for some
|
||||
modes! There are certainly other modes that could be imagined: the modes below
|
||||
happened over time and some were simply an accidental discovery or something I
|
||||
thought of by a chance; others were thought out from the beginning but were
|
||||
@@ -467,7 +490,9 @@ The [play.sh][] script sets up some of these automatically; I describe it after
|
||||
the modes below.
|
||||
|
||||
|
||||
## <a name="warning" href="#toc">Photosensitive epilepsy/Stimulation overload trigger warnings</a>
|
||||
<div id="warning">
|
||||
## <a href="#toc">Photosensitive epilepsy/Stimulation overload trigger warnings</a>
|
||||
</div>
|
||||
|
||||
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)
|
||||
@@ -481,7 +506,10 @@ stimulation for some people.**
|
||||
**Please be careful of these if these types of things have ever affected you or if
|
||||
you have any form of epilepsy. Thank you.**
|
||||
|
||||
## <a name="drawing" href="#toc">Gameplay mode: Drawing / Practice mode</a>
|
||||
|
||||
<div id="drawing">
|
||||
## <a href="#toc">Gameplay mode: Drawing / Practice mode</a>
|
||||
</div>
|
||||
|
||||
If you want to draw the snake wherever you like on the screen you can do this by
|
||||
modifying the wait time (for input) to -1 (or any value < 0): then the snake
|
||||
@@ -542,8 +570,9 @@ for. But you can consider this mode drawing or practice mode.
|
||||
```
|
||||
|
||||
|
||||
|
||||
## <a name="auto" href="#toc">Gameplay mode: Computer playing / Automatic mode (Photosensitive epilepsy/Stimulation overload trigger)</a>
|
||||
<div id="auto">
|
||||
## <a href="#toc">Gameplay mode: Computer playing / Automatic mode (Photosensitive epilepsy/Stimulation overload trigger)</a>
|
||||
</div>
|
||||
|
||||
**Photosensitive epilepsy/stimulation overload trigger warning:**
|
||||
For those who have epilepsy or are susceptible to stimulation overload from
|
||||
@@ -578,7 +607,10 @@ seems to take longer for it to get a bug as it gets longer. I believe these
|
||||
happen because the bug has to find a X and Y coordinate that's not occupied and
|
||||
so with fewer available it has a harder time finding a place in that one line.
|
||||
|
||||
### <a name="auto-variations" href="#toc">Computer player variations</a>
|
||||
|
||||
<div id="auto-variations">
|
||||
### <a href="#toc">Computer player variations</a>
|
||||
</div>
|
||||
|
||||
Here's how to make the bug move every time the snake moves:
|
||||
|
||||
@@ -650,7 +682,10 @@ horizontally the snake ran into itself at:
|
||||
What if you set the size to a high value? The lowest? There are bound to be
|
||||
other games to play with this feature!
|
||||
|
||||
## <a name="grow-shrink" href="#toc">Gameplay mode: Grow-Shrink mode (Positive and Negative Winning)</a>
|
||||
|
||||
<div id="grow-shrink">
|
||||
## <a href="#toc">Gameplay mode: Grow-Shrink mode (Positive and Negative Winning)</a>
|
||||
</div>
|
||||
|
||||
In this mode you're simultaneously growing and shrinking but because the max
|
||||
size is unsigned you can win both by shrinking to the point of losing your body
|
||||
@@ -676,7 +711,7 @@ The parameters above were chosen after playing with the mode a bit to find a
|
||||
value that wouldn't take that much time but still would pose a challenge. One
|
||||
could reverse it so that one shrinks more than growing.
|
||||
|
||||
The [crazy.log.html][] ([crazy.log.md][] on GitHub) file has several screen
|
||||
The [crazy.log.html][] file has several screen
|
||||
dumps with this idea.
|
||||
|
||||
You could also have it so that eating a bug makes you shrink and moving so many
|
||||
@@ -692,7 +727,9 @@ of them (the above is option 5; others are 4, 15 and 16 but only options 4 and 5
|
||||
are called Grow / Shrink).
|
||||
|
||||
|
||||
## <a name="hypnotic" href="#toc">Hypnotic / Sleepy mode (**Photosensitive epilepsy/Stimulation overload trigger**)</a>
|
||||
<div id="hypnotic">
|
||||
## <a href="#toc">Hypnotic / Sleepy mode (**Photosensitive epilepsy/Stimulation overload trigger**)</a>
|
||||
</div>
|
||||
|
||||
**Photosensitive epilepsy/stimulation overload trigger warning:**
|
||||
For those who have epilepsy or are susceptible to stimulation overload from
|
||||
@@ -713,7 +750,9 @@ And just moving the snake about not trying to catch any bugs - just let whatever
|
||||
happens happen.
|
||||
|
||||
|
||||
## <a name="stim" href="#toc">Gameplay mode: Stimulation / Calming mode</a>
|
||||
<div id="stim">
|
||||
## <a href="#toc">Gameplay mode: Stimulation / Calming mode</a>
|
||||
</div>
|
||||
|
||||
If you just need something to stimulate your mind to keep you calm or simply you
|
||||
want to play a game without having to worry about winning or losing you can set
|
||||
@@ -726,7 +765,9 @@ worry about even running into yourself and losing:
|
||||
```
|
||||
|
||||
|
||||
## <a name="expansibility" href="#toc">Gameplay mode: Expansibility</a>
|
||||
<div id="expansibility">
|
||||
## <a href="#toc">Gameplay mode: Expansibility</a>
|
||||
</div>
|
||||
|
||||
As I was writing this document and the game modes I have thought of other game
|
||||
modes (they were added) and I have come back to this document to add more modes.
|
||||
@@ -743,35 +784,43 @@ are therefore disregarded if even heard. I have played this game a lot for this
|
||||
reason as well as I simply enjoy it and thinking up new modes.
|
||||
|
||||
|
||||
# 5. <a name="scripts" href="#toc">Scripts</a>
|
||||
<div id="scripts">
|
||||
# 5. <a href="#toc">Scripts</a>
|
||||
</div>
|
||||
|
||||
The following scripts are provided to simplify and automate some of the things
|
||||
this file discusses as well as allowing to easily change the colours.
|
||||
|
||||
## <a name="colours" href="#toc">Colours selection: snake-colours</a>
|
||||
|
||||
To do this use the [snake-colours][] script like so:
|
||||
<div id="colours">
|
||||
## <a href="#toc">Colours selection: snake-colours</a>
|
||||
</div>
|
||||
|
||||
To do this use the [snake-colours.sh][] script like so:
|
||||
|
||||
``` <!---sh-->
|
||||
./snake-colours
|
||||
./snake-colours.sh
|
||||
```
|
||||
|
||||
If you want to pass in specific variables you can do that too e.g.:
|
||||
|
||||
``` <!---sh-->
|
||||
CANNIBAL=1 ./snake-colours
|
||||
CANNIBAL=1 ./snake-colours.sh
|
||||
```
|
||||
|
||||
The script will prompt you for the colour of the walls, snake head, body and the
|
||||
bug.
|
||||
|
||||
## <a name="preset" href="#toc">Automate the above gameplay modes</a>
|
||||
|
||||
<div id="preset">
|
||||
## <a href="#toc">Automate the above gameplay modes</a>
|
||||
</div>
|
||||
|
||||
The [play.sh][] script has the gameplay modes described in this file and is menu
|
||||
based (there might be differences and some of the modes I include a variation).
|
||||
The script tests the terminal (allowing you to continue even if problems are
|
||||
detected), prompts you if you want to select colours (like those in
|
||||
snake-colours above) and then gives you a list of game modes to play. You can
|
||||
snake-colours.sh above) and then gives you a list of game modes to play. You can
|
||||
pass in the game variables but note that if you pass in a variable that the mode
|
||||
you choose uses then the script will override what you pass in.
|
||||
|
||||
@@ -788,19 +837,26 @@ Or to make it so walls are an obstacle:
|
||||
```
|
||||
|
||||
|
||||
# 6. <a name="variables" href="#toc">Notes about some of the game variables</a>
|
||||
<div id="variables">
|
||||
# 6. <a href="#toc">Notes about some of the game variables</a>
|
||||
</div>
|
||||
|
||||
The game variables can be used for a variety of things including different
|
||||
gameplay modes (as shown above) but here are some general notes about a few of them.
|
||||
|
||||
## <a name="wait" href="#toc">WAIT: Snake speed</a>
|
||||
|
||||
<div id="wait">
|
||||
## <a href="#toc">WAIT: Snake speed</a>
|
||||
</div>
|
||||
|
||||
Besides the different game modes, if you find it too fast/slow you can change it
|
||||
to a value that's better for you. Remember it's a wait time so if you want the
|
||||
snake to move slower you have to increase the wait time!
|
||||
|
||||
|
||||
## <a name="evade" href="#toc">EVADE: Bug evasion frequency</a>
|
||||
<div id="evade">
|
||||
## <a href="#toc">EVADE: Bug evasion frequency</a>
|
||||
</div>
|
||||
|
||||
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
|
||||
@@ -812,7 +868,9 @@ bug or not reaching it in time. Default 300 moves.
|
||||
This can help you get out of a trap but it can also sometimes make it harder.
|
||||
|
||||
|
||||
## <a name="sizes" href="#toc">SIZE / MAXSIZE: Initial / Max snake sizes</a>
|
||||
<div id="sizes">
|
||||
## <a href="#toc">SIZE / MAXSIZE: Initial / Max snake sizes</a>
|
||||
</div>
|
||||
|
||||
997 might be a bit high for many people. Or maybe you don't have enough time. Or
|
||||
you're not in the mood to lose. Or you want to get close to a size you were last
|
||||
@@ -825,14 +883,17 @@ before the snake is visibly that many characters. In other words just because it
|
||||
says SIZE 29 doesn't mean it will instantly be 29 characters on the screen.
|
||||
|
||||
|
||||
## <a name="growth" href="#toc">GROW / SHEDS : Growth / Shedding sizes</a>
|
||||
<div id="growth">
|
||||
## <a href="#toc">GROW / SHEDS : Growth / Shedding sizes</a>
|
||||
</div>
|
||||
|
||||
Similar to the initial size. Notice that the above point on size applies here:
|
||||
it will take the number of movements before it is 'its full size'.
|
||||
|
||||
|
||||
|
||||
# 7. <a name="conclusions" href="#toc">Conclusion (and inspirational words for everyone)</a>
|
||||
<div id="conclusions">
|
||||
# 7. <a href="#toc">Conclusion (and inspirational words for everyone)</a>
|
||||
</div>
|
||||
|
||||
I believe that this file has given more than enough information for anyone to
|
||||
get an idea of what is possible with my implementation of Snake. I realise also
|
||||
@@ -849,22 +910,16 @@ the imagination and creativity almost anything is possible.** This is something
|
||||
they believe in themselves!** I would have never thought this the case for me
|
||||
years ago but I know it's true now. **Believe in yourself. Always.**
|
||||
|
||||
[terminals.md]: terminals.md
|
||||
[terminals.html]: terminals.html
|
||||
[troubleshooting.md]: troubleshooting.md
|
||||
[troubleshooting.html]: troubleshooting.html
|
||||
[bugs.md]: bugs.md
|
||||
[bugs.html]: bugs.html
|
||||
[spoilers.md]: spoilers.md
|
||||
[spoilers.html]: spoilers.html
|
||||
[snake-colours]: snake-colours
|
||||
[terminals.html]: %%REPO_URL%%/2020/ferguson1/terminals.html
|
||||
[troubleshooting.html]: %%REPO_URL%%/2020/ferguson1/troubleshooting.html
|
||||
[bugs.html]: %%REPO_URL%%/2020/ferguson1/bugs.html
|
||||
[spoilers.html]: %%REPO_URL%%/2020/ferguson1/spoilers.html
|
||||
[snake-colours.sh]: %%REPO_URL%%/2020/ferguson1/snake-colours.sh
|
||||
[number of hertz (flashes) per second triggering seizures]: https://www.epilepsysociety.org.uk/photosensitive-epilepsy#.Xjgpwi2ZOgQ
|
||||
[termcaps.c]: termcaps.c
|
||||
[cannibalism.log.md]: cannibalism.log.md
|
||||
[cannibalism.log.html]: cannibalism.log.html
|
||||
[crazy.log.md]: crazy.log.md
|
||||
[crazy.log.html]: crazy.log.html
|
||||
[play.sh]: play.sh
|
||||
[termcaps.c]: %%REPO_URL%%/2020/ferguson1/termcaps.c
|
||||
[cannibalism.log.html]: %%REPO_URL%%/2020/ferguson1/cannibalism.log.html
|
||||
[crazy.log.html]: %%REPO_URL%%/2020/ferguson1/crazy.log.html
|
||||
[play.sh]: %%REPO_URL%%/2020/ferguson1/play.sh
|
||||
|
||||
|
||||
<hr style="width:10%;text-align:left;margin-left:0">
|
||||
|
||||
@@ -135,7 +135,7 @@
|
||||
|
||||
<!-- BEFORE: 1st line of markdown file: 2020/ferguson1/spoilers.md -->
|
||||
<h1 id="introduction-spoiler-alert">Introduction (SPOILER ALERT)</h1>
|
||||
<p>In the <a href="gameplay.html">gameplay.html</a> (<a href="gameplay.md">gameplay.md</a> on GitHub) file I have given enough
|
||||
<p>In the <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/ferguson1/gameplay.html">gameplay.html</a> file I have given enough
|
||||
information to know how the game looks, how to move the snake, how to pause etc.
|
||||
In this file I am including (some) information on how the game actually works:
|
||||
the technical details as it were, obfuscation techniques and also some of the
|
||||
@@ -145,7 +145,7 @@ everything will be answered here.</p>
|
||||
<p>If you’re still interested in this file (i.e. you’re a judge or someone who
|
||||
wants to know more about it) read on. Yes I write a lot. But you probably
|
||||
already knew that so no harm there, hey?</p>
|
||||
<p><a name="toc"></a></p>
|
||||
<div id="toc">
|
||||
<ul>
|
||||
<li><a href="#works">How does it work?</a></li>
|
||||
<li><a href="#movement">How does the snake movement work?</a></li>
|
||||
@@ -159,7 +159,10 @@ already knew that so no harm there, hey?</p>
|
||||
<li><a href="#skinning">Skinning the snake (i.e. decreasing the iocccsize)</a></li>
|
||||
<li><a href="#size">A few more interesting size optimisations</a></li>
|
||||
</ul>
|
||||
<h1 id="how-does-it-work"><a name="works" href="#toc">How does it work?</a></h1>
|
||||
</div>
|
||||
<div id="works">
|
||||
<h1 id="how-does-it-work"><a href="#toc">How does it work?</a></h1>
|
||||
</div>
|
||||
<p>The gameplay I have already described but this explains the way things are
|
||||
actually done in more detail.</p>
|
||||
<p>First I initialise curses; if this fails I print an error message (<code>curses error</code>) and return 1. Next the screen size is determined and I subtract 1 from
|
||||
@@ -220,7 +223,9 @@ location is updated and redrawn.</p>
|
||||
<p>There’s also the processing of any shedding at this point. If the snake eats a
|
||||
bug the snake will not shed; if it sheds the snake will not move in the same
|
||||
manner as if it simply moved. Growth/movement can in some ways be conflated.</p>
|
||||
<h1 id="how-does-the-snake-movement-work"><a name="movement" href="#toc">How does the snake movement work?</a></h1>
|
||||
<div id="movement">
|
||||
<h1 id="how-does-the-snake-movement-work"><a href="#toc">How does the snake movement work?</a></h1>
|
||||
</div>
|
||||
<p>The way the snake looks to move is that every time the snake moves the last
|
||||
position (the tail) is replaced with a space (<code>' '</code>). If the snake eats a bug
|
||||
then the snake will get bigger in the next <code>N</code> movements. Note that if the snake
|
||||
@@ -229,14 +234,18 @@ moving at the tail end; I have discussed this more than enough elsewhere.</p>
|
||||
<p>There are two arrays that store the last Y/X coordinates of the snake’s
|
||||
positions that are shifted forward as the snake moves about the field looking
|
||||
for bugs.</p>
|
||||
<h1 id="drawing-manual-and-computer-playing-automatic-modes"><a name="manual-automatic" href="#toc">Drawing (manual) and computer playing (automatic) modes</a></h1>
|
||||
<div id="manual-automatic">
|
||||
<h1 id="drawing-manual-and-computer-playing-automatic-modes"><a href="#toc">Drawing (manual) and computer playing (automatic) modes</a></h1>
|
||||
</div>
|
||||
<p>How do these modes work? The <code>timeout()</code> function takes a signed int: if it’s <code>< 0</code> it waits indefinitely; if it’s <code>0</code> it returns immediately even if there’s no
|
||||
input waiting (if input is there then it’s used instead); and if it’s <code>> 0</code> it
|
||||
waits that many milliseconds. Thus a negative value allows for complete control
|
||||
over the snake’s movement (speed and otherwise), a value of <code>0</code> means the snake
|
||||
will move as long as it’s not paused etc. and otherwise it waits up to that many
|
||||
milliseconds (which is how the <code>0</code> value comes into play).</p>
|
||||
<h1 id="collision-detection"><a name="collision" href="#toc">Collision detection</a></h1>
|
||||
<div id="collision">
|
||||
<h1 id="collision-detection"><a href="#toc">Collision detection</a></h1>
|
||||
</div>
|
||||
<p>This was an interesting thing to work out. Because the snake could occupy more
|
||||
than one row and more than one column at a time the two arrays approach seemed
|
||||
good to me.</p>
|
||||
@@ -247,7 +256,9 @@ or the bug.</p>
|
||||
<p>The bug does its best to avoid landing where the snake is but given that snakes
|
||||
are very flexible and cunning who can tell what might happen? As I noted <em>these
|
||||
bugs are not bugs! :)</em></p>
|
||||
<h2 id="cannibal-collision-detection"><a name="cannibalcollision" href="#toc">Cannibal collision detection</a></h2>
|
||||
<div id="cannibalcollision">
|
||||
<h2 id="cannibal-collision-detection"><a href="#toc">Cannibal collision detection</a></h2>
|
||||
</div>
|
||||
<p>How does cannibalism change collision detection? The fact that each time the
|
||||
snake function is called there is a space printed at the tail end was a problem
|
||||
to resolve: what happened is if the snake went through itself then at some point
|
||||
@@ -271,7 +282,9 @@ mode exists for a different kind of play means it should look unnatural: for it
|
||||
<p>The second is you can look at it as if two more snakes are having fun with each
|
||||
other. This can also appear to defy physics!</p>
|
||||
<p>Choose your poison. Or rather your venom.</p>
|
||||
<h2 id="collision-detection-when-resizing-the-window-of-the-game"><a name="resizing" href="#toc">Collision detection when resizing the window of the game</a></h2>
|
||||
<div id="resizing">
|
||||
<h2 id="collision-detection-when-resizing-the-window-of-the-game"><a href="#toc">Collision detection when resizing the window of the game</a></h2>
|
||||
</div>
|
||||
<p>What happens if the window is resized during the game? If the size is increased
|
||||
then the border can (and will) stay the same; but if the window is shrunk then
|
||||
what? It would be very difficult if not impossible to redraw the snake: where
|
||||
@@ -285,7 +298,7 @@ remain the same. This GREATLY simplified things.</p>
|
||||
<p>There was another problem at some point where the snake would quickly grow if it
|
||||
was increased in size but I believe that’s resolved. Anyway what kind of field
|
||||
in real life increases in size like that so suddenly? :)</p>
|
||||
<h1 id="obfuscation"><a name="obfuscation" href="#toc">Obfuscation</a></h1>
|
||||
<h1 id="obfuscation"><a href="#toc">Obfuscation</a></h1>
|
||||
<ul>
|
||||
<li><p>I make use of the C token pasting operator. Although this is well known it’s
|
||||
probably less known and either way it’s not as simple as just having the code
|
||||
@@ -454,11 +467,11 @@ refer to a <code>x</code> is possibly confusing even without the negative offset
|
||||
<p>Of course I don’t have to use negative offsets at all! I could use positive
|
||||
offsets for every time I use negative offsets. But where’s the fun in that? :)</p>
|
||||
<p>BTW: Some of these are not in the table of expressions in the
|
||||
<a href="HACKING.html">HACKING.html</a> (<a href="HACKING.md">HACKING.md</a> on GitHub) file. Also there might be some
|
||||
<a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/ferguson1/HACKING.html">HACKING.html</a> file. Also there might be some
|
||||
code in there that is no longer correct (it was before I started
|
||||
obfuscation) though it might be able to give an idea. Spoilers abound in
|
||||
that file (in addition to this file) but the <a href="HACKING.html">HACKING.html</a> (<a href="HACKING.md">HACKING.md</a>
|
||||
on GitHub) file states things that are no longer true: a way of obfuscation
|
||||
that file (in addition to this file) but the <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/ferguson1/HACKING.html">HACKING.html</a>
|
||||
file states things that are no longer true: a way of obfuscation
|
||||
itself! Instead of misleading comments it’s misleading statements in the
|
||||
file that explains what some of the things are for!</p></li>
|
||||
<li><p>Misleading variable names for coordinates. In other words the <code>Y</code> coordinate is
|
||||
@@ -746,7 +759,9 @@ goal; I think I did it but maybe I missed one here and/or there):</p>
|
||||
the file based on the 120 columns total. I believe I have succeeded in that
|
||||
though again maybe I have an off by one or two here and/or there.</p>
|
||||
<p>Most of the primes above were intentional.</p>
|
||||
<h1 id="skinning-the-snake-i.e.-decreasing-the-iocccsize"><a name="skinning" href="#toc">Skinning the snake (i.e. decreasing the iocccsize)</a></h1>
|
||||
<div id="skinning">
|
||||
<h1 id="skinning-the-snake-i.e.-decreasing-the-iocccsize"><a href="#toc">Skinning the snake (i.e. decreasing the iocccsize)</a></h1>
|
||||
</div>
|
||||
<p>This happened in a number of ways and I have already documented some in other
|
||||
parts. Now there are a number of reasons to do this: amongst them to make it
|
||||
possible to obfuscate (plus a more unique layout) but also to add more features.</p>
|
||||
@@ -784,7 +799,9 @@ for <code>A > 1</code> but I could refer to just <code>I</code> instead of <c
|
||||
add additional features and also to add proper error reporting (when <code>calloc()</code>
|
||||
failed I called <code>abort()</code> and before that if initialising ncurses failed I also
|
||||
called <code>abort()</code> and did not report any errors in either event but I do now).</p>
|
||||
<h1 id="a-few-more-interesting-size-optimisations"><a name="size" href="#toc">A few more interesting size optimisations</a></h1>
|
||||
<div id="size">
|
||||
<h1 id="a-few-more-interesting-size-optimisations"><a href="#toc">A few more interesting size optimisations</a></h1>
|
||||
</div>
|
||||
<p>As I was getting to the end of obfuscation (wrt size available - and it was
|
||||
getting pretty obfuscated too - the majority of the techniques were already in
|
||||
place at this point) I was looking at the code to see if I could figure out how
|
||||
@@ -844,8 +861,8 @@ the score line is updated: so the empty space will be overwritten anyway. And if
|
||||
the score line is made an empty string it doesn’t matter because it’ll appear as
|
||||
all spaces anyway. Thus I could save another three bytes by changing it to:</p>
|
||||
<pre><code> !o && q *U,*V,' ');</code></pre>
|
||||
<p>Technically it would be a <code>" "</code> (see <a href="HACKING.html">HACKING.html</a> or on GitHub
|
||||
<a href="HACKING.md">HACKING.md</a>) else for N (not referring to the variable though it might very
|
||||
<p>Technically it would be a <code>" "</code> (see <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/ferguson1/HACKING.html">HACKING.html</a>
|
||||
else for N (not referring to the variable though it might very
|
||||
well matter here too) movements (i.e. due to sizes) you will at times (e.g.
|
||||
after eating a bug) see the snake body char at 0,0. I’m not bothered about that
|
||||
though because the score line is meant to display something, it squeezes a few
|
||||
|
||||
+39
-21
@@ -1,6 +1,6 @@
|
||||
# Introduction (SPOILER ALERT)
|
||||
|
||||
In the [gameplay.html][] ([gameplay.md][] on GitHub) file I have given enough
|
||||
In the [gameplay.html][] file I have given enough
|
||||
information to know how the game looks, how to move the snake, how to pause etc.
|
||||
In this file I am including (some) information on how the game actually works:
|
||||
the technical details as it were, obfuscation techniques and also some of the
|
||||
@@ -12,8 +12,7 @@ If you're still interested in this file (i.e. you're a judge or someone who
|
||||
wants to know more about it) read on. Yes I write a lot. But you probably
|
||||
already knew that so no harm there, hey?
|
||||
|
||||
<a name="toc"></a>
|
||||
|
||||
<div id="toc">
|
||||
- [How does it work?](#works)
|
||||
- [How does the snake movement work?](#movement)
|
||||
- [Drawing (manual) and computer playing (automatic) modes](#manual-automatic)
|
||||
@@ -23,9 +22,12 @@ already knew that so no harm there, hey?
|
||||
- [Obfuscation](#obfuscation)
|
||||
- [Skinning the snake (i.e. decreasing the iocccsize)](#skinning)
|
||||
- [A few more interesting size optimisations](#size)
|
||||
</div>
|
||||
|
||||
|
||||
# <a name="works" href="#toc">How does it work?</a>
|
||||
<div id="works">
|
||||
# <a href="#toc">How does it work?</a>
|
||||
</div>
|
||||
|
||||
The gameplay I have already described but this explains the way things are
|
||||
actually done in more detail.
|
||||
@@ -105,7 +107,9 @@ bug the snake will not shed; if it sheds the snake will not move in the same
|
||||
manner as if it simply moved. Growth/movement can in some ways be conflated.
|
||||
|
||||
|
||||
# <a name="movement" href="#toc">How does the snake movement work?</a>
|
||||
<div id="movement">
|
||||
# <a href="#toc">How does the snake movement work?</a>
|
||||
</div>
|
||||
|
||||
The way the snake looks to move is that every time the snake moves the last
|
||||
position (the tail) is replaced with a space (`' '`). If the snake eats a bug
|
||||
@@ -118,7 +122,9 @@ positions that are shifted forward as the snake moves about the field looking
|
||||
for bugs.
|
||||
|
||||
|
||||
# <a name="manual-automatic" href="#toc">Drawing (manual) and computer playing (automatic) modes</a>
|
||||
<div id="manual-automatic">
|
||||
# <a href="#toc">Drawing (manual) and computer playing (automatic) modes</a>
|
||||
</div>
|
||||
|
||||
How do these modes work? The `timeout()` function takes a signed int: if it's `<
|
||||
0` it waits indefinitely; if it's `0` it returns immediately even if there's no
|
||||
@@ -129,7 +135,9 @@ will move as long as it's not paused etc. and otherwise it waits up to that many
|
||||
milliseconds (which is how the `0` value comes into play).
|
||||
|
||||
|
||||
# <a name="collision" href="#toc">Collision detection</a>
|
||||
<div id="collision">
|
||||
# <a href="#toc">Collision detection</a>
|
||||
</div>
|
||||
|
||||
This was an interesting thing to work out. Because the snake could occupy more
|
||||
than one row and more than one column at a time the two arrays approach seemed
|
||||
@@ -145,7 +153,9 @@ are very flexible and cunning who can tell what might happen? As I noted _these
|
||||
bugs are not bugs! :)_
|
||||
|
||||
|
||||
## <a name="cannibalcollision" href="#toc">Cannibal collision detection</a>
|
||||
<div id="cannibalcollision">
|
||||
## <a href="#toc">Cannibal collision detection</a>
|
||||
</div>
|
||||
|
||||
How does cannibalism change collision detection? The fact that each time the
|
||||
snake function is called there is a space printed at the tail end was a problem
|
||||
@@ -177,7 +187,9 @@ other. This can also appear to defy physics!
|
||||
Choose your poison. Or rather your venom.
|
||||
|
||||
|
||||
## <a name="resizing" href="#toc">Collision detection when resizing the window of the game</a>
|
||||
<div id="resizing">
|
||||
## <a href="#toc">Collision detection when resizing the window of the game</a>
|
||||
</div>
|
||||
|
||||
What happens if the window is resized during the game? If the size is increased
|
||||
then the border can (and will) stay the same; but if the window is shrunk then
|
||||
@@ -196,7 +208,9 @@ was increased in size but I believe that's resolved. Anyway what kind of field
|
||||
in real life increases in size like that so suddenly? :)
|
||||
|
||||
|
||||
# <a name="obfuscation" href="#toc">Obfuscation</a>
|
||||
<div id="obfuscation">
|
||||
# <a href="#toc">Obfuscation</a>
|
||||
</div>
|
||||
|
||||
- I make use of the C token pasting operator. Although this is well known it's
|
||||
probably less known and either way it's not as simple as just having the code
|
||||
@@ -427,11 +441,11 @@ dimensions. Now in the first call in `main()` I have the code and tests followin
|
||||
offsets for every time I use negative offsets. But where's the fun in that? :)
|
||||
|
||||
BTW: Some of these are not in the table of expressions in the
|
||||
[HACKING.html][] ([HACKING.md][] on GitHub) file. Also there might be some
|
||||
[HACKING.html][] file. Also there might be some
|
||||
code in there that is no longer correct (it was before I started
|
||||
obfuscation) though it might be able to give an idea. Spoilers abound in
|
||||
that file (in addition to this file) but the [HACKING.html][] ([HACKING.md][]
|
||||
on GitHub) file states things that are no longer true: a way of obfuscation
|
||||
that file (in addition to this file) but the [HACKING.html][]
|
||||
file states things that are no longer true: a way of obfuscation
|
||||
itself! Instead of misleading comments it's misleading statements in the
|
||||
file that explains what some of the things are for!
|
||||
|
||||
@@ -783,7 +797,10 @@ though again maybe I have an off by one or two here and/or there.
|
||||
|
||||
Most of the primes above were intentional.
|
||||
|
||||
# <a name="skinning" href="#toc">Skinning the snake (i.e. decreasing the iocccsize)</a>
|
||||
|
||||
<div id="skinning">
|
||||
# <a href="#toc">Skinning the snake (i.e. decreasing the iocccsize)</a>
|
||||
</div>
|
||||
|
||||
This happened in a number of ways and I have already documented some in other
|
||||
parts. Now there are a number of reasons to do this: amongst them to make it
|
||||
@@ -837,7 +854,10 @@ add additional features and also to add proper error reporting (when `calloc()`
|
||||
failed I called `abort()` and before that if initialising ncurses failed I also
|
||||
called `abort()` and did not report any errors in either event but I do now).
|
||||
|
||||
# <a name="size" href="#toc">A few more interesting size optimisations</a>
|
||||
|
||||
<div id="size">
|
||||
# <a href="#toc">A few more interesting size optimisations</a>
|
||||
</div>
|
||||
|
||||
As I was getting to the end of obfuscation (wrt size available - and it was
|
||||
getting pretty obfuscated too - the majority of the techniques were already in
|
||||
@@ -934,18 +954,16 @@ all spaces anyway. Thus I could save another three bytes by changing it to:
|
||||
!o && q *U,*V,' ');
|
||||
```
|
||||
|
||||
Technically it would be a `" "` (see [HACKING.html][] or on GitHub
|
||||
[HACKING.md][]) else for N (not referring to the variable though it might very
|
||||
Technically it would be a `" "` (see [HACKING.html][]
|
||||
else for N (not referring to the variable though it might very
|
||||
well matter here too) movements (i.e. due to sizes) you will at times (e.g.
|
||||
after eating a bug) see the snake body char at 0,0. I'm not bothered about that
|
||||
though because the score line is meant to display something, it squeezes a few
|
||||
more bytes and having a space is hardly an imposition on usage (and for that
|
||||
matter having a 'o' at 0,0 isn't either).
|
||||
|
||||
[gameplay.md]: gameplay.md
|
||||
[gameplay.html]: gameplay.html
|
||||
[HACKING.md]: HACKING.md
|
||||
[HACKING.html]: HACKING.html
|
||||
[gameplay.html]: %%REPO_URL%%/2020/ferguson1/gameplay.html
|
||||
[HACKING.html]: %%REPO_URL%%/2020/ferguson1/HACKING.html
|
||||
|
||||
|
||||
<hr style="width:10%;text-align:left;margin-left:0">
|
||||
|
||||
@@ -138,7 +138,7 @@
|
||||
<p>Terminals are very easy to mess up and for that reason they deserve their own
|
||||
file. I discuss terminal capabilities, dimensions (setting and how to restore
|
||||
sanity if it causes any problems) as well as colours (limitations etc.).</p>
|
||||
<p><a name="toc"></a></p>
|
||||
<div id="toc">
|
||||
<ul>
|
||||
<li><a href="#termcaps">Capabilities support testing program</a></li>
|
||||
<li><a href="#dimensions">Setting the game dimensions</a>
|
||||
@@ -157,14 +157,17 @@ sanity if it causes any problems) as well as colours (limitations etc.).</p>
|
||||
<li><a href="#disablecolour">Disabling colour</a></li>
|
||||
</ul></li>
|
||||
</ul>
|
||||
<h1 id="capabilities-support-testing-program"><a name="termcaps" href="#toc">Capabilities support testing program</a></h1>
|
||||
</div>
|
||||
<div id="termcaps">
|
||||
<h1 id="capabilities-support-testing-program"><a href="#toc">Capabilities support testing program</a></h1>
|
||||
</div>
|
||||
<p>Although it should be playable without the features I use (except that cursor
|
||||
movement is required) I have provided a source file that can test your terminal
|
||||
for the capabilities I use in the entry.</p>
|
||||
<p>It also tries to determine the minimum number of columns to play without the
|
||||
status line overflowing - even with the dynamic length. Try:</p>
|
||||
<pre><code> $ make test</code></pre>
|
||||
<p>This compiles the program <a href="termcaps.c">termcaps.c</a> and runs it; you should see something like:</p>
|
||||
<p>This compiles the program <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/ferguson1/termcaps.c">termcaps.c</a> and runs it; you should see something like:</p>
|
||||
<pre><code> terminal supports cursor movement
|
||||
terminal supports making cursor invisible
|
||||
terminal supports bold
|
||||
@@ -228,11 +231,15 @@ problems are if curses fails to initialise or if movement of cursor cannot be
|
||||
done (both seem unlikely to happen nowadays).</p>
|
||||
<p>Both scripts run this utility and prompt if there are any problems;
|
||||
you can continue either way.</p>
|
||||
<h1 id="setting-the-game-dimensions"><a name="dimensions" href="#toc">Setting the game dimensions</a></h1>
|
||||
<div id="dimensions">
|
||||
<h1 id="setting-the-game-dimensions"><a href="#toc">Setting the game dimensions</a></h1>
|
||||
</div>
|
||||
<p>There are a number of ways to do this and only one will keep the terminal sane
|
||||
all the time but that’s by running it under a terminal emulator that you can
|
||||
resize the window with first. But what if you want exacts?</p>
|
||||
<h2 id="the-lines-and-columns-environmental-variables"><a name="linescolumns" href="#toc">The LINES and COLUMNS environmental variables</a></h2>
|
||||
<div id="linescolumns">
|
||||
<h2 id="the-lines-and-columns-environmental-variables"><a href="#toc">The LINES and COLUMNS environmental variables</a></h2>
|
||||
</div>
|
||||
<p>To specify the lines/columns of curses program per instance use the <code>LINES</code> and
|
||||
<code>COLUMNS</code> environmental variables.</p>
|
||||
<p>For demonstration consider the following:</p>
|
||||
@@ -247,13 +254,17 @@ game dimensions) - to be 55; it might look like this instead:</p>
|
||||
<pre><code> X:27/54 Y:20/41 S:5/997 B:0</code></pre>
|
||||
<p>But problems can arise with messing with dimensions: in my tests this held only
|
||||
to lines.</p>
|
||||
<h2 id="terminal-insanity"><a name="insanity" href="#toc">Terminal insanity</a></h2>
|
||||
<div id="insanity">
|
||||
<h2 id="terminal-insanity"><a href="#toc">Terminal insanity</a></h2>
|
||||
</div>
|
||||
<p>Terminal sanity can be compromised and it can cause all sorts of output
|
||||
problems; it might not appear right away but it will show its ugly head
|
||||
eventually if you use it. For example pager output might be screwy, echo might
|
||||
be turned off, output of commands might overwrite the input of those commands,
|
||||
etc. For the game you might not see the final score.</p>
|
||||
<h3 id="restoring-the-terminal"><a name="restore" href="#toc">Restoring the terminal</a></h3>
|
||||
<div id="restore">
|
||||
<h3 id="restoring-the-terminal"><a href="#toc">Restoring the terminal</a></h3>
|
||||
</div>
|
||||
<p>In my tests there is one thing that at least allows you to see the final score
|
||||
and that is by running <code>clear</code> before running the program. That’s what the
|
||||
prog.alt version does. You might run it as one of:</p>
|
||||
@@ -277,7 +288,9 @@ fails log out and back in.</p>
|
||||
<p>For more information on this subject generally see the <a href="https://www.tldp.org/HOWTO/Keyboard-and-Console-HOWTO.html">Linux keyboard and
|
||||
console HOWTO</a> (specifically <a href="https://www.tldp.org/HOWTO/Keyboard-and-Console-HOWTO-4.html">Linux keyboard and console HOWTO section 4</a>).
|
||||
Yes this works under macOS (at least it did for me).</p>
|
||||
<h3 id="terminal-size-abuse"><a name="abuse" href="#toc">Terminal size abuse</a></h3>
|
||||
<div id="abuse">
|
||||
<h3 id="terminal-size-abuse"><a href="#toc">Terminal size abuse</a></h3>
|
||||
</div>
|
||||
<p>So players 1, 2 and 3 are content with not meddling with the terminal sizes
|
||||
outside what’s actually possible with their screen. But then player 4 comes
|
||||
along and thinks he/she will be clever and mess with the dimensions a bit. Let’s
|
||||
@@ -291,30 +304,37 @@ number of lines will be 997. If they were to do:</p>
|
||||
to be funny.</p>
|
||||
<p>The game will try and be funny in return and you can expect it to not function
|
||||
properly. Because that’s what funny means in this context.</p>
|
||||
<h1 id="terminal-limitations"><a name="termlimitations" href="#toc">Terminal limitations</a></h1>
|
||||
<div id="termlimitations">
|
||||
<h1 id="terminal-limitations"><a href="#toc">Terminal limitations</a></h1>
|
||||
</div>
|
||||
<p>It’d be nice if curses could detect hitting more than one arrow key at the
|
||||
same time so that diagonal directions would be possible but unfortunately it’s
|
||||
not (<code>cat -v</code> confirms this). Even if I were to define four extra keys what
|
||||
would they be? And what about the head character? The <a href="HACKING.html">HACKING.html</a>
|
||||
(<a href="HACKING.md">HACKING</a> on GitHub) file has information on this.</p>
|
||||
would they be? And what about the head character? The <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/ferguson1/HACKING.html">HACKING.html</a>
|
||||
file has information on this.</p>
|
||||
<p>I also limit the terminal size to 10 lines/columns but most likely it would
|
||||
require the cheat modes to win and in any event allowing certain low values
|
||||
causes problems e.g. <strong>LINES=6 COLUMNS=6</strong> and <strong>LINES=3 COLUMNS=3</strong> caused some
|
||||
nasty issues.</p>
|
||||
<h1 id="terminal-colours"><a name="colours" href="#toc">Terminal colours</a></h1>
|
||||
<div id="colours">
|
||||
<h1 id="terminal-colours"><a href="#toc">Terminal colours</a></h1>
|
||||
</div>
|
||||
<p>N.B.: If all you’re after is wanting to change the colours see the script
|
||||
<a href="snake-colours.sh">snake-colours.sh</a> instead. The rest of this file was mostly notes for the
|
||||
<a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/ferguson1/snake-colours.sh">snake-colours.sh</a> instead. The rest of this file was mostly notes for the
|
||||
judges; here I discuss the background, foreground as well as limitations (in
|
||||
particular runtime limitations).</p>
|
||||
<h2 id="curses-background"><a name="background" href="#toc">Curses background</a></h2>
|
||||
<div id="background">
|
||||
<h2 id="curses-background"><a href="#toc">Curses background</a></h2>
|
||||
</div>
|
||||
<p>The documentation I have seen says that the background will always be black and
|
||||
from a quick test this holds even with a terminal that has a white background.
|
||||
There is a way to force the background to remain white though that’s by way of
|
||||
monochrome (so no colours); I discuss that and another related terminal specific
|
||||
in the troubleshooting guide (there’s another way but it would take me over the
|
||||
iocccsize; I talk about it in the <a href="HACKING.html">HACKING.html</a> (<a href="HACKING.md">HACKING</a> on
|
||||
GitHub) file).</p>
|
||||
<h2 id="monochrome-terminals"><a name="monochrome" href="#toc">Monochrome terminals</a></h2>
|
||||
iocccsize; I talk about it in the <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/ferguson1/HACKING.html">HACKING.html</a>.</p>
|
||||
<div id="monochrome">
|
||||
<h2 id="monochrome-terminals"><a href="#toc">Monochrome terminals</a></h2>
|
||||
</div>
|
||||
<p>According to my tests for monochrome terminals the screen has the white and
|
||||
black background; if terminal is configured to be black background white
|
||||
foreground that is the order it is too. You can try that like:</p>
|
||||
@@ -324,7 +344,9 @@ implementation that has a problem here? Below I explain what to comment out
|
||||
should you need colours to be disabled but I personally have not run into any
|
||||
problems even with monochrome terminals. Later I say what to do to remove colour
|
||||
support in the source code itself.</p>
|
||||
<h2 id="colour-limitations"><a name="colourlimitations" href="#toc">Colour limitations</a></h2>
|
||||
<div id="colourlimitations">
|
||||
<h2 id="colour-limitations"><a href="#toc">Colour limitations</a></h2>
|
||||
</div>
|
||||
<p>According to X/Open Curses, Issue 7 (pg. 57):</p>
|
||||
<pre><code> With init_pair() and pair_content(), the value of pair must be in a range
|
||||
from 0 to and including COLOR_PAIRS-1. (There may be an
|
||||
@@ -385,7 +407,9 @@ instead:</p>
|
||||
won’t work for a colour-capable terminal but it doesn’t matter for monochrome
|
||||
terminals one way or another. And since I don’t go beyond the ranges (as I cited
|
||||
earlier) there shouldn’t be any problem here.</p>
|
||||
<h2 id="disabling-colour"><a name="disablecolour" href="#toc">Disabling colour</a></h2>
|
||||
<div id="disablecolour">
|
||||
<h2 id="disabling-colour"><a href="#toc">Disabling colour</a></h2>
|
||||
</div>
|
||||
<p>Nevertheless if it is a problem and you don’t want to use a monochrome terminal
|
||||
(or can’t):</p>
|
||||
<p>First comment out the code that has <code>start_color();</code> and then add <code>return;</code> to the
|
||||
|
||||
+49
-21
@@ -5,8 +5,7 @@ file. I discuss terminal capabilities, dimensions (setting and how to restore
|
||||
sanity if it causes any problems) as well as colours (limitations etc.).
|
||||
|
||||
|
||||
<a name="toc"></a>
|
||||
|
||||
<div id="toc">
|
||||
- [Capabilities support testing program](#termcaps)
|
||||
- [Setting the game dimensions](#dimensions)
|
||||
* [The LINES and COLUMNS environmental variables](#linescolumns)
|
||||
@@ -19,9 +18,12 @@ sanity if it causes any problems) as well as colours (limitations etc.).
|
||||
* [Monochrome terminals](#monochrome)
|
||||
* [Colour limitations](#colourlimitations)
|
||||
* [Disabling colour](#disablecolour)
|
||||
</div>
|
||||
|
||||
|
||||
# <a name="termcaps" href="#toc">Capabilities support testing program</a>
|
||||
<div id="termcaps">
|
||||
# <a href="#toc">Capabilities support testing program</a>
|
||||
</div>
|
||||
|
||||
Although it should be playable without the features I use (except that cursor
|
||||
movement is required) I have provided a source file that can test your terminal
|
||||
@@ -34,7 +36,7 @@ status line overflowing - even with the dynamic length. Try:
|
||||
$ make test
|
||||
```
|
||||
|
||||
This compiles the program [termcaps.c](termcaps.c) and runs it; you should see something like:
|
||||
This compiles the program [termcaps.c](%%REPO_URL%%/2020/ferguson1/termcaps.c) and runs it; you should see something like:
|
||||
|
||||
|
||||
```
|
||||
@@ -115,14 +117,19 @@ done (both seem unlikely to happen nowadays).
|
||||
Both scripts run this utility and prompt if there are any problems;
|
||||
you can continue either way.
|
||||
|
||||
# <a name="dimensions" href="#toc">Setting the game dimensions</a>
|
||||
|
||||
<div id="dimensions">
|
||||
# <a href="#toc">Setting the game dimensions</a>
|
||||
</div>
|
||||
|
||||
There are a number of ways to do this and only one will keep the terminal sane
|
||||
all the time but that's by running it under a terminal emulator that you can
|
||||
resize the window with first. But what if you want exacts?
|
||||
|
||||
|
||||
## <a name="linescolumns" href="#toc">The LINES and COLUMNS environmental variables</a>
|
||||
<div id="linescolumns">
|
||||
## <a href="#toc">The LINES and COLUMNS environmental variables</a>
|
||||
</div>
|
||||
|
||||
To specify the lines/columns of curses program per instance use the `LINES` and
|
||||
`COLUMNS` environmental variables.
|
||||
@@ -151,7 +158,10 @@ game dimensions) - to be 55; it might look like this instead:
|
||||
But problems can arise with messing with dimensions: in my tests this held only
|
||||
to lines.
|
||||
|
||||
## <a name="insanity" href="#toc">Terminal insanity</a>
|
||||
|
||||
<div id="insanity">
|
||||
## <a href="#toc">Terminal insanity</a>
|
||||
</div>
|
||||
|
||||
Terminal sanity can be compromised and it can cause all sorts of output
|
||||
problems; it might not appear right away but it will show its ugly head
|
||||
@@ -160,7 +170,9 @@ be turned off, output of commands might overwrite the input of those commands,
|
||||
etc. For the game you might not see the final score.
|
||||
|
||||
|
||||
### <a name="restore" href="#toc">Restoring the terminal</a>
|
||||
<div id="restore">
|
||||
### <a href="#toc">Restoring the terminal</a>
|
||||
</div>
|
||||
|
||||
In my tests there is one thing that at least allows you to see the final score
|
||||
and that is by running `clear` before running the program. That's what the
|
||||
@@ -201,7 +213,10 @@ For more information on this subject generally see the [Linux keyboard and
|
||||
console HOWTO][] (specifically [Linux keyboard and console HOWTO section 4][]).
|
||||
Yes this works under macOS (at least it did for me).
|
||||
|
||||
### <a name="abuse" href="#toc">Terminal size abuse</a>
|
||||
|
||||
<div id="abuse">
|
||||
### <a href="#toc">Terminal size abuse</a>
|
||||
</div>
|
||||
|
||||
So players 1, 2 and 3 are content with not meddling with the terminal sizes
|
||||
outside what's actually possible with their screen. But then player 4 comes
|
||||
@@ -227,13 +242,15 @@ The game will try and be funny in return and you can expect it to not function
|
||||
properly. Because that's what funny means in this context.
|
||||
|
||||
|
||||
# <a name="termlimitations" href="#toc">Terminal limitations</a>
|
||||
<div id="termlimitations">
|
||||
# <a href="#toc">Terminal limitations</a>
|
||||
</div>
|
||||
|
||||
It'd be nice if curses could detect hitting more than one arrow key at the
|
||||
same time so that diagonal directions would be possible but unfortunately it's
|
||||
not (`cat -v` confirms this). Even if I were to define four extra keys what
|
||||
would they be? And what about the head character? The [HACKING.html][]
|
||||
([HACKING](HACKING.md) on GitHub) file has information on this.
|
||||
file has information on this.
|
||||
|
||||
I also limit the terminal size to 10 lines/columns but most likely it would
|
||||
require the cheat modes to win and in any event allowing certain low values
|
||||
@@ -241,25 +258,31 @@ causes problems e.g. **LINES=6 COLUMNS=6** and **LINES=3 COLUMNS=3** caused some
|
||||
nasty issues.
|
||||
|
||||
|
||||
# <a name="colours" href="#toc">Terminal colours</a>
|
||||
<div id="colours">
|
||||
# <a href="#toc">Terminal colours</a>
|
||||
</div>
|
||||
|
||||
N.B.: If all you're after is wanting to change the colours see the script
|
||||
[snake-colours.sh][] instead. The rest of this file was mostly notes for the
|
||||
judges; here I discuss the background, foreground as well as limitations (in
|
||||
particular runtime limitations).
|
||||
|
||||
## <a name="background" href="#toc">Curses background</a>
|
||||
|
||||
<div id="background">
|
||||
## <a href="#toc">Curses background</a>
|
||||
</div>
|
||||
|
||||
The documentation I have seen says that the background will always be black and
|
||||
from a quick test this holds even with a terminal that has a white background.
|
||||
There is a way to force the background to remain white though that's by way of
|
||||
monochrome (so no colours); I discuss that and another related terminal specific
|
||||
in the troubleshooting guide (there's another way but it would take me over the
|
||||
iocccsize; I talk about it in the [HACKING.html][] ([HACKING](HACKING.md) on
|
||||
GitHub) file).
|
||||
iocccsize; I talk about it in the [HACKING.html][].
|
||||
|
||||
## <a name="monochrome" href="#toc">Monochrome terminals</a>
|
||||
|
||||
<div id="monochrome">
|
||||
## <a href="#toc">Monochrome terminals</a>
|
||||
</div>
|
||||
|
||||
According to my tests for monochrome terminals the screen has the white and
|
||||
black background; if terminal is configured to be black background white
|
||||
@@ -275,7 +298,10 @@ should you need colours to be disabled but I personally have not run into any
|
||||
problems even with monochrome terminals. Later I say what to do to remove colour
|
||||
support in the source code itself.
|
||||
|
||||
## <a name="colourlimitations" href="#toc">Colour limitations</a>
|
||||
|
||||
<div id="colourlimitations">
|
||||
## <a href="#toc">Colour limitations</a>
|
||||
</div>
|
||||
|
||||
According to X/Open Curses, Issue 7 (pg. 57):
|
||||
|
||||
@@ -369,7 +395,10 @@ won't work for a colour-capable terminal but it doesn't matter for monochrome
|
||||
terminals one way or another. And since I don't go beyond the ranges (as I cited
|
||||
earlier) there shouldn't be any problem here.
|
||||
|
||||
## <a name="disablecolour" href="#toc">Disabling colour</a>
|
||||
|
||||
<div id="disablecolour">
|
||||
## <a href="#toc">Disabling colour</a>
|
||||
</div>
|
||||
|
||||
Nevertheless if it is a problem and you don't want to use a monochrome terminal
|
||||
(or can't):
|
||||
@@ -381,11 +410,10 @@ you can also comment out the `init_pair()` calls.
|
||||
Perhaps you only need to add the `return;` to `C()`. My guess is that's the case
|
||||
but I do not know for certain.
|
||||
|
||||
[HACKING.md]: HACKING.md
|
||||
[HACKING.html]: HACKING.html
|
||||
[HACKING.html]: %%REPO_URL%%/2020/ferguson1/HACKING.html
|
||||
[Linux keyboard and console HOWTO]: https://www.tldp.org/HOWTO/Keyboard-and-Console-HOWTO.html
|
||||
[Linux keyboard and console HOWTO section 4]: https://www.tldp.org/HOWTO/Keyboard-and-Console-HOWTO-4.html
|
||||
[snake-colours.sh]: snake-colours.sh
|
||||
[snake-colours.sh]: %%REPO_URL%%/2020/ferguson1/snake-colours.sh
|
||||
|
||||
|
||||
<hr style="width:10%;text-align:left;margin-left:0">
|
||||
|
||||
@@ -157,7 +157,7 @@ it as structured as possible/easiest to find.</p>
|
||||
<h2 id="the-top-wall-isnt-allsome-of-the-time-visible"><a name="topwall" href="#toc">The top wall isn’t (all/some of the time) visible!</a></h2>
|
||||
<p>Because the score line is dynamic in length depending on the terminal size it
|
||||
can happen that the score/status wraps to the next line(s). This can be fixed by
|
||||
modifying the status line (see <a href="HACKING.html">HACKING.html</a> or on GitHub <a href="HACKING.md">HACKING.md</a>) but
|
||||
modifying the status line (see <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/ferguson1/HACKING.html">HACKING.html</a> but
|
||||
you shouldn’t need it to be very wide.</p>
|
||||
<ul>
|
||||
<li><p>RESOLUTION #0: Use a bigger screen (it doesn’t take that many columns)</p>
|
||||
@@ -166,12 +166,12 @@ needed. This won’t work right if you change the score line!</p>
|
||||
<p>Note that this utility is not perfect; I describe this elsewhere. Either way a
|
||||
small screen will make it harder to play esp without the cheat modes enabled
|
||||
(but they can still be fun with large screens).</p></li>
|
||||
<li><p>RESOLUTION #1: Open the <a href="prog.c">prog.c</a> and change the line</p>
|
||||
<li><p>RESOLUTION #1: Open the <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/ferguson1/prog.c">prog.c</a> and change the line</p>
|
||||
<pre><code> #define J Z(X:%d/%d Y:%d/%d S:%zu/%zu B:%zu\n),Y,y[-2],X, *y, A, g, c );</code></pre>
|
||||
<p>To be something like:</p>
|
||||
<pre><code> #define J Z(B:%zu\n), c);</code></pre>
|
||||
<p>Recompile and try again. That will then show only the number of bugs eaten.
|
||||
See the <a href="HACKING.html">HACKING.html</a> (<a href="HACKING.md">HACKING.md</a> on GitHub) file for other data you
|
||||
See the <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/ferguson1/HACKING.html">HACKING.html</a> file for other data you
|
||||
can include (though there are some discrepancies here and there as you’ll
|
||||
see).</p></li>
|
||||
</ul>
|
||||
@@ -194,8 +194,8 @@ when it does move you’ll see it doesn’t move for long.</p>
|
||||
<p>Sometimes also it might appear that the movement is delayed but there are
|
||||
numerous causes for this some of which are a busy computer but ultimately
|
||||
it’ll catch up; just give it the time it needs.</p></li>
|
||||
<li><p>BOTTOM LINE: If you want more information then see the <a href="bugs.html">bugs.html</a>
|
||||
(<a href="bugs.md">bugs.md</a> on GitHub) file.</p></li>
|
||||
<li><p>BOTTOM LINE: If you want more information then see the <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/ferguson1/bugs.html">bugs.html</a>
|
||||
file.</p></li>
|
||||
</ul>
|
||||
<h2 id="i-cant-see-the-snake-head-or-other-part-of-the-snake"><a name="invisiblehead" href="#toc">I can’t see the snake head (or other part of the snake)!</a></h2>
|
||||
<p>Possibly this could happen with too long a score line which I already discussed.
|
||||
@@ -239,7 +239,7 @@ desperate copy and paste the entire file into a document and search for the bug
|
||||
char (if it’s an editor like vi/vim you will have to be sure to escape the char
|
||||
since <code>*</code> is a regexp metacharacter). This has happened to me numerous times.</p></li>
|
||||
<li><p>RESOLUTION #3: If the colour contrast is not good for your eyes use the
|
||||
<a href="snake-colours">snake-colours</a> script to select a different colour scheme.</p></li>
|
||||
<a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/ferguson1/snake-colours.sh">snake-colours.sh</a> script to select a different colour scheme.</p></li>
|
||||
</ul>
|
||||
<h2 id="the-game-froze"><a name="froze" href="#toc">The game froze!</a></h2>
|
||||
<p>This should not be possible either but without certain safety checks in place I
|
||||
@@ -353,9 +353,9 @@ at least) it’s at <code>/usr/share/terminfo/6c/linux-m</code> (for macOS Ventu
|
||||
background white and the foreground black. This will of course mean you have
|
||||
no colour but unfortunately changing the background colour of curses would
|
||||
eat too many bytes in the entry (I cite the functions in the
|
||||
<a href="HACKING.html">HACKING.html</a> (<a href="HACKING.md">HACKING.md</a> on GitHub) file).</p>
|
||||
<a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/ferguson1/HACKING.html">HACKING.html</a>.</p>
|
||||
<p>I discuss colours and terminals in much more detail in
|
||||
<a href="terminals.html">terminals.html</a> (<a href="terminals.md">terminals.md</a> on GitHub).</p></li>
|
||||
<a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/ferguson1/terminals.html">terminals.html</a>.</p></li>
|
||||
</ul>
|
||||
<h2 id="the-text-is-hard-to-see-not-bright-enough"><a name="toodark" href="#toc">The text is hard to see (not bright enough)!</a></h2>
|
||||
<ul>
|
||||
@@ -419,7 +419,7 @@ example:</p>
|
||||
<p>is invalid input because octal only has digits 0 - 7: the resulting size will be
|
||||
0.</p>
|
||||
<p>I discuss the signed/unsigned issue to do with curses and sizes in C being
|
||||
unsigned in <a href="bugs.html">bugs.html</a> (<a href="bugs.md">bugs.md</a> on GitHub) but probably there isn’t
|
||||
unsigned in <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/ferguson1/bugs.html">bugs.html</a> but probably there isn’t
|
||||
anything more to say here.</p>
|
||||
<h2 id="errors-and-error-reporting"><a name="errors" href="#toc">Errors and error reporting</a></h2>
|
||||
<p>If curses fails to initialise you should get an error that says ‘curses error’
|
||||
|
||||
@@ -26,7 +26,7 @@ it as structured as possible/easiest to find.
|
||||
|
||||
Because the score line is dynamic in length depending on the terminal size it
|
||||
can happen that the score/status wraps to the next line(s). This can be fixed by
|
||||
modifying the status line (see [HACKING.html][] or on GitHub [HACKING.md][]) but
|
||||
modifying the status line (see [HACKING.html][] but
|
||||
you shouldn't need it to be very wide.
|
||||
|
||||
* RESOLUTION #0: Use a bigger screen (it doesn't take that many columns)
|
||||
@@ -48,7 +48,7 @@ you shouldn't need it to be very wide.
|
||||
#define J Z(B:%zu\n), c);
|
||||
|
||||
Recompile and try again. That will then show only the number of bugs eaten.
|
||||
See the [HACKING.html][] ([HACKING.md][] on GitHub) file for other data you
|
||||
See the [HACKING.html][] file for other data you
|
||||
can include (though there are some discrepancies here and there as you'll
|
||||
see).
|
||||
|
||||
@@ -81,7 +81,7 @@ e.g. when the snake is growing.
|
||||
it'll catch up; just give it the time it needs.
|
||||
|
||||
* BOTTOM LINE: If you want more information then see the [bugs.html][]
|
||||
([bugs.md][] on GitHub) file.
|
||||
file.
|
||||
|
||||
|
||||
## <a name="invisiblehead" href="#toc">I can't see the snake head (or other part of the snake)!</a>
|
||||
@@ -136,7 +136,7 @@ char (if it's an editor like vi/vim you will have to be sure to escape the char
|
||||
since `*` is a regexp metacharacter). This has happened to me numerous times.
|
||||
|
||||
* RESOLUTION #3: If the colour contrast is not good for your eyes use the
|
||||
[snake-colours][] script to select a different colour scheme.
|
||||
[snake-colours.sh][] script to select a different colour scheme.
|
||||
|
||||
|
||||
## <a name="froze" href="#toc">The game froze!</a>
|
||||
@@ -288,10 +288,10 @@ so that's probably why; in CentOS I did have to install it specially.
|
||||
background white and the foreground black. This will of course mean you have
|
||||
no colour but unfortunately changing the background colour of curses would
|
||||
eat too many bytes in the entry (I cite the functions in the
|
||||
[HACKING.html][] ([HACKING.md][] on GitHub) file).
|
||||
[HACKING.html][].
|
||||
|
||||
I discuss colours and terminals in much more detail in
|
||||
[terminals.html][] ([terminals.md][] on GitHub).
|
||||
[terminals.html][].
|
||||
|
||||
|
||||
## <a name="toodark" href="#toc">The text is hard to see (not bright enough)!</a>
|
||||
@@ -395,7 +395,7 @@ is invalid input because octal only has digits 0 - 7: the resulting size will be
|
||||
|
||||
|
||||
I discuss the signed/unsigned issue to do with curses and sizes in C being
|
||||
unsigned in [bugs.html][] ([bugs.md][] on GitHub) but probably there isn't
|
||||
unsigned in [bugs.html][] but probably there isn't
|
||||
anything more to say here.
|
||||
|
||||
## <a name="errors" href="#toc">Errors and error reporting</a>
|
||||
@@ -438,14 +438,11 @@ Why does it show snake size as 0 when I specified 1? It's because the max size
|
||||
is 0 and I limit the size to be no bigger than the max size.
|
||||
|
||||
|
||||
[HACKING.md]: HACKING.md
|
||||
[HACKING.html]: HACKING.html
|
||||
[prog.c]: prog.c
|
||||
[bugs.md]: bugs.md
|
||||
[bugs.html]: bugs.html
|
||||
[terminals.md]: terminals.md
|
||||
[terminals.html]: terminals.html
|
||||
[snake-colours]: snake-colours
|
||||
[HACKING.html]: %%REPO_URL%%/2020/ferguson1/HACKING.html
|
||||
[prog.c]: %%REPO_URL%%/2020/ferguson1/prog.c
|
||||
[bugs.html]: %%REPO_URL%%/2020/ferguson1/bugs.html
|
||||
[terminals.html]: %%REPO_URL%%/2020/ferguson1/terminals.html
|
||||
[snake-colours.sh]: %%REPO_URL%%/2020/ferguson1/snake-colours.sh
|
||||
[Snakey]: https://www.hp-lexicon.org/character/gaunt-family/morfin-gaunt/
|
||||
|
||||
|
||||
|
||||
+52
-21
@@ -139,7 +139,7 @@
|
||||
explore my <a href="https://www.cryptomuseum.com/crypto/enigma/index.htm">Enigma machine</a>
|
||||
<a href="prog.c">simulator</a>. I really encourage you to do this but of course you don’t
|
||||
have to if you don’t wish to.</p>
|
||||
<p><a name="toc"></a></p>
|
||||
<div id="toc">
|
||||
<ul>
|
||||
<li><a href="#recode">What is recode and why is it recommended?</a></li>
|
||||
<li><a href="#options">Options</a>
|
||||
@@ -160,9 +160,12 @@ have to if you don’t wish to.</p>
|
||||
<li><a href="#exampleuses">Example uses</a></li>
|
||||
<li><a href="#fun">A fun way to explore my Enigma machine, with a surprise</a></li>
|
||||
</ul>
|
||||
<h1 id="what-is-recode-and-why-is-it-recommended"><a name="recode" href="#toc">What is recode and why is it recommended?</a></h1>
|
||||
<p>To demonstrate how to and why you should use the <a href="recode.c">recode</a> program with
|
||||
the <a href="prog.c">Enigma machine simulator</a> I have included some examples here as
|
||||
</div>
|
||||
<div id="recode">
|
||||
<h1 id="what-is-recode-and-why-is-it-recommended"><a href="#toc">What is recode and why is it recommended?</a></h1>
|
||||
</div>
|
||||
<p>To demonstrate how to and why you should use the <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/ferguson1/recode.c">recode.c</a> program with
|
||||
the <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/ferguson1/prog.c">Enigma machine simulator</a> I have included some examples here as
|
||||
well as brief (‘brief?!’ I am sure many would think but it’s brief for me)
|
||||
commentary.</p>
|
||||
<p>It would not be possible to do all that the recode program does in my entry
|
||||
@@ -181,7 +184,7 @@ with the Roman numeral, showing their actual orders etc.), the reflectors
|
||||
(labelling them with B, C and showing the actual strings) etc.</p>
|
||||
<p>In this file I will show an example of each feature and then get to the
|
||||
wonderful ‘challenge’ for everyone.</p>
|
||||
<h1 id="options"><a name="options" href="#toc">Options</a></h1>
|
||||
<h1 id="options"><a href="#toc">Options</a></h1>
|
||||
<pre><code> ./recode -h
|
||||
usage: ./recode [options]
|
||||
-v display selected settings
|
||||
@@ -234,8 +237,10 @@ Again note that this does not validate input! Although it detects out of range
|
||||
for the arrays it doesn’t detect duplicates. This is because it wasn’t meant to
|
||||
be any given file or anything else other than the direct output of a previous
|
||||
run (thus validated). I’m not even guaranteeing that I got the array tests valid
|
||||
in <a href="recode.c">recode.c</a> <code>-R</code> option!</p>
|
||||
<h2 id="protecting-against-the-same-io-file"><a name="samefile" href="#toc">Protecting against the same I/O file</a></h2>
|
||||
in <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/ferguson1/recode.c">recode.c</a> <code>-R</code> option!</p>
|
||||
<div id="samefile">
|
||||
<h2 id="protecting-against-the-same-io-file"><a href="#toc">Protecting against the same I/O file</a></h2>
|
||||
</div>
|
||||
<p>Because some file systems are case-insensitive I have implemented a
|
||||
case-insensitive <code>strcmp()</code>; if the input file name is the same as the output file
|
||||
name I won’t write to it. From a quick test this is important particularly if
|
||||
@@ -245,17 +250,23 @@ This might be overprotective but I believe it better to prevent user error where
|
||||
possible. Of course if neither file exists it might be argued that it’s not
|
||||
necessary to worry since you can’t read from a file that doesn’t exist. But then
|
||||
what about if one exists but the other does not?</p>
|
||||
<h2 id="file-options-parser-limitation"><a name="fileoptions" href="#toc">File options parser limitation</a></h2>
|
||||
<div id="fileoptions">
|
||||
<h2 id="file-options-parser-limitation"><a href="#toc">File options parser limitation</a></h2>
|
||||
</div>
|
||||
<p>Due to the way the parsing of options is done (no spaces between option char and
|
||||
argument) shell expansion will not work right so for example doing:</p>
|
||||
<pre><code> $ ./recode -R~/config</code></pre>
|
||||
<p>will <em>not</em> read the file ‘config’ in the home directory. I show another way to
|
||||
achieve this later.</p>
|
||||
<p>This limitation also applies to the <code>-f</code> and <code>-o</code> options!</p>
|
||||
<h2 id="r-option-validation"><a name="validation" href="#toc">-R option validation?</a></h2>
|
||||
<div id="validation">
|
||||
<h2 id="r-option-validation"><a href="#toc">-R option validation?</a></h2>
|
||||
</div>
|
||||
<p>Again the <code>-R</code> option does not validate input. For validation you have to run
|
||||
the program interactively.</p>
|
||||
<h1 id="piping-commands-to-recode"><a name="pipingtorecode" href="#toc">Piping commands to recode</a></h1>
|
||||
<div id="pipingtorecode">
|
||||
<h1 id="piping-commands-to-recode"><a href="#toc">Piping commands to recode</a></h1>
|
||||
</div>
|
||||
<p>If stdin is not a tty (<code>!isatty(0)</code>) and neither randomised mode nor reading in
|
||||
from a file is specified then you might just see something like:</p>
|
||||
<pre><code> $ echo testing test tests | ./recode
|
||||
@@ -272,7 +283,9 @@ from a file is specified then you might just see something like:</p>
|
||||
<p>In other words just the defaults. This was to simplify the problems with
|
||||
prompting again for input if it’s invalid (though as you’ll see it does a good
|
||||
job at this anyway).</p>
|
||||
<h1 id="piping-recode-to-the-enigma-simulator"><a name="pipingtoenigma" href="#toc">Piping recode to the Enigma simulator</a></h1>
|
||||
<div id="pipingtoenigma">
|
||||
<h1 id="piping-recode-to-the-enigma-simulator"><a href="#toc">Piping recode to the Enigma simulator</a></h1>
|
||||
</div>
|
||||
<p>If you’re using recode to recode the input so you don’t have to type in the
|
||||
input manually (if you randomise or read in from previously saved file no input
|
||||
need be done at all) then make sure to redirect stderr to /dev/null. If you
|
||||
@@ -285,7 +298,9 @@ redirected to <code>/dev/null</code> it prints this out; at this point however i
|
||||
input. Why or how it shows the first prompt instead of later on I do not know.
|
||||
Anyway at this point the simulator is already expecting input to en/decipher.
|
||||
That’s why after I sent EOF it printed out the remaining strings to stderr.</p>
|
||||
<h1 id="manually-test-the-recode-program-with-the-enigma-program"><a name="manuallytest" href="#toc">Manually test the recode program with the Enigma program</a></h1>
|
||||
<div id="manuallytest">
|
||||
<h1 id="manually-test-the-recode-program-with-the-enigma-program"><a href="#toc">Manually test the recode program with the Enigma program</a></h1>
|
||||
</div>
|
||||
<pre><code> $ cat input
|
||||
IOCCC
|
||||
|
||||
@@ -347,7 +362,9 @@ the same output:</p>
|
||||
<p>Also if you flip the order of the letters in the pair e.g. the AB as BA instead:</p>
|
||||
<pre><code> $ echo 1AA2AA3AA2BA..CDEFGHIJKLMNOPQRIOCCC|./prog - 2>/dev/null
|
||||
HQNVO</code></pre>
|
||||
<h1 id="only-write-config-file"><a name="onlyconfig" href="#toc">Only write config file</a></h1>
|
||||
<div id="onlyconfig">
|
||||
<h1 id="only-write-config-file"><a href="#toc">Only write config file</a></h1>
|
||||
</div>
|
||||
<pre><code> $ ./recode -v -oconfig -finput >/dev/null
|
||||
Rotors:
|
||||
(1) I: EKMFLGDQVZNTOWYHXUSPAIBRCJ
|
||||
@@ -425,7 +442,9 @@ first one will print a newline with the echo but that won’t matter):</p>
|
||||
the buffer remains <code>NULL</code> and so I don’t print it but still do print the settings
|
||||
file. (Actually even if <code>getdelim()</code> fails you’re supposed to free the buffer so I
|
||||
set another variable to indicate if it should be printed.)</p>
|
||||
<h1 id="reusing-a-configuration"><a name="reuseconfig" href="#toc">Reusing a configuration</a></h1>
|
||||
<div id="reuseconfig">
|
||||
<h1 id="reusing-a-configuration"><a href="#toc">Reusing a configuration</a></h1>
|
||||
</div>
|
||||
<pre><code> $ echo -n|./recode -r -oconfig
|
||||
4UH5II1RJ1SPIFEJLYGZWRTBHVCAMN$
|
||||
|
||||
@@ -450,7 +469,9 @@ set another variable to indicate if it should be printed.)</p>
|
||||
<pre><code> $ ./recode -finput.txt -Rconfig | ./prog - 2>/dev/null > output2
|
||||
$ diff output output2
|
||||
$</code></pre>
|
||||
<h1 id="write-config-file-read-data-file-and-pass-to-enigma-simulator"><a name="passtoenigma" href="#toc">Write config file, read data file and pass to Enigma simulator</a></h1>
|
||||
<div id="passtoenigma">
|
||||
<h1 id="write-config-file-read-data-file-and-pass-to-enigma-simulator"><a href="#toc">Write config file, read data file and pass to Enigma simulator</a></h1>
|
||||
</div>
|
||||
<pre><code> $ ./recode -finput.txt -oconfig | ./prog - 2>/dev/null > output
|
||||
Rotors:
|
||||
(1) I: EKMFLGDQVZNTOWYHXUSPAIBRCJ
|
||||
@@ -501,7 +522,9 @@ does is the output:</p>
|
||||
This is a sentence.
|
||||
|
||||
This is another sentence.</code></pre>
|
||||
<h1 id="piping-directly-to-the-enigma-code-once-with-randomised-settings-saved"><a name="directlytoenigma" href="#toc">Piping directly to the Enigma code once (with randomised settings, saved)</a></h1>
|
||||
<div id="directlytoenigma">
|
||||
<h1 id="piping-directly-to-the-enigma-code-once-with-randomised-settings-saved"><a href="#toc">Piping directly to the Enigma code once (with randomised settings, saved)</a></h1>
|
||||
</div>
|
||||
<p>This is like the above only randomised:</p>
|
||||
<pre><code> $ ./recode -r -oconfig|./prog - 2>/dev/null
|
||||
IOCCC
|
||||
@@ -519,17 +542,23 @@ okay:</p>
|
||||
actual pasting to demonstrate:</p>
|
||||
<pre><code> $ echo IOCCC | ./recode -R$(cat config) | ./prog - 2>/dev/null | ./recode -R2BM4GJ3HK1LNCBXWRMGKSYIAZUTPVJ | ./prog - 2>/dev/null
|
||||
IOCCC</code></pre>
|
||||
<h1 id="usage-conclusion"><a name="conclusion" href="#toc">Usage conclusion</a></h1>
|
||||
<div id="conclusion">
|
||||
<h1 id="usage-conclusion"><a href="#toc">Usage conclusion</a></h1>
|
||||
</div>
|
||||
<p>That should give you an idea of how to use the <code>recode</code> program. I leave it as
|
||||
an exercise to the reader to implement additional features but here are some
|
||||
ideas of what could be done and how this entry might be used (including that
|
||||
delicious challenge).</p>
|
||||
<h1 id="example-additions"><a name="additions" href="#toc">Example additions</a></h1>
|
||||
<div id="additions">
|
||||
<h1 id="example-additions"><a href="#toc">Example additions</a></h1>
|
||||
</div>
|
||||
<ul>
|
||||
<li>Add code (to <a href="prog.c">prog.c</a>) that tries to determine possible decipherments based on
|
||||
<li>Add code (to <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/ferguson1/prog.c">prog.c</a>) that tries to determine possible decipherments based on
|
||||
a given crib (or set of cribs).</li>
|
||||
</ul>
|
||||
<h1 id="example-uses"><a name="exampleuses" href="#toc">Example uses</a></h1>
|
||||
<div id="exampleuses">
|
||||
<h1 id="example-uses"><a href="#toc">Example uses</a></h1>
|
||||
</div>
|
||||
<ul>
|
||||
<li><p>Take an actual key sheet and message for that day and try and decipher the
|
||||
message (might help if you know German!). I haven’t actually done this for
|
||||
@@ -545,7 +574,9 @@ watching dry paint stay dry on a wall but why not poke fun at politicians
|
||||
anyway?</p></li>
|
||||
<li><p>Best idea: try the below experiment!</p></li>
|
||||
</ul>
|
||||
<h1 id="a-fun-way-to-explore-my-enigma-machine-with-a-surprise"><a name="fun" href="#toc">A fun way to explore my Enigma machine, with a surprise</a></h1>
|
||||
<div id="fun">
|
||||
<h1 id="a-fun-way-to-explore-my-enigma-machine-with-a-surprise"><a href="#toc">A fun way to explore my Enigma machine, with a surprise</a></h1>
|
||||
</div>
|
||||
<p>As I was making the above silly list something occurred to me. My <a href="https://www.ioccc.org/2020/ferguson1/index.html">other
|
||||
entry</a> this year includes a
|
||||
<a href="https://www.ioccc.org/2020/ferguson1/chocolate-cake.html">recipe for a wonderful double-layered chocolate fudge
|
||||
|
||||
+59
-23
@@ -6,8 +6,7 @@ explore my [Enigma machine](https://www.cryptomuseum.com/crypto/enigma/index.htm
|
||||
have to if you don't wish to.
|
||||
|
||||
|
||||
<a name="toc"></a>
|
||||
|
||||
<div id="toc">
|
||||
- [What is recode and why is it recommended?](#recode)
|
||||
- [Options](#options)
|
||||
* [Protecting against the same I/O file](#samefile)
|
||||
@@ -24,12 +23,15 @@ have to if you don't wish to.
|
||||
- [Example additions](#additions)
|
||||
- [Example uses](#exampleuses)
|
||||
- [A fun way to explore my Enigma machine, with a surprise](#fun)
|
||||
</div>
|
||||
|
||||
|
||||
# <a name="recode" href="#toc">What is recode and why is it recommended?</a>
|
||||
<div id="recode">
|
||||
# <a href="#toc">What is recode and why is it recommended?</a>
|
||||
</div>
|
||||
|
||||
To demonstrate how to and why you should use the [recode](recode.c) program with
|
||||
the [Enigma machine simulator](prog.c) I have included some examples here as
|
||||
To demonstrate how to and why you should use the [recode.c](%%REPO_URL%%/2020/ferguson1/recode.c) program with
|
||||
the [Enigma machine simulator](%%REPO_URL%%/2020/ferguson1/prog.c) I have included some examples here as
|
||||
well as brief ('brief?!' I am sure many would think but it's brief for me)
|
||||
commentary.
|
||||
|
||||
@@ -53,7 +55,10 @@ with the Roman numeral, showing their actual orders etc.), the reflectors
|
||||
In this file I will show an example of each feature and then get to the
|
||||
wonderful 'challenge' for everyone.
|
||||
|
||||
# <a name="options" href="#toc">Options</a>
|
||||
|
||||
<div id="options">
|
||||
# <a href="#toc">Options</a>
|
||||
</div>
|
||||
|
||||
``` <!---sh-->
|
||||
./recode -h
|
||||
@@ -123,10 +128,12 @@ Again note that this does not validate input! Although it detects out of range
|
||||
for the arrays it doesn't detect duplicates. This is because it wasn't meant to
|
||||
be any given file or anything else other than the direct output of a previous
|
||||
run (thus validated). I'm not even guaranteeing that I got the array tests valid
|
||||
in [recode.c](recode.c) `-R` option!
|
||||
in [recode.c](%%REPO_URL%%/2020/ferguson1/recode.c) `-R` option!
|
||||
|
||||
|
||||
## <a name="samefile" href="#toc">Protecting against the same I/O file</a>
|
||||
<div id="samefile">
|
||||
## <a href="#toc">Protecting against the same I/O file</a>
|
||||
</div>
|
||||
|
||||
Because some file systems are case-insensitive I have implemented a
|
||||
case-insensitive `strcmp()`; if the input file name is the same as the output file
|
||||
@@ -138,7 +145,10 @@ possible. Of course if neither file exists it might be argued that it's not
|
||||
necessary to worry since you can't read from a file that doesn't exist. But then
|
||||
what about if one exists but the other does not?
|
||||
|
||||
## <a name="fileoptions" href="#toc">File options parser limitation</a>
|
||||
|
||||
<div id="fileoptions">
|
||||
## <a href="#toc">File options parser limitation</a>
|
||||
</div>
|
||||
|
||||
Due to the way the parsing of options is done (no spaces between option char and
|
||||
argument) shell expansion will not work right so for example doing:
|
||||
@@ -153,12 +163,17 @@ achieve this later.
|
||||
This limitation also applies to the `-f` and `-o` options!
|
||||
|
||||
|
||||
## <a name="validation" href="#toc">-R option validation?</a>
|
||||
<div id="validation">
|
||||
## <a href="#toc">-R option validation?</a>
|
||||
</div>
|
||||
|
||||
Again the `-R` option does not validate input. For validation you have to run
|
||||
the program interactively.
|
||||
|
||||
# <a name="pipingtorecode" href="#toc">Piping commands to recode</a>
|
||||
|
||||
<div id="pipingtorecode">
|
||||
# <a href="#toc">Piping commands to recode</a>
|
||||
</div>
|
||||
|
||||
If stdin is not a tty (`!isatty(0)`) and neither randomised mode nor reading in
|
||||
from a file is specified then you might just see something like:
|
||||
@@ -182,7 +197,9 @@ prompting again for input if it's invalid (though as you'll see it does a good
|
||||
job at this anyway).
|
||||
|
||||
|
||||
# <a name="pipingtoenigma" href="#toc">Piping recode to the Enigma simulator</a>
|
||||
<div id="pipingtoenigma">
|
||||
# <a href="#toc">Piping recode to the Enigma simulator</a>
|
||||
</div>
|
||||
|
||||
If you're using recode to recode the input so you don't have to type in the
|
||||
input manually (if you randomise or read in from previously saved file no input
|
||||
@@ -202,8 +219,9 @@ Anyway at this point the simulator is already expecting input to en/decipher.
|
||||
That's why after I sent EOF it printed out the remaining strings to stderr.
|
||||
|
||||
|
||||
|
||||
# <a name="manuallytest" href="#toc">Manually test the recode program with the Enigma program</a>
|
||||
<div id="manuallytest">
|
||||
# <a href="#toc">Manually test the recode program with the Enigma program</a>
|
||||
</div>
|
||||
|
||||
``` <!---sh-->
|
||||
$ cat input
|
||||
@@ -285,7 +303,9 @@ Also if you flip the order of the letters in the pair e.g. the AB as BA instead:
|
||||
HQNVO
|
||||
```
|
||||
|
||||
# <a name="onlyconfig" href="#toc">Only write config file</a>
|
||||
<div id="onlyconfig">
|
||||
# <a href="#toc">Only write config file</a>
|
||||
</div>
|
||||
|
||||
``` <!---sh-->
|
||||
$ ./recode -v -oconfig -finput >/dev/null
|
||||
@@ -378,7 +398,9 @@ the buffer remains `NULL` and so I don't print it but still do print the setting
|
||||
file. (Actually even if `getdelim()` fails you're supposed to free the buffer so I
|
||||
set another variable to indicate if it should be printed.)
|
||||
|
||||
# <a name="reuseconfig" href="#toc">Reusing a configuration</a>
|
||||
<div id="reuseconfig">
|
||||
# <a href="#toc">Reusing a configuration</a>
|
||||
</div>
|
||||
|
||||
``` <!---sh-->
|
||||
$ echo -n|./recode -r -oconfig
|
||||
@@ -412,7 +434,9 @@ Alternatively you can just use the `-R` and `-f` options:
|
||||
```
|
||||
|
||||
|
||||
# <a name="passtoenigma" href="#toc">Write config file, read data file and pass to Enigma simulator</a>
|
||||
<div id="passtoenigma">
|
||||
# <a href="#toc">Write config file, read data file and pass to Enigma simulator</a>
|
||||
</div>
|
||||
|
||||
```
|
||||
$ ./recode -finput.txt -oconfig | ./prog - 2>/dev/null > output
|
||||
@@ -473,7 +497,9 @@ does is the output:
|
||||
```
|
||||
|
||||
|
||||
# <a name="directlytoenigma" href="#toc">Piping directly to the Enigma code once (with randomised settings, saved)</a>
|
||||
<div id="directlytoenigma">
|
||||
# <a href="#toc">Piping directly to the Enigma code once (with randomised settings, saved)</a>
|
||||
</div>
|
||||
|
||||
This is like the above only randomised:
|
||||
|
||||
@@ -510,19 +536,27 @@ actual pasting to demonstrate:
|
||||
```
|
||||
|
||||
|
||||
# <a name="conclusion" href="#toc">Usage conclusion</a>
|
||||
<div id="conclusion">
|
||||
# <a href="#toc">Usage conclusion</a>
|
||||
</div>
|
||||
|
||||
That should give you an idea of how to use the `recode` program. I leave it as
|
||||
an exercise to the reader to implement additional features but here are some
|
||||
ideas of what could be done and how this entry might be used (including that
|
||||
delicious challenge).
|
||||
|
||||
# <a name="additions" href="#toc">Example additions</a>
|
||||
|
||||
* Add code (to [prog.c](prog.c)) that tries to determine possible decipherments based on
|
||||
<div id="additions">
|
||||
# <a href="#toc">Example additions</a>
|
||||
</div>
|
||||
|
||||
* Add code (to [prog.c](%%REPO_URL%%/2020/ferguson1/prog.c)) that tries to determine possible decipherments based on
|
||||
a given crib (or set of cribs).
|
||||
|
||||
# <a name="exampleuses" href="#toc">Example uses</a>
|
||||
|
||||
<div id="exampleuses">
|
||||
# <a href="#toc">Example uses</a>
|
||||
</div>
|
||||
|
||||
* Take an actual key sheet and message for that day and try and decipher the
|
||||
message (might help if you know German!). I haven't actually done this for
|
||||
@@ -541,7 +575,9 @@ anyway?
|
||||
* Best idea: try the below experiment!
|
||||
|
||||
|
||||
# <a name="fun" href="#toc">A fun way to explore my Enigma machine, with a surprise</a>
|
||||
<div id="fun">
|
||||
# <a href="#toc">A fun way to explore my Enigma machine, with a surprise</a>
|
||||
</div>
|
||||
|
||||
As I was making the above silly list something occurred to me. My [other
|
||||
entry](https://www.ioccc.org/2020/ferguson1/index.html) this year includes a
|
||||
|
||||
Reference in new issue
Block a user