add rules, guidelines, fix HTML code, move compressed tarball in inventory
By changing the _inventory_order_ of the compressed tarball from
**100000** to **1415926535**, the compressed tarball will land at
the top of the secondary file list and remain still easy to find.
Updated the `manifest.numbers` spreadsheet and rebuilt
the `.entry.json` files.
Added `next/` directory to hold the next IOCCC rules and guidelines.
Added `next/README.md` that `bin/gen-top-html.sh` uses to form
the `next/index.html` file.
Added _Rules and Guidelines_ link to the sidenav bar to link to the
`next/index.html` file.
Added _IOCCC Rules_ as `next/rules.md` that `bin/gen-top-html.sh`
uses to form the `next/rules.html` file.
Added _IOCCC Guidelines_ as `next/guidelines.md` that `bin/gen-top-html.sh`
uses to form the `next/guidelines.html` file.
Changed `bin/gen-top-html.sh` VERSION from "1.2.4 2024-04-13"
to "1.3 2024-04-14".
Prevent `pandoc(1)` from interpreting the commented out language
of a markdown code block as a code class. So a markdown such as:
````
``` <!---sh-->
...
```
````
that produced HTML of the form:
```html
<pre class="<!---sh-->"><code>...</code></pre>
```
will now produce HTML of the form:
```html
<pre><code>...</code></pre>
```
NOTE: Before when the language of a markdown code block
was not commented, the HTML produced by `pandoc(1)` was
oddly indented with extra whitespace on the first line
of the code block. While commenting out the language
of the code block removed some of the odd intending,
it left a weird class in the HTML pre block that
surrounded the HTML code block. This hack prevents
`pandoc(1)` from assigning a class to the HTML pre block.
Changed `in/md2html.sh` VERSION from "1.2.1 2024-04-13"
to "1.3 2024-04-14".
Added `make gen_sitemap` to end of both `make www` and `make
quick_www` in top level Makefile.
Ram `make www` to test under macOS and to perform the above.
**IMPORTANT NOTE**: The current `next/rules.md` and `next/guidelines.md`
are simply the 2020 IOCCC Rules and Guidelines converted into
markdown form. There are **NOT** the Rules and Guidelines that
will be used the IOCCC MOCK, nor the next IOCCC.
TODO: Improve the `bin/gen-status.sh` tool to modify the top of the
`next/rules.md` and `next/guidelines.md` files to keep them
in sync with the _contest_status_ as found in `status.json`.
TODO: Improve the look and feel of the `next/rules.md` and
`next/guidelines.md` markdown files.
This commit is contained in:
1 parent
a672335d2d
commit
518a6336d0
734 files changed
+7919
-4119
No files matched your search
@@ -147,7 +147,7 @@
|
||||
},
|
||||
{
|
||||
"file_path" : "2020_ferguson2.tar.bz2",
|
||||
"inventory_order" : 100000,
|
||||
"inventory_order" : 1415926535,
|
||||
"OK_to_edit" : false,
|
||||
"display_as" : "tbz2",
|
||||
"display_via_github" : false,
|
||||
|
||||
+26
-25
@@ -88,6 +88,7 @@
|
||||
<div class="sidenav">
|
||||
<a href="../../news.html">IOCCC News</a>
|
||||
<a href="../../status.html">Contest status</a>
|
||||
<a href="../../next/index.html">Rules and Guidelines</a>
|
||||
<a href="../../faq.html#submit">How to enter the IOCCC</a>
|
||||
<a href="../../faq.html">FAQ</a>
|
||||
</div>
|
||||
@@ -141,12 +142,12 @@ Location: <a href="../../location.html#US">US</a> - <em>United States of America
|
||||
<!-- START: this line starts content for HTML phase 21 by: bin/pandoc-wrapper.sh via bin/md2html.sh -->
|
||||
|
||||
<h2 id="to-build">To build:</h2>
|
||||
<pre class="<!---sh-->"><code> make</code></pre>
|
||||
<pre><code> make</code></pre>
|
||||
<p>The author provided alternate code that prints the output one character at a
|
||||
time to make it a bit more like the real thing in that it isn’t dumped out all
|
||||
at once. See <a href="#alternate-code">Alternate code</a> below.</p>
|
||||
<h2 id="to-use">To use:</h2>
|
||||
<pre class="<!---sh-->"><code> ./prog
|
||||
<pre><code> ./prog
|
||||
|
||||
# get recode help:
|
||||
./recode -h
|
||||
@@ -178,9 +179,9 @@ at once. See <a href="#alternate-code">Alternate code</a> below.</p>
|
||||
<p><strong>NOTE</strong>: in <a href="recode.c">recode</a> no spaces between options and option arguments
|
||||
are allowed.</p>
|
||||
<h2 id="try">Try:</h2>
|
||||
<pre class="<!---sh-->"><code> ./try.sh</code></pre>
|
||||
<pre><code> ./try.sh</code></pre>
|
||||
<p>What does:</p>
|
||||
<pre class="<!---sh-->"><code> echo | ./recode
|
||||
<pre><code> echo | ./recode
|
||||
echo | ./recode -v</code></pre>
|
||||
<p>do?</p>
|
||||
<h2 id="alternate-code">Alternate code:</h2>
|
||||
@@ -188,15 +189,15 @@ are allowed.</p>
|
||||
after each character, so that one can read it more easily (for longer output)
|
||||
and to make it a bit more like the real thing.</p>
|
||||
<h3 id="alternate-build">Alternate build:</h3>
|
||||
<pre class="<!---sh-->"><code> make alt</code></pre>
|
||||
<pre><code> make alt</code></pre>
|
||||
<p>The default time to sleep is 400000 microseconds but you can change this by
|
||||
doing:</p>
|
||||
<pre class="<!---sh-->"><code> make clobber SLEEP=600000 alt</code></pre>
|
||||
<pre><code> make clobber SLEEP=600000 alt</code></pre>
|
||||
<p>to change it to 600000 microseconds. It guards against negative numbers.</p>
|
||||
<h3 id="alternate-use">Alternate use:</h3>
|
||||
<p>Use <code>prog.alt</code> as you would <code>prog</code> above.</p>
|
||||
<h3 id="alternate-try">Alternate try:</h3>
|
||||
<pre class="<!---sh-->"><code> ./try.alt.sh</code></pre>
|
||||
<pre><code> ./try.alt.sh</code></pre>
|
||||
<p>Notice how only the last part should use the <code>prog.alt</code>. Why? Try it and find
|
||||
out! Can you figure out why this works this way?</p>
|
||||
<h2 id="judges-remarks">Judges’ remarks:</h2>
|
||||
@@ -205,7 +206,7 @@ out! Can you figure out why this works this way?</p>
|
||||
<ul>
|
||||
<li><a href="enigma.1">enigma.1</a> - A useful man page for this entry. To render, try:</li>
|
||||
</ul>
|
||||
<pre class="<!---sh-->"><code> man ./enigma.1</code></pre>
|
||||
<pre><code> man ./enigma.1</code></pre>
|
||||
<ul>
|
||||
<li><a href="recode.html">recode.html</a> (or <a href="recode.html">recode.html</a> if reading on GitHub)
|
||||
<ul>
|
||||
@@ -317,7 +318,7 @@ leave this in for historical purposes.</p>
|
||||
for input (end with EOF). At that point it’ll process the input string and print
|
||||
the result (after finishing the enciphering).</p>
|
||||
<p>If you run it like:</p>
|
||||
<pre class="<!---sh-->"><code> ./prog -</code></pre>
|
||||
<pre><code> ./prog -</code></pre>
|
||||
<p>It will prompt you for the settings of the machine (example below).</p>
|
||||
<p>The first group is in the order of
|
||||
<a href="https://www.ciphermachinesandcryptology.com/en/enigmatech.htm">rotor</a> (number),
|
||||
@@ -338,7 +339,7 @@ on GitHub see <a href="chocolate-cake.html">here</a>) though one might need a di
|
||||
of exercise after taking up the challenge! :-) These however show the general
|
||||
program as well as how to use the two winning entries of the <a href="https://en.wikipedia.org/wiki/Morse_code">Morse
|
||||
code</a> that I referred to earlier:</p>
|
||||
<pre class="<!---sh-->"><code> $ ./prog -
|
||||
<pre><code> $ ./prog -
|
||||
Ring 1: 3
|
||||
Setting 1: I
|
||||
Position 1: O
|
||||
@@ -366,39 +367,39 @@ code</a> that I referred to earlier:</p>
|
||||
<p>If I didn’t specify the <code>-</code> by e.g. <code>echo IOCCC | ./prog</code> then it will use the
|
||||
default settings; as the judges suggest this invocation I will not show it here.</p>
|
||||
<p>But you can also type it out like this:</p>
|
||||
<pre class="<!---sh-->"><code> $ ./prog
|
||||
<pre><code> $ ./prog
|
||||
IOCCC
|
||||
UUMMX</code></pre>
|
||||
<p>The IOCCC comes from stdin; the <code>UUMMX</code> is written to stdout.</p>
|
||||
<p>If I compile the 2014 entry and copy it to my local directory as
|
||||
<code>vik</code> I might do:</p>
|
||||
<pre class="<!---sh-->"><code> $ echo TEST|./prog |./vik | mplayer -demuxer rawaudio -</code></pre>
|
||||
<pre><code> $ echo TEST|./prog |./vik | mplayer -demuxer rawaudio -</code></pre>
|
||||
<p>And you would hear <a href="https://en.wikipedia.org/wiki/Morse_code">Morse code</a> of the
|
||||
<a href="https://www.ciphermachinesandcryptology.com/en/enigmatech.htm">Enigma</a> output
|
||||
of ‘TEST’ (i.e. <code>KCWV</code>)! Or perhaps not in this case. I’m not sure: I discovered
|
||||
a bug in that entry (Fedora, CentOS and macOS all affected).</p>
|
||||
<p>For example I can use the syntax provided in the winning remarks along with my
|
||||
entry to write it to a file. Say:</p>
|
||||
<pre class="<!---sh-->"><code> $ echo TEST|./prog |./vik > test.raw
|
||||
<pre><code> $ echo TEST|./prog |./vik > test.raw
|
||||
$ ./vik e < test.raw | ./prog
|
||||
LEST</code></pre>
|
||||
<p>Why did that happen? This shows more details:</p>
|
||||
<pre class="<!---sh-->"><code> $ ./vik e < test.raw
|
||||
<pre><code> $ ./vik e < test.raw
|
||||
SCWV</code></pre>
|
||||
<p>However as can be seen the first char is wrong:</p>
|
||||
<pre class="<!---sh-->"><code> $ echo TEST|./prog
|
||||
<pre><code> $ echo TEST|./prog
|
||||
KCWV</code></pre>
|
||||
<p>And piping the original output to my entry itself you get the original input:</p>
|
||||
<pre class="<!---sh-->"><code> $ echo TEST | ./prog | ./prog
|
||||
<pre><code> $ echo TEST | ./prog | ./prog
|
||||
TEST</code></pre>
|
||||
<p>I’m not sure what causes that or if there’s a way to fix it but that’s the
|
||||
idea anyway. Neither do I know if the original transcoding is correct.</p>
|
||||
<p>What if I use the input string <code>LEST</code> instead? In that case it worked fine:</p>
|
||||
<pre class="<!---sh-->"><code> $ echo LEST | ./prog | ./vik > lest.raw
|
||||
<pre><code> $ echo LEST | ./prog | ./vik > lest.raw
|
||||
$ ./vik e < lest.raw | ./prog
|
||||
LEST</code></pre>
|
||||
<p>But there’s one obvious question, right? Let’s try the most important one:</p>
|
||||
<pre class="<!---sh-->"><code> $ echo IOCCC | ./prog | ./vik > ioccc.raw
|
||||
<pre><code> $ echo IOCCC | ./prog | ./vik > ioccc.raw
|
||||
$ ./vik e < ioccc.raw
|
||||
UUMMX
|
||||
$ ./vik e < ioccc.raw | ./prog
|
||||
@@ -408,7 +409,7 @@ idea anyway. Neither do I know if the original transcoding is correct.</p>
|
||||
is with some of the things I pasted in the other file and maybe others here
|
||||
too. Notice also how it showed the same output that my program gave it - <code>UUMMX</code>.)</p>
|
||||
<p>What about the other <a href="../../1998/dorssel/dorssel.c">Morse code entry</a>?</p>
|
||||
<pre class="<!---sh-->"><code> $ echo IOCCC | ./prog | ./dorssel
|
||||
<pre><code> $ echo IOCCC | ./prog | ./dorssel
|
||||
..- ..- -- -- -..-</code></pre>
|
||||
<h3 id="the-recode.c-configurator"><a name="recode" href="#toc">The recode.c configurator</a></h3>
|
||||
<p>I have included a supplementary program <a href="recode.c">recode.c</a> that can do a number of
|
||||
@@ -440,7 +441,7 @@ make it more flexible by a wrapper program.</p>
|
||||
<p>The parser is in a sense rather rudimentary but allows for both interactive and
|
||||
automatic (e.g. via the <a href="recode.c">recode</a> program) input. This does mean that
|
||||
something like the following can happen:</p>
|
||||
<pre class="<!---sh-->"><code> $ ./prog -
|
||||
<pre><code> $ ./prog -
|
||||
Ring 1: 1AB
|
||||
Setting 1: Position 1: Ring 2: 2CD
|
||||
Setting 2: Position 2: Ring 3: 3
|
||||
@@ -493,7 +494,7 @@ GitHub).</p>
|
||||
should help you remember (though not at this time in our world it might help you
|
||||
later on?). This might become even more useful after the challenge is accepted,
|
||||
accomplished and made use of! :)</p>
|
||||
<pre class="<!---sh-->"><code> $ echo ABC | ./prog
|
||||
<pre><code> $ echo ABC | ./prog
|
||||
GYM
|
||||
$ echo ABC | ./prog | ./prog
|
||||
ABC</code></pre>
|
||||
@@ -516,7 +517,7 @@ which was exactly 75 years from the day that the person responsible for the
|
||||
<a href="https://en.wikipedia.org/wiki/World_War_II">Second World War</a>, Adolf Hitler,
|
||||
ended his life. (I later made a bug fix but I consider this inconsequential).</p>
|
||||
<p>As for <a href="recode.c">recode.c</a> though I really love this:</p>
|
||||
<pre class="<!---c-->"><code> /\
|
||||
<pre><code> /\
|
||||
/ This is *not* what you think:</code></pre>
|
||||
<p>…because it seems so wrong in C code at first glance. Also what does the
|
||||
‘this’ refer to?</p>
|
||||
@@ -524,9 +525,9 @@ ended his life. (I later made a bug fix but I consider this inconsequential).</p
|
||||
<p>It’s an <a href="https://en.wikipedia.org/wiki/Enigma_machine">Enigma machine</a> simulator! Isn’t
|
||||
that proof that it’s obfuscated itself?! :) Silliness aside <a href="obfuscation.txt">obfuscation.txt</a>
|
||||
has some of the ways I think this entry is obfuscated. To decipher try:</p>
|
||||
<pre class="<!---sh-->"><code> ./recode -Robfuscation.key -fobfuscation.txt | ./prog - 2>/dev/null > obfuscation.md</code></pre>
|
||||
<pre><code> ./recode -Robfuscation.key -fobfuscation.txt | ./prog - 2>/dev/null > obfuscation.md</code></pre>
|
||||
<p>To encipher:</p>
|
||||
<pre class="<!---sh-->"><code> ./recode -Robfuscation.key -fobfuscation.md | ./prog - 2>/dev/null > obfuscation.txt</code></pre>
|
||||
<pre><code> ./recode -Robfuscation.key -fobfuscation.md | ./prog - 2>/dev/null > obfuscation.txt</code></pre>
|
||||
<p>The file <a href="obfuscation.key">obfuscation.key</a> is the key to decipher/encipher
|
||||
<a href="obfuscation.txt">obfuscation.txt</a>.</p>
|
||||
<p>For the lazy <a href="obfuscation.html">obfuscation.html</a> has the deciphered version. I am afraid I’m not
|
||||
@@ -832,10 +833,10 @@ email but I’m more likely to respond to mastodon messages.</p>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/ferguson2/key.txt">key.txt</a> - key to decipher or encipher IOCCC</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/ferguson2/obfuscation.key">obfuscation.key</a> - key to decipher or encipher obfuscation.txt</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/ferguson2/recode.1">recode.1</a> - configuration tool man page</li>
|
||||
<li><a href="2020_ferguson2.tar.bz2">2020_ferguson2.tar.bz2</a> - download entry tarball</li>
|
||||
</ul>
|
||||
<h2 id="secondary-files">Secondary files</h2>
|
||||
<ul>
|
||||
<li><a href="2020_ferguson2.tar.bz2">2020_ferguson2.tar.bz2</a> - download entry tarball</li>
|
||||
<li><a href="index.html">index.html</a> - this web page</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/ferguson2/README.md">README.md</a> - markdown source for this web page</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2020/ferguson2/.entry.json">.entry.json</a> - description of entry in JSON</li>
|
||||
|
||||
@@ -83,6 +83,7 @@
|
||||
<div class="sidenav">
|
||||
<a href="../../news.html">IOCCC News</a>
|
||||
<a href="../../status.html">Contest status</a>
|
||||
<a href="../../next/index.html">Rules and Guidelines</a>
|
||||
<a href="../../faq.html#submit">How to enter the IOCCC</a>
|
||||
<a href="../../faq.html">FAQ</a>
|
||||
</div>
|
||||
@@ -140,9 +141,9 @@ there is an aesthetic appeal to my eyes too).</p></li>
|
||||
Y<:19:><:27:> but it’s not the only example. Here the compound literal of 13
|
||||
ints:</p></li>
|
||||
</ul>
|
||||
<pre class="<!---c-->"><code> int *z=(int[13]) { 0 } , *e, *g;</code></pre>
|
||||
<pre><code> int *z=(int[13]) { 0 } , *e, *g;</code></pre>
|
||||
<p>Then in main:</p>
|
||||
<pre class="<!---c-->"><code> e = z + 10;
|
||||
<pre><code> e = z + 10;
|
||||
g = e + 1;
|
||||
|
||||
for (j=-3; j < 0; ++j)
|
||||
@@ -152,12 +153,12 @@ expect to start out with index < 0 but to then compare that that index < 0
|
||||
and increment until 0 along with setting the value of the array to j + 3 is
|
||||
more confusing still. There are at least two other ways that are much easier
|
||||
to read that could accomplish the same thing. It continues on:</p>
|
||||
<pre class="<!---c-->"><code> /* ... */
|
||||
<pre><code> /* ... */
|
||||
e<:i-3:> = (j < 1 ? 1 : (j > 5 ? 5 : j))-1;</code></pre>
|
||||
<ul>
|
||||
<li>Observe these two functions:</li>
|
||||
</ul>
|
||||
<pre class="<!---c-->"><code> void w(char *s, int k, int v)
|
||||
<pre><code> void w(char *s, int k, int v)
|
||||
{
|
||||
for(e<:2:> = 0; s<:*P:>; ++e<:2:>)
|
||||
{
|
||||
@@ -200,7 +201,7 @@ temporary variable instead of a regular int in the function (so make it global);
|
||||
and (2) I didn’t want to risk changing all the offsets: thus I just made that
|
||||
address <code>e[1]</code>. Thus I also have:</li>
|
||||
</ul>
|
||||
<pre class="<!---c-->"><code> for (*g = 0 ; *g < 10; ++*g)
|
||||
<pre><code> for (*g = 0 ; *g < 10; ++*g)
|
||||
{
|
||||
r<:-2:> = Y<:14:><:*(e+1):>; r<:-3:> = Y<:15:><:1<:e:>:>;
|
||||
if (r<:-3:> && r<:-2:> == r<:-1:>)
|
||||
@@ -218,7 +219,7 @@ which I use as the two chars to compare (this is the plugboard function).</p>
|
||||
<li>The above function Z() takes a <code>char x</code> but you won’t notice it being used
|
||||
at all. Why? In fact I call it like so:</li>
|
||||
</ul>
|
||||
<pre class="<!---c-->"><code> k = Z(r<:-1:>=k);</code></pre>
|
||||
<pre><code> k = Z(r<:-1:>=k);</code></pre>
|
||||
<p>The char is just used as a way to be able to call the function and assign to
|
||||
the proper variable at the same time: in the function Z I don’t care about x
|
||||
because it’s the same value as r[-1] (which I do care about). Why is it
|
||||
@@ -230,7 +231,7 @@ again negative offsets to cause more confusion.</p>
|
||||
refer to the same variable in more than one way (or in some cases maybe more
|
||||
correct to say ‘same location’). In the Z() function for example:</li>
|
||||
</ul>
|
||||
<pre class="<!---c-->"><code> r<:-2:> = Y<:14:><:*(e+1):>; r<:-3:> = Y<:15:><:1<:e:>:>;</code></pre>
|
||||
<pre><code> r<:-2:> = Y<:14:><:*(e+1):>; r<:-3:> = Y<:15:><:1<:e:>:>;</code></pre>
|
||||
<p>I refer to e[1] as both: *(e+1) and 1[e].</p>
|
||||
<ul>
|
||||
<li><p>Replacing a number of <code>if ..</code>s with <code>... && (...)</code>s (in one case at least
|
||||
@@ -245,7 +246,7 @@ index (sort of).</p></li>
|
||||
<li><p>Another set of char arrays in one: the five rotors as well as the two
|
||||
reflectors in one <code>char [][27]</code>. This makes for some fun code like:</p></li>
|
||||
</ul>
|
||||
<pre class="<!---c-->"><code> (Y<:e<:-10:>+5:><:k-'A':>) && (k = Y<:e<:-10:>+5:><:k-'A':>);</code></pre>
|
||||
<pre><code> (Y<:e<:-10:>+5:><:k-'A':>) && (k = Y<:e<:-10:>+5:><:k-'A':>);</code></pre>
|
||||
<p>(Of course this also removes an if statement by joining with a &&).</p>
|
||||
<ul>
|
||||
<li><p>In fact I decided that the above two arrays in arrays needed to be merged
|
||||
@@ -275,18 +276,18 @@ enough because as they rightly point out they can just use the C preprocessor
|
||||
itself. But although I have quite a few cpp directives I am not using them for
|
||||
obfuscation but rather to save bytes. For examples:</p></li>
|
||||
</ul>
|
||||
<pre class="<!---c-->"><code> %:define J(x) do(*x)=getchar(); while((*x)=='\n')</code></pre>
|
||||
<pre><code> %:define J(x) do(*x)=getchar(); while((*x)=='\n')</code></pre>
|
||||
<p>Is used quite a number of times and although it could be a function that
|
||||
takes a pointer to an int it was more convenient this way (I believe it used
|
||||
more bytes but I no longer know that). There are many others and they all
|
||||
save bytes (or at least most of them do if not all). There is one in
|
||||
particular I want to bring up though because I think it’s a curious one and
|
||||
it ties in to another point above:</p>
|
||||
<pre class="<!---c-->"><code> %:define A(y) *(&Y<:7:><:1:>+(y))</code></pre>
|
||||
<pre><code> %:define A(y) *(&Y<:7:><:1:>+(y))</code></pre>
|
||||
<p>What is special about this one: Above I noted how I sort of refer directly
|
||||
to the notch settings (I think it was the notch settings anyway). Now I
|
||||
could have done say</p>
|
||||
<pre class="<!---c-->"><code> char a = Y[7][1], b = Y[7][3], c = Y[7][5];</code></pre>
|
||||
<pre><code> char a = Y[7][1], b = Y[7][3], c = Y[7][5];</code></pre>
|
||||
<p>But I felt that doing instead the pointer arithmetic was worth doing.
|
||||
However it used significantly more bytes even as a macro: 17 if I recall
|
||||
right. That’s with the macro. If I were to include it three times by itself
|
||||
@@ -314,7 +315,7 @@ differently (and separated) so that one cannot easily replace the <code>char</co
|
||||
variables in recode.c, move them to prog.c, compile and expect it to work right.</p></li>
|
||||
<li><p>Also what is this about ?</p></li>
|
||||
</ul>
|
||||
<pre class="<!---c-->"><code> /\
|
||||
<pre><code> /\
|
||||
/ This is *not* what you think:
|
||||
void D(char*x){ /* ... */ }</code></pre>
|
||||
<p>Is that valid and if so how does it function? Yes it’s valid but I’ll leave
|
||||
|
||||
+22
-21
@@ -83,6 +83,7 @@
|
||||
<div class="sidenav">
|
||||
<a href="../../news.html">IOCCC News</a>
|
||||
<a href="../../status.html">Contest status</a>
|
||||
<a href="../../next/index.html">Rules and Guidelines</a>
|
||||
<a href="../../faq.html#submit">How to enter the IOCCC</a>
|
||||
<a href="../../faq.html">FAQ</a>
|
||||
</div>
|
||||
@@ -170,7 +171,7 @@ with the Roman numeral, showing their actual orders etc.), the reflectors
|
||||
<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>
|
||||
<pre class="<!---sh-->"><code> ./recode -h
|
||||
<pre><code> ./recode -h
|
||||
usage: ./recode [options]
|
||||
-v display selected settings
|
||||
-r pseudo-randomly select settings
|
||||
@@ -180,7 +181,7 @@ wonderful ‘challenge’ for everyone.</p>
|
||||
<p><code>-r</code> randomises settings. It won’t prompt you for settings but it will for input
|
||||
if you don’t give the option to read in a file for input.</p>
|
||||
<p><code>-v</code> shows selected settings. For example combining <code>-r</code> and <code>-v</code>:</p>
|
||||
<pre class="<!---sh-->"><code> $ echo IOCCC | ./recode -r -v
|
||||
<pre><code> $ echo IOCCC | ./recode -r -v
|
||||
Ring 1: ( I) EKMFLGDQVZNTOWYHXUSPAIBRCJ
|
||||
Ring 2: ( V) VZBRGITYUPSDNHLXAWMJQOFECK
|
||||
Ring 3: ( IV) ESOVPZJAYQUIRHXLNFTGKDCMWB
|
||||
@@ -207,7 +208,7 @@ encipherment/decipherment). If the file cannot be opened it sets back to stdin.<
|
||||
<p><code>-o</code> outputs the settings to the file. If the file cannot be opened for writing
|
||||
or is the same file name (see below) then only stdout will be used. Example of
|
||||
randomised output going to a file:</p>
|
||||
<pre class="<!---sh-->"><code> $ ./recode -r -oconfig
|
||||
<pre><code> $ ./recode -r -oconfig
|
||||
IOCCC
|
||||
3PP4UB5GG1ELGTKFCOPVBNUYXJAWSDIOCCC
|
||||
$ cat config
|
||||
@@ -236,7 +237,7 @@ 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>
|
||||
<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 class="<!---sh-->"><code> $ ./recode -R~/config</code></pre>
|
||||
<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>
|
||||
@@ -246,7 +247,7 @@ the program interactively.</p>
|
||||
<h1 id="piping-commands-to-recode"><a name="pipingtorecode" href="#toc">Piping commands to recode</a></h1>
|
||||
<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 class="<!---sh-->"><code> $ echo testing test tests | ./recode
|
||||
<pre><code> $ echo testing test tests | ./recode
|
||||
1AB2BB3CC1testing test tests
|
||||
|
||||
$ echo testing test tests | ./recode | ./prog - 2>/dev/null
|
||||
@@ -265,7 +266,7 @@ job at this anyway).</p>
|
||||
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
|
||||
don’t you might see something like:</p>
|
||||
<pre class="<!---sh-->"><code> $ ./recode -r | ./prog -
|
||||
<pre><code> $ ./recode -r | ./prog -
|
||||
Ring 1: IOCCC
|
||||
Setting 1: Position 1: Ring 2: Setting 2: Position 2: Ring 3: Setting 3: Position 3: Reflector: Plugboard pair 1: Plugboard pair 2: Plugboard pair 3: Plugboard pair 4: Plugboard pair 5: Plugboard pair 6: Plugboard pair 7: Plugboard pair 8: Plugboard pair 9: Plugboard pair 10: DEVIY</code></pre>
|
||||
<p>What happened is that <code>Ring 1:</code> is printed to stderr but since it’s not been
|
||||
@@ -274,7 +275,7 @@ 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>
|
||||
<pre class="<!---sh-->"><code> $ cat input
|
||||
<pre><code> $ cat input
|
||||
IOCCC
|
||||
|
||||
$ ./recode -finput
|
||||
@@ -314,7 +315,7 @@ a number of ways but two dots is one. Notice also that it’s in a different ord
|
||||
than the simulator: because with the size restrictions on my entry I saved bytes
|
||||
by using the same loop where I could. It just felt more natural to have them
|
||||
grouped together in a configurator for the <a href="prog.c">simulator</a>.</p>
|
||||
<pre class="<!---sh-->"><code> $ echo 1AA2AA3AA2ABCD..EFGHIJKLMNOPQRIOCCC | ./prog - 2>/dev/null
|
||||
<pre><code> $ echo 1AA2AA3AA2ABCD..EFGHIJKLMNOPQRIOCCC | ./prog - 2>/dev/null
|
||||
HQNVO
|
||||
$ echo 1AA2AA3AA2ABCD..EFGHIJKLMNOPQRIOCCC | ./prog - 2>/dev/null | echo 1AA2AA3AA2ABCD..EFGHIJKLMNOPQRHQNVO | ./prog - 2>/dev/null
|
||||
IOCCC</code></pre>
|
||||
@@ -330,13 +331,13 @@ part again; I could have just done the latter part but I wanted to show the way
|
||||
the pipeline works with settings etc.</p>
|
||||
<p>What happens if the plugboard pairs are the same but in a different order? It’s
|
||||
the same output:</p>
|
||||
<pre class="<!---sh-->"><code> $ echo 1AA2AA3AA2AB..CDEFGHIJKLMNOPQRIOCCC|./prog - 2>/dev/null
|
||||
<pre><code> $ echo 1AA2AA3AA2AB..CDEFGHIJKLMNOPQRIOCCC|./prog - 2>/dev/null
|
||||
HQNVO</code></pre>
|
||||
<p>Also if you flip the order of the letters in the pair e.g. the AB as BA instead:</p>
|
||||
<pre class="<!---sh-->"><code> $ echo 1AA2AA3AA2BA..CDEFGHIJKLMNOPQRIOCCC|./prog - 2>/dev/null
|
||||
<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>
|
||||
<pre class="<!---sh-->"><code> $ ./recode -v -oconfig -finput >/dev/null
|
||||
<pre><code> $ ./recode -v -oconfig -finput >/dev/null
|
||||
Rotors:
|
||||
(1) I: EKMFLGDQVZNTOWYHXUSPAIBRCJ
|
||||
(2) II: AJDKSIRUXBLHWTMCQGZNPYFVOE
|
||||
@@ -389,7 +390,7 @@ and it didn’t report an error. Neither did it complain about <code>IJ</code> i
|
||||
pair. This is because it consumes input overflow.</p>
|
||||
<p>It shouldn’t be this way for the simulator though because that could cause
|
||||
inconsistent number of characters expected before the text to encipher.</p>
|
||||
<pre class="<!---sh-->"><code> $ cat config
|
||||
<pre><code> $ cat config
|
||||
1AB2CD3EF2ABCDEFGHIJKLMNOPQRST
|
||||
|
||||
$ ( cat config ; cat input ) | ./prog - 2>/dev/null
|
||||
@@ -402,7 +403,7 @@ settings written? You can do that too by either sending a newline or else
|
||||
directly type ctrl-d (or whatever you have EOF set to) or give it an empty file.</p>
|
||||
<p>The following are all equivalent in that they will write to a settings file (the
|
||||
first one will print a newline with the echo but that won’t matter):</p>
|
||||
<pre class="<!---sh-->"><code> $ echo | ./recode -r -osettings
|
||||
<pre><code> $ echo | ./recode -r -osettings
|
||||
$ echo -n | ./recode -r -osettings
|
||||
$ > empty
|
||||
$ ./recode -r -osettings < empty
|
||||
@@ -414,7 +415,7 @@ the buffer remains <code>NULL</code> and so I don’t print it but still do prin
|
||||
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>
|
||||
<pre class="<!---sh-->"><code> $ echo -n|./recode -r -oconfig
|
||||
<pre><code> $ echo -n|./recode -r -oconfig
|
||||
4UH5II1RJ1SPIFEJLYGZWRTBHVCAMN$
|
||||
|
||||
$ cat input.txt
|
||||
@@ -435,7 +436,7 @@ set another variable to indicate if it should be printed.)</p>
|
||||
$ diff io input.txt
|
||||
$</code></pre>
|
||||
<p>Alternatively you can just use the <code>-R</code> and <code>-f</code> options:</p>
|
||||
<pre class="<!---sh-->"><code> $ ./recode -finput.txt -Rconfig | ./prog - 2>/dev/null > output2
|
||||
<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>
|
||||
@@ -476,7 +477,7 @@ set another variable to indicate if it should be printed.)</p>
|
||||
Cody?) there’s also a reference to code which I also love (just as all
|
||||
participants of the IOCCC do). Other things there don’t mean anything but what
|
||||
does is the output:</p>
|
||||
<pre class="<!---sh-->"><code> $ cat output
|
||||
<pre><code> $ cat output
|
||||
DBFAF 2020 Ittejg ltblwriac uqdfqvr dhqh ghhf
|
||||
|
||||
Jsjy ce v pxdmullo.
|
||||
@@ -491,21 +492,21 @@ does is the output:</p>
|
||||
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>
|
||||
<p>This is like the above only randomised:</p>
|
||||
<pre class="<!---sh-->"><code> $ ./recode -r -oconfig|./prog - 2>/dev/null
|
||||
<pre><code> $ ./recode -r -oconfig|./prog - 2>/dev/null
|
||||
IOCCC
|
||||
UGEVP</code></pre>
|
||||
<p>Note that I typed in <code>IOCCC</code> and sent <code>EOF</code> (ctrl-d); the settings were written to
|
||||
the config file (for deciphering later) and then all of it was piped to the
|
||||
Enigma entry resulting in the line below IOCCC. But let’s verify it worked out
|
||||
okay:</p>
|
||||
<pre class="<!---sh-->"><code> $ cat config
|
||||
<pre><code> $ cat config
|
||||
2BM4GJ3HK1LNCBXWRMGKSYIAZUTPVJ</code></pre>
|
||||
<p>Without having to copy/paste intermediate results:</p>
|
||||
<pre class="<!---sh-->"><code> $ echo IOCCC | ./recode -Rconfig | ./prog - 2>/dev/null | ./recode -Rconfig | ./prog - 2>/dev/null
|
||||
<pre><code> $ echo IOCCC | ./recode -Rconfig | ./prog - 2>/dev/null | ./recode -Rconfig | ./prog - 2>/dev/null
|
||||
IOCCC</code></pre>
|
||||
<p>You can also use a string for the <code>-R</code> option. I’ll use command substitution and
|
||||
actual pasting to demonstrate:</p>
|
||||
<pre class="<!---sh-->"><code> $ echo IOCCC | ./recode -R$(cat config) | ./prog - 2>/dev/null | ./recode -R2BM4GJ3HK1LNCBXWRMGKSYIAZUTPVJ | ./prog - 2>/dev/null
|
||||
<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>
|
||||
<p>That should give you an idea of how to use the <code>recode</code> program. I leave it as
|
||||
@@ -585,7 +586,7 @@ think that I would give too much away? :)</p>
|
||||
the key you wish to select is</p>
|
||||
<pre><code> 0EZ4PC1CC0PGTAQSOXWNMDRYKFUZEI</code></pre>
|
||||
<p>you can do:</p>
|
||||
<pre class="<!---sh-->"><code> ./recode -R0EZ4PC1CC0PGTAQSOXWNMDRYKFUZEI -fencrypted.html | ./prog - 2>/dev/null > decrypted.html</code></pre>
|
||||
<pre><code> ./recode -R0EZ4PC1CC0PGTAQSOXWNMDRYKFUZEI -fencrypted.html | ./prog - 2>/dev/null > decrypted.html</code></pre>
|
||||
<p>Then open <code>decrypted.html</code> in your browser.</p>
|
||||
<!--
|
||||
|
||||
|
||||
Reference in new issue
Block a user