Merge pull request #2599 from xexyl/html96

This commit is contained in:
Landon Curt Noll authored and GitHub committed 2024-07-25 19:16:37 -07:00
commit a5b62ea003
20 files changed
+130 -129

No files matched your search

+3 -7
View File
@@ -13,10 +13,6 @@
``` ```
NOTE: some compilers will compile this code into infinite loops! If the above
cat line (or one of the ones later in the try section) does not execute in a
very short amount of time, then you may need to fix your compiler or use gcc.
The above should print a `!` followed by a newline. The above should print a `!` followed by a newline.
@@ -167,7 +163,7 @@ And another...
cat august.oo august.oo august.oo test.oo | ./august cat august.oo august.oo august.oo test.oo | ./august
``` ```
<hr style="width:10%;text-align:left;margin-left:0"> <hr>
Fitting the byte code for the compiler into the initial comment Fitting the byte code for the compiler into the initial comment
was a challenge. I had to strip the compiler/interpreter of was a challenge. I had to strip the compiler/interpreter of
@@ -191,7 +187,7 @@ coder), but decompression then takes up too much code. Maybe this
would be a way to fit it all into the 1536 bytes, but I don't have would be a way to fit it all into the 1536 bytes, but I don't have
time to try it. time to try it.
<hr style="width:10%;text-align:left;margin-left:0"> <hr>
Execution starts at `main()`. Nothing can be used before it is Execution starts at `main()`. Nothing can be used before it is
defined. `getchar()` and `putchar()` are predefined functions. defined. `getchar()` and `putchar()` are predefined functions.
@@ -260,7 +256,7 @@ Terminals are in quotes, `()` is used for bracketing.
stars: "*"* stars: "*"*
``` ```
<hr style="width:10%;text-align:left;margin-left:0"> <hr>
Well, that is enough ranting for now. Well, that is enough ranting for now.
+3 -6
View File
@@ -412,9 +412,6 @@ Location: <a href="../../location.html#SE">SE</a> - <em>Kingdom of Sweden</em> (
<h2 id="to-use">To use:</h2> <h2 id="to-use">To use:</h2>
<pre><code> cat august.c test.oc | ./august &gt; test.oo <pre><code> cat august.c test.oc | ./august &gt; test.oo
./august &lt; test.oo</code></pre> ./august &lt; test.oo</code></pre>
<p>NOTE: some compilers will compile this code into infinite loops! If the above
cat line (or one of the ones later in the try section) does not execute in a
very short amount of time, then you may need to fix your compiler or use gcc.</p>
<p>The above should print a <code>!</code> followed by a newline.</p> <p>The above should print a <code>!</code> followed by a newline.</p>
<h2 id="try">Try:</h2> <h2 id="try">Try:</h2>
<pre><code> ./try.sh</code></pre> <pre><code> ./try.sh</code></pre>
@@ -487,7 +484,7 @@ level of interpretation:</p>
<pre><code> cat august.oo august.oo test.oo | ./august</code></pre> <pre><code> cat august.oo august.oo test.oo | ./august</code></pre>
<p>And another…</p> <p>And another…</p>
<pre><code> cat august.oo august.oo august.oo test.oo | ./august</code></pre> <pre><code> cat august.oo august.oo august.oo test.oo | ./august</code></pre>
<hr style="width:10%;text-align:left;margin-left:0"> <hr>
<p>Fitting the byte code for the compiler into the initial comment <p>Fitting the byte code for the compiler into the initial comment
was a challenge. I had to strip the compiler/interpreter of was a challenge. I had to strip the compiler/interpreter of
a lot of functionality to bring down their sizes. The initial a lot of functionality to bring down their sizes. The initial
@@ -507,7 +504,7 @@ the code further with a better entropy coder (e.g. an arithmetic
coder), but decompression then takes up too much code. Maybe this coder), but decompression then takes up too much code. Maybe this
would be a way to fit it all into the 1536 bytes, but I don’t have would be a way to fit it all into the 1536 bytes, but I don’t have
time to try it.</p> time to try it.</p>
<hr style="width:10%;text-align:left;margin-left:0"> <hr>
<p>Execution starts at <code>main()</code>. Nothing can be used before it is <p>Execution starts at <code>main()</code>. Nothing can be used before it is
defined. <code>getchar()</code> and <code>putchar()</code> are predefined functions.</p> defined. <code>getchar()</code> and <code>putchar()</code> are predefined functions.</p>
<p>Below is a description of the OC grammar.</p> <p>Below is a description of the OC grammar.</p>
@@ -568,7 +565,7 @@ defined. <code>getchar()</code> and <code>putchar()</code> are predefined functi
&quot;char&quot; stars &quot;char&quot; stars
stars: &quot;*&quot;*</code></pre> stars: &quot;*&quot;*</code></pre>
<hr style="width:10%;text-align:left;margin-left:0"> <hr>
<p>Well, that is enough ranting for now.</p> <p>Well, that is enough ranting for now.</p>
<!-- <!--
+2 -2
View File
@@ -17,7 +17,7 @@ section.
To quit send intr (typically ctrl-c). To quit send intr (typically ctrl-c).
NOTE: to reset the sanity of your terminal after this program ends try `reset`. **NOTE**: to reset the sanity of your terminal after this program ends try `reset`.
## Try: ## Try:
@@ -60,7 +60,7 @@ in a very small chunk of code.
## Author's remarks: ## Author's remarks:
This program shows flying spheres. The program eats CPU on lesser This program shows flying spheres. The program eats CPU on lesser
equipped systems. The program will run until termination. Terminal equipped systems. The program will run until termination. Terminals
must be VT100 or better with 80 columns and 24 rows or more. must be VT100 or better with 80 columns and 24 rows or more.
+2 -2
View File
@@ -415,7 +415,7 @@ section.</p>
<h2 id="to-use">To use:</h2> <h2 id="to-use">To use:</h2>
<pre><code> ./eldby.alt</code></pre> <pre><code> ./eldby.alt</code></pre>
<p>To quit send intr (typically ctrl-c).</p> <p>To quit send intr (typically ctrl-c).</p>
<p>NOTE: to reset the sanity of your terminal after this program ends try <code>reset</code>.</p> <p><strong>NOTE</strong>: to reset the sanity of your terminal after this program ends try <code>reset</code>.</p>
<h2 id="try">Try:</h2> <h2 id="try">Try:</h2>
<p>This alternate version, which we recommend that you use in order to see what is <p>This alternate version, which we recommend that you use in order to see what is
happening with modern systems, and to not flash too quickly, which can be happening with modern systems, and to not flash too quickly, which can be
@@ -435,7 +435,7 @@ it. To do so try:</p>
in a very small chunk of code.</p> in a very small chunk of code.</p>
<h2 id="authors-remarks">Author’s remarks:</h2> <h2 id="authors-remarks">Author’s remarks:</h2>
<p>This program shows flying spheres. The program eats CPU on lesser <p>This program shows flying spheres. The program eats CPU on lesser
equipped systems. The program will run until termination. Terminal equipped systems. The program will run until termination. Terminals
must be VT100 or better with 80 columns and 24 rows or more.</p> must be VT100 or better with 80 columns and 24 rows or more.</p>
<!-- <!--
+2 -2
View File
@@ -31,8 +31,8 @@ As the script asks, care to guess why these execute differently? Only the
compiler knows ... ok maybe other things like the author, the judges and perhaps compiler knows ... ok maybe other things like the author, the judges and perhaps
you too? you too?
BTW: it is perilous to 'try' the patience of **BTW**: it is perilous to '`try`' the patience of
[Gandalf](https://www.glyphweb.com/arda/g/gandalf.html). Go ahead, 'try' it! :-) [Gandalf](https://www.glyphweb.com/arda/g/gandalf.html). Go ahead, '`try`' it! :-)
## Judges' remarks: ## Judges' remarks:
+2 -2
View File
@@ -422,8 +422,8 @@ Location: <a href="../../location.html#UK">UK</a> - <em>United Kingdom of Great
<p>As the script asks, care to guess why these execute differently? Only the <p>As the script asks, care to guess why these execute differently? Only the
compiler knows … ok maybe other things like the author, the judges and perhaps compiler knows … ok maybe other things like the author, the judges and perhaps
you too?</p> you too?</p>
<p>BTW: it is perilous to ‘try’ the patience of <p><strong>BTW</strong>: it is perilous to ‘<code>try</code>’ the patience of
<a href="https://www.glyphweb.com/arda/g/gandalf.html">Gandalf</a>. Go ahead, ‘try’ it! :-)</p> <a href="https://www.glyphweb.com/arda/g/gandalf.html">Gandalf</a>. Go ahead, ‘<code>try</code>’ it! :-)</p>
<h2 id="judges-remarks">Judges’ remarks:</h2> <h2 id="judges-remarks">Judges’ remarks:</h2>
<p>For misleading C pre-processor output, try:</p> <p>For misleading C pre-processor output, try:</p>
<pre><code> cc -E gandalf.c</code></pre> <pre><code> cc -E gandalf.c</code></pre>
+4 -11
View File
@@ -4,7 +4,7 @@
make all make all
``` ```
NOTE: this entry requires the `X11/Xlib.h` header file and the X11 library to **NOTE**: this entry requires the `X11/Xlib.h` header file and the X11 library to
compile. For more information see the compile. For more information see the
FAQ on "[X11](../../faq.html#X11)". FAQ on "[X11](../../faq.html#X11)".
@@ -25,24 +25,17 @@ For more detailed information see [1996/jonth in bugs.html](../../bugs.html#1996
./jonth :0 :0 ./jonth :0 :0
``` ```
NOTE: the two boards will be on top of each other so you will have to drag one **NOTE**: the two boards will be on top of each other so you will have to drag one
off the other so that you can properly play. off the other so that you can properly play.
NOTE: if there is no X service open this will crash. If this is the case you **NOTE**: if there is no X service open this will crash. If this is the case you
might try: might try:
``` <!---sh--> ``` <!---sh-->
./jonth ./jonth
``` ```
These are supposed to happen. As is written in the
[The Jargon File](http://catb.org/jargon/html/F/feature.html):
```
That's not a bug, that's a feature.
```
## Try: ## Try:
@@ -67,7 +60,7 @@ as arguments to this game.
Sometimes on Solaris, X gets confused and this program core dumps. The solution: Sometimes on Solaris, X gets confused and this program core dumps. The solution:
give two display arguments (`./jonth host:0 host:0`). give two display arguments (`./jonth host:0 host:0`).
If one (or both) windows look like a copy of the window(s) below, try If one (or both) windows look like a copy of the window(s) below, try the
`xrefresh(1)` command. `xrefresh(1)` command.
Have a `nice(1)` day. Have a `nice(1)` day.
+4 -7
View File
@@ -409,7 +409,7 @@ Location: <a href="../../location.html#NO">NO</a> - <em>Kingdom of Norway</em> (
<!-- BEFORE: 1st line of markdown file: 1996/jonth/README.md --> <!-- BEFORE: 1st line of markdown file: 1996/jonth/README.md -->
<h2 id="to-build">To build:</h2> <h2 id="to-build">To build:</h2>
<pre><code> make all</code></pre> <pre><code> make all</code></pre>
<p>NOTE: this entry requires the <code>X11/Xlib.h</code> header file and the X11 library to <p><strong>NOTE</strong>: this entry requires the <code>X11/Xlib.h</code> header file and the X11 library to
compile. For more information see the compile. For more information see the
FAQ on “<a href="../../faq.html#X11">X11</a>”.</p> FAQ on “<a href="../../faq.html#X11">X11</a>”.</p>
<h3 id="bugs-and-misfeatures">Bugs and (Mis)features:</h3> <h3 id="bugs-and-misfeatures">Bugs and (Mis)features:</h3>
@@ -421,14 +421,11 @@ FAQ on “<a href="../../faq.html#X11">X11</a>”.</p>
<p>For more detailed information see <a href="../../bugs.html#1996_jonth">1996/jonth in bugs.html</a>.</p> <p>For more detailed information see <a href="../../bugs.html#1996_jonth">1996/jonth in bugs.html</a>.</p>
<h2 id="to-use">To use:</h2> <h2 id="to-use">To use:</h2>
<pre><code> ./jonth :0 :0</code></pre> <pre><code> ./jonth :0 :0</code></pre>
<p>NOTE: the two boards will be on top of each other so you will have to drag one <p><strong>NOTE</strong>: the two boards will be on top of each other so you will have to drag one
off the other so that you can properly play.</p> off the other so that you can properly play.</p>
<p>NOTE: if there is no X service open this will crash. If this is the case you <p><strong>NOTE</strong>: if there is no X service open this will crash. If this is the case you
might try:</p> might try:</p>
<pre><code> ./jonth</code></pre> <pre><code> ./jonth</code></pre>
<p>These are supposed to happen. As is written in the
<a href="http://catb.org/jargon/html/F/feature.html">The Jargon File</a>:</p>
<pre><code> That&#39;s not a bug, that&#39;s a feature.</code></pre>
<h2 id="try">Try:</h2> <h2 id="try">Try:</h2>
<pre><code> ./jonth host1:0 host2:0</code></pre> <pre><code> ./jonth host1:0 host2:0</code></pre>
<h2 id="judges-remarks">Judges’ remarks:</h2> <h2 id="judges-remarks">Judges’ remarks:</h2>
@@ -440,7 +437,7 @@ as arguments to this game.</p>
<h3 id="known-bugs">Known bugs:</h3> <h3 id="known-bugs">Known bugs:</h3>
<p>Sometimes on Solaris, X gets confused and this program core dumps. The solution: <p>Sometimes on Solaris, X gets confused and this program core dumps. The solution:
give two display arguments (<code>./jonth host:0 host:0</code>).</p> give two display arguments (<code>./jonth host:0 host:0</code>).</p>
<p>If one (or both) windows look like a copy of the window(s) below, try <p>If one (or both) windows look like a copy of the window(s) below, try the
<code>xrefresh(1)</code> command.</p> <code>xrefresh(1)</code> command.</p>
<p>Have a <code>nice(1)</code> day.</p> <p>Have a <code>nice(1)</code> day.</p>
<!-- <!--
+11 -8
View File
@@ -31,16 +31,17 @@ For a good no-op try:
gzip -c < rcm.c | ./rcm gzip -c < rcm.c | ./rcm
``` ```
NOTE: this is done in the [try.sh](%%REPO_URL%%/1996/rcm/try.sh) script as well, along with some other **NOTE**: this is done in the [try.sh](%%REPO_URL%%/1996/rcm/try.sh) script as
commands including a way to do the above command but with more steps. well, along with some other commands including a way to do the above command but
with more steps.
## Author's remarks: ## Author's remarks:
Except for some silly requirements regarding input validation, CRC checking, and Except for some silly requirements regarding input validation, CRC checking, and
similar unimportant fluff, this program is a fully compliant similar unimportant fluff, this program is a fully compliant
[RFC1951](https://www.ietf.org/rfc/rfc1951.txt)/[RFC1952](https://www.ietf.org/rfc/rfc1952.txt), [RFC1951](https://www.ietf.org/rfc/rfc1951.txt)/[RFC1952](https://www.ietf.org/rfc/rfc1952.txt)
[GNU Gzip](https://www.gnu.org/software/gzip/), file uncompressor. Feed it a [GNU Gzip](https://www.gnu.org/software/gzip/) file uncompressor. Feed it a
`gzip` compressed file on standard input, and it will write the fully `gzip` compressed file on standard input, and it will write the fully
uncompressed original file to standard output. uncompressed original file to standard output.
@@ -66,13 +67,15 @@ meets and actually exceeds specification."
"The program source is less than 3,100 characters in length and uncompresses the "The program source is less than 3,100 characters in length and uncompresses the
file file
[emacs-19.34b.tar.gz](https://ftp.gnu.org/old-gnu/emacs/emacs-19.34b.tar.gz) in [emacs-19.34b.tar.gz](https://ftp.gnu.org/old-gnu/emacs/emacs-19.34b.tar.gz) in
about 130 seconds on my HP 9000/735. The now obsolete source file `inflate.c' about 130 seconds on my HP 9000/735. The now obsolete source file `inflate.c`
from the GNU gzip source tree is 31,613 characters in length and uncompresses from the GNU gzip source tree is 31,613 characters in length and uncompresses
the emacs distribution file in slightly under 25 seconds. Thus: the emacs distribution file in slightly under 25 seconds. Thus:
``` > 3100 / 130 = 23.85
3100 / 130 = 23.85 -vs- 31613 / 25 = 1264.52
``` vs:
> 31613 / 25 = 1264.52
which represents a better than 530% improvement in the ratio of which represents a better than 530% improvement in the ratio of
source file size to execution time." source file size to execution time."
+13 -6
View File
@@ -418,13 +418,14 @@ Location: <a href="../../location.html#US">US</a> - <em>United States of America
<h2 id="judges-remarks">Judges’ remarks:</h2> <h2 id="judges-remarks">Judges’ remarks:</h2>
<p>For a good no-op try:</p> <p>For a good no-op try:</p>
<pre><code> gzip -c &lt; rcm.c | ./rcm</code></pre> <pre><code> gzip -c &lt; rcm.c | ./rcm</code></pre>
<p>NOTE: this is done in the <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1996/rcm/try.sh">try.sh</a> script as well, along with some other <p><strong>NOTE</strong>: this is done in the <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1996/rcm/try.sh">try.sh</a> script as
commands including a way to do the above command but with more steps.</p> well, along with some other commands including a way to do the above command but
with more steps.</p>
<h2 id="authors-remarks">Author’s remarks:</h2> <h2 id="authors-remarks">Author’s remarks:</h2>
<p>Except for some silly requirements regarding input validation, CRC checking, and <p>Except for some silly requirements regarding input validation, CRC checking, and
similar unimportant fluff, this program is a fully compliant similar unimportant fluff, this program is a fully compliant
<a href="https://www.ietf.org/rfc/rfc1951.txt">RFC1951</a>/<a href="https://www.ietf.org/rfc/rfc1952.txt">RFC1952</a>, <a href="https://www.ietf.org/rfc/rfc1951.txt">RFC1951</a>/<a href="https://www.ietf.org/rfc/rfc1952.txt">RFC1952</a>
<a href="https://www.gnu.org/software/gzip/">GNU Gzip</a>, file uncompressor. Feed it a <a href="https://www.gnu.org/software/gzip/">GNU Gzip</a> file uncompressor. Feed it a
<code>gzip</code> compressed file on standard input, and it will write the fully <code>gzip</code> compressed file on standard input, and it will write the fully
uncompressed original file to standard output.</p> uncompressed original file to standard output.</p>
<h3 id="objustifications-for-this-entry">ObJustifications for this entry:</h3> <h3 id="objustifications-for-this-entry">ObJustifications for this entry:</h3>
@@ -439,10 +440,16 @@ meets and actually exceeds specification.”</p>
<p>“The program source is less than 3,100 characters in length and uncompresses the <p>“The program source is less than 3,100 characters in length and uncompresses the
file file
<a href="https://ftp.gnu.org/old-gnu/emacs/emacs-19.34b.tar.gz">emacs-19.34b.tar.gz</a> in <a href="https://ftp.gnu.org/old-gnu/emacs/emacs-19.34b.tar.gz">emacs-19.34b.tar.gz</a> in
about 130 seconds on my HP 9000/735. The now obsolete source file `inflate.c’ about 130 seconds on my HP 9000/735. The now obsolete source file <code>inflate.c</code>
from the GNU gzip source tree is 31,613 characters in length and uncompresses from the GNU gzip source tree is 31,613 characters in length and uncompresses
the emacs distribution file in slightly under 25 seconds. Thus:</p> the emacs distribution file in slightly under 25 seconds. Thus:</p>
<pre><code> 3100 / 130 = 23.85 -vs- 31613 / 25 = 1264.52</code></pre> <blockquote>
<p>3100 / 130 = 23.85</p>
</blockquote>
<p>vs:</p>
<blockquote>
<p>31613 / 25 = 1264.52</p>
</blockquote>
<p>which represents a better than 530% improvement in the ratio of <p>which represents a better than 530% improvement in the ratio of
source file size to execution time.”</p> source file size to execution time.”</p>
<h4 id="the-whining-programmers-argument">The Whining Programmer’s Argument:</h4> <h4 id="the-whining-programmers-argument">The Whining Programmer’s Argument:</h4>
+22 -26
View File
@@ -47,33 +47,29 @@ for anni domini within the [Gregorian
Calendar](https://en.wikipedia.org/wiki/Gregorian_calendar), that is, from ad 1582 Calendar](https://en.wikipedia.org/wiki/Gregorian_calendar), that is, from ad 1582
to ad 2199: to ad 2199:
``` > Let `J` be the year.<br>
Let J be the year. > If `J` is from `1582` to `1699`, let `M` be `22` and `N` be `2`.<br>
If J is from 1582 to 1699, let M be 22, let N be 2 > If `J` is from `1700` to `1799`, let `M` be `23` and `N` be `3`.<br>
If J is from 1700 to 1799, let M be 23, let N be 3 > If `J` is from `1800` to `1899`, let `M` be `23` and `N` be `4`.<br>
If J is from 1800 to 1899, let M be 23, let N be 4 > If `J` is from `1900` to `2099`, let `M` be `24`, let `N` be `5`.<br>
If J is from 1900 to 2099, let M be 24, let N be 5 > If `J` is from `2100` to `2199`, let `M` be `24`, let `N` be `6`.<br>
If J is from 2100 to 2199, let M be 24, let N be 6 > Let `a` be the modulus of `J` divided by `19`.<br>
Let a be the modulus of J divided by 19 > Let `b` be the modulus of `J` divided by `4`.<br>
Let b be the modulus of J divided by 4 > Let `c` be the modulus of `J` divided by `7`.<br>
Let c be the modulus of J divided by 7 > Let `d` be the modulus of `(19a + M)` divided by `30`.<br>
Let d be the modulus of (19a + M) divided by 30 > Let `e` be the modulus of `(2b + 4c + 6d + N)` divided by `7`.
Let e be the modulus of (2b + 4c + 6d + N) divided by 7
```
The interesting Sunday is either: The interesting Sunday is either (only one of them is a valid date):
> March `22 + d + e`; or<br>
> April `d + e - 9`
```
March 22 + d + e or
April d + e - 9 (only one of them is a valid date)
```
with the following exceptions: with the following exceptions:
``` > April 26 must always be changed to April 19.<br>
April 26 must always be changed to April 19 > April 25 must be changed to April 18 if `d` is `28` and `a` is greater than
April 25 must be changed to April 18 if d is 28 and a is greater than 10 `10`.
```
### Example: ### Example:
@@ -125,13 +121,13 @@ Try to be as precise as can be and no one will comprehend what you mean.
#### The interpretation: #### The interpretation:
"Say nothing and everybody will understand." > "Say nothing and everybody will understand."
The `-I/usr/include` in the build file is needed by gcc on Solaris because The `-I/usr/include` in the build file is needed by gcc on Solaris because
`gcc`'s "fixed" header in `gcc-lib/sparc-sun-solaris2.5/2.7.2/include/errno.h` `gcc`'s "fixed" header in `gcc-lib/sparc-sun-solaris2.5/2.7.2/include/errno.h`
is broken (sort of) because it has *two* identical extern declarations of errno. is broken (sort of) because it has *two* identical extern declarations of `errno`.
This leads to an error due to the redefinition of main. The `-I` option makes This leads to an error due to the redefinition of `main`. The `-I` option makes
sure the working /usr/include/errno.h is found first, which shouldn't cause any sure the working `/usr/include/errno.h` is found first, which shouldn't cause any
problems on other systems. problems on other systems.
+28 -19
View File
@@ -433,23 +433,30 @@ ueber das Weltall” ‘Handbook About Space’, Meyer, 5th Edition, 1973, p149]
for anni domini within the <a href="https://en.wikipedia.org/wiki/Gregorian_calendar">Gregorian for anni domini within the <a href="https://en.wikipedia.org/wiki/Gregorian_calendar">Gregorian
Calendar</a>, that is, from ad 1582 Calendar</a>, that is, from ad 1582
to ad 2199:</p> to ad 2199:</p>
<pre><code> Let J be the year. <blockquote>
If J is from 1582 to 1699, let M be 22, let N be 2 <p>Let <code>J</code> be the year.<br>
If J is from 1700 to 1799, let M be 23, let N be 3 If <code>J</code> is from <code>1582</code> to <code>1699</code>, let <code>M</code> be <code>22</code> and <code>N</code> be <code>2</code>.<br>
If J is from 1800 to 1899, let M be 23, let N be 4 If <code>J</code> is from <code>1700</code> to <code>1799</code>, let <code>M</code> be <code>23</code> and <code>N</code> be <code>3</code>.<br>
If J is from 1900 to 2099, let M be 24, let N be 5 If <code>J</code> is from <code>1800</code> to <code>1899</code>, let <code>M</code> be <code>23</code> and <code>N</code> be <code>4</code>.<br>
If J is from 2100 to 2199, let M be 24, let N be 6 If <code>J</code> is from <code>1900</code> to <code>2099</code>, let <code>M</code> be <code>24</code>, let <code>N</code> be <code>5</code>.<br>
Let a be the modulus of J divided by 19 If <code>J</code> is from <code>2100</code> to <code>2199</code>, let <code>M</code> be <code>24</code>, let <code>N</code> be <code>6</code>.<br>
Let b be the modulus of J divided by 4 Let <code>a</code> be the modulus of <code>J</code> divided by <code>19</code>.<br>
Let c be the modulus of J divided by 7 Let <code>b</code> be the modulus of <code>J</code> divided by <code>4</code>.<br>
Let d be the modulus of (19a + M) divided by 30 Let <code>c</code> be the modulus of <code>J</code> divided by <code>7</code>.<br>
Let e be the modulus of (2b + 4c + 6d + N) divided by 7</code></pre> Let <code>d</code> be the modulus of <code>(19a + M)</code> divided by <code>30</code>.<br>
<p>The interesting Sunday is either:</p> Let <code>e</code> be the modulus of <code>(2b + 4c + 6d + N)</code> divided by <code>7</code>.</p>
<pre><code> March 22 + d + e or </blockquote>
April d + e - 9 (only one of them is a valid date)</code></pre> <p>The interesting Sunday is either (only one of them is a valid date):</p>
<blockquote>
<p>March <code>22 + d + e</code>; or<br>
April <code>d + e - 9</code></p>
</blockquote>
<p>with the following exceptions:</p> <p>with the following exceptions:</p>
<pre><code> April 26 must always be changed to April 19 <blockquote>
April 25 must be changed to April 18 if d is 28 and a is greater than 10</code></pre> <p>April 26 must always be changed to April 19.<br>
April 25 must be changed to April 18 if <code>d</code> is <code>28</code> and <code>a</code> is greater than
<code>10</code>.</p>
</blockquote>
<h3 id="example">Example:</h3> <h3 id="example">Example:</h3>
<pre><code> J = 1962, M = 24, N = 5 <pre><code> J = 1962, M = 24, N = 5
a = J % 19 == 5 a = J % 19 == 5
@@ -481,12 +488,14 @@ these easy to remember language elements is justified in my opinion.</p>
<h4 id="the-formula">The formula:</h4> <h4 id="the-formula">The formula:</h4>
<pre><code> comprehension = 1/(2**precision)</code></pre> <pre><code> comprehension = 1/(2**precision)</code></pre>
<h4 id="the-interpretation">The interpretation:</h4> <h4 id="the-interpretation">The interpretation:</h4>
<blockquote>
<p>“Say nothing and everybody will understand.”</p> <p>“Say nothing and everybody will understand.”</p>
</blockquote>
<p>The <code>-I/usr/include</code> in the build file is needed by gcc on Solaris because <p>The <code>-I/usr/include</code> in the build file is needed by gcc on Solaris because
<code>gcc</code>’s “fixed” header in <code>gcc-lib/sparc-sun-solaris2.5/2.7.2/include/errno.h</code> <code>gcc</code>’s “fixed” header in <code>gcc-lib/sparc-sun-solaris2.5/2.7.2/include/errno.h</code>
is broken (sort of) because it has <em>two</em> identical extern declarations of errno. is broken (sort of) because it has <em>two</em> identical extern declarations of <code>errno</code>.
This leads to an error due to the redefinition of main. The <code>-I</code> option makes This leads to an error due to the redefinition of <code>main</code>. The <code>-I</code> option makes
sure the working /usr/include/errno.h is found first, which shouldn’t cause any sure the working <code>/usr/include/errno.h</code> is found first, which shouldn’t cause any
problems on other systems.</p> problems on other systems.</p>
<h3 id="usage">Usage:</h3> <h3 id="usage">Usage:</h3>
<p>The program is run without arguments. It prints all dates in order.</p> <p>The program is run without arguments. It prints all dates in order.</p>
+4 -4
View File
@@ -57,7 +57,7 @@ appropriately. Try:
perl ./hunni.pl < hunni.c perl ./hunni.pl < hunni.c
``` ```
NOTE: the [try.sh](%%REPO_URL%%/1996/schweikh2/try.sh) does this if you have **NOTE**: the [try.sh](%%REPO_URL%%/1996/schweikh2/try.sh) script does this if you have
`perl(1)` installed to show how the output is the same as `perl(1)` installed to show how the output is the same as
[schweikh2.c](%%REPO_URL%%/1996/schweikh2/schweikh2.c) itself. [schweikh2.c](%%REPO_URL%%/1996/schweikh2/schweikh2.c) itself.
@@ -66,7 +66,7 @@ This entry was another crowd pleaser at the IOCCC BOF.
## Author's remarks: ## Author's remarks:
Note: the source must be viewed with tabstop 8. To appreciate the **NOTE**: the source must be viewed with tabstop 8. To appreciate the
beauty have your eyes half closed. beauty have your eyes half closed.
@@ -91,7 +91,7 @@ round even swaps the tokens, so all keywords must be spelled backwards
(sort of, can you spot `printf` in the `P` macro?). (sort of, can you spot `printf` in the `P` macro?).
Try to indent the source. The unbalanced parentheses confuse Solaris' Try to indent the source. The unbalanced parentheses confuse Solaris'
indent to the max (although the result does compile): `indent` to the max (although the result does compile):
Looking at the indented source is even *less* fun, because the nice Looking at the indented source is even *less* fun, because the nice
diamond pattern has been replaced by something that looks like, uhm, diamond pattern has been replaced by something that looks like, uhm,
@@ -102,7 +102,7 @@ Lint the source. It's clean. How obfuscated...
What's the exit status? The program exits with `J - 1` where `J` is the What's the exit status? The program exits with `J - 1` where `J` is the
return value from several non-void functions (needed to shut up return value from several non-void functions (needed to shut up
lint). The last assignment is `J = printf ("%c", 10);` so the exit lint). The last assignment is `J = printf ("%c", 10);` so the exit
status is 0 unless the last `printf` failed, which is even a *useful* status is `0` unless the last `printf` failed, which is even a *useful*
status. A further obfuscation is the use of `10` instead of `'\n'`. status. A further obfuscation is the use of `10` instead of `'\n'`.
`'\n'` can not be constructed by token pasting, AFAIK. That's why `schweikh2` `'\n'` can not be constructed by token pasting, AFAIK. That's why `schweikh2`
is likely to produce occasional garbage on non-ASCII execution character is likely to produce occasional garbage on non-ASCII execution character
+4 -4
View File
@@ -434,12 +434,12 @@ appropriately. Try:</p>
<pre><code> less hunni.c <pre><code> less hunni.c
perl ./hunni.pl &lt; hunni.c</code></pre> perl ./hunni.pl &lt; hunni.c</code></pre>
<p>NOTE: the <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1996/schweikh2/try.sh">try.sh</a> does this if you have <p><strong>NOTE</strong>: the <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1996/schweikh2/try.sh">try.sh</a> script does this if you have
<code>perl(1)</code> installed to show how the output is the same as <code>perl(1)</code> installed to show how the output is the same as
<a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1996/schweikh2/schweikh2.c">schweikh2.c</a> itself.</p> <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1996/schweikh2/schweikh2.c">schweikh2.c</a> itself.</p>
<p>This entry was another crowd pleaser at the IOCCC BOF.</p> <p>This entry was another crowd pleaser at the IOCCC BOF.</p>
<h2 id="authors-remarks">Author’s remarks:</h2> <h2 id="authors-remarks">Author’s remarks:</h2>
<p>Note: the source must be viewed with tabstop 8. To appreciate the <p><strong>NOTE</strong>: the source must be viewed with tabstop 8. To appreciate the
beauty have your eyes half closed.</p> beauty have your eyes half closed.</p>
<h3 id="why-i-think-this-program-is-obfuscated">Why I think this program is obfuscated:</h3> <h3 id="why-i-think-this-program-is-obfuscated">Why I think this program is obfuscated:</h3>
<p>C is a free format language. It is therefore a question of style how <p>C is a free format language. It is therefore a question of style how
@@ -460,7 +460,7 @@ you intend to generate object names from 9 or more components. The final
round even swaps the tokens, so all keywords must be spelled backwards round even swaps the tokens, so all keywords must be spelled backwards
(sort of, can you spot <code>printf</code> in the <code>P</code> macro?).</p> (sort of, can you spot <code>printf</code> in the <code>P</code> macro?).</p>
<p>Try to indent the source. The unbalanced parentheses confuse Solaris’ <p>Try to indent the source. The unbalanced parentheses confuse Solaris’
indent to the max (although the result does compile):</p> <code>indent</code> to the max (although the result does compile):</p>
<p>Looking at the indented source is even <em>less</em> fun, because the nice <p>Looking at the indented source is even <em>less</em> fun, because the nice
diamond pattern has been replaced by something that looks like, uhm, diamond pattern has been replaced by something that looks like, uhm,
modem noise.</p> modem noise.</p>
@@ -468,7 +468,7 @@ modem noise.</p>
<p>What’s the exit status? The program exits with <code>J - 1</code> where <code>J</code> is the <p>What’s the exit status? The program exits with <code>J - 1</code> where <code>J</code> is the
return value from several non-void functions (needed to shut up return value from several non-void functions (needed to shut up
lint). The last assignment is <code>J = printf ("%c", 10);</code> so the exit lint). The last assignment is <code>J = printf ("%c", 10);</code> so the exit
status is 0 unless the last <code>printf</code> failed, which is even a <em>useful</em> status is <code>0</code> unless the last <code>printf</code> failed, which is even a <em>useful</em>
status. A further obfuscation is the use of <code>10</code> instead of <code>'\n'</code>. status. A further obfuscation is the use of <code>10</code> instead of <code>'\n'</code>.
<code>'\n'</code> can not be constructed by token pasting, AFAIK. That’s why <code>schweikh2</code> <code>'\n'</code> can not be constructed by token pasting, AFAIK. That’s why <code>schweikh2</code>
is likely to produce occasional garbage on non-ASCII execution character is likely to produce occasional garbage on non-ASCII execution character
+7 -7
View File
@@ -20,7 +20,7 @@ You have been warned.
## Judges' remarks: ## Judges' remarks:
The source fails to compile on compilers that recognize the inline The source fails to compile on compilers that recognize the inline
keyword by default. For gcc, you may need to use `-ansi`. keyword by default. For `gcc`, you may need to use `-ansi`.
See the file [schweikh3.info](%%REPO_URL%%/1996/schweikh3/schweikh3.info) for example output from various See the file [schweikh3.info](%%REPO_URL%%/1996/schweikh3/schweikh3.info) for example output from various
systems. systems.
@@ -47,7 +47,7 @@ uncompilable on many systems that have not yet incorporated
Amendment One to The Standard. If you, dear reader, suffer from Amendment One to The Standard. If you, dear reader, suffer from
this disease, just read `iso646.h`. this disease, just read `iso646.h`.
There are no `if' statements. They have been replaced by There are no `if` statements. They have been replaced by
`switch () case 1:` or `switch () case 0:` etc. At least one `switch () case 1:` or `switch () case 0:` etc. At least one
`switch` has a declaration after the opening brace, booh! `switch` has a declaration after the opening brace, booh!
Identifiers are named after random programming languages, BASIC (as `Basic`), Identifiers are named after random programming languages, BASIC (as `Basic`),
@@ -55,7 +55,7 @@ COBOL, F77, awk etc.
You have to select maximum ANSI C conformance of your You have to select maximum ANSI C conformance of your
compiler. The source fails to compile under a C++ compiler due to compiler. The source fails to compile under a C++ compiler due to
the `new' identifier which is a C++ reserved word: the `new` identifier which is a C++ reserved word:
``` <!---sh--> ``` <!---sh-->
$ g++ schweikh3.c $ g++ schweikh3.c
@@ -69,7 +69,7 @@ the `new' identifier which is a C++ reserved word:
``` ```
The source fails to compile on compilers that recognize the inline The source fails to compile on compilers that recognize the inline
keyword by default, e.g. gcc: keyword by default, e.g. `gcc`:
``` <!---sh--> ``` <!---sh-->
$ gcc schweikh3.c $ gcc schweikh3.c
@@ -80,14 +80,14 @@ keyword by default, e.g. gcc:
schweikh3.c:97: parse error before `void' schweikh3.c:97: parse error before `void'
``` ```
The `-ansi` option to gcc fixes this. The `-ansi` option to `gcc` fixes this.
The source fails to compile on obsolete systems with obsolete The source fails to compile on obsolete systems with obsolete
memory models due to the identifier `far` (to be honest: this is memory models due to the identifier `far` (to be honest: this is
untested :-) ). untested :-) ).
Does your indent cope with backslash/newline pairs in between keywords like in Does your `indent(1)` cope with backslash/newline pairs in between keywords like in
`re\turn` where the `re\` is at the end of a line? ? Solaris' indent inserts `re\turn` where the `re\` is at the end of a line? ? Solaris' `indent(1)` inserts
spaces and thereby renders the source uncompilable... spaces and thereby renders the source uncompilable...
The indented source will exhibit different semantics when indenting The indented source will exhibit different semantics when indenting
+10 -7
View File
@@ -417,7 +417,7 @@ You have been warned.</p>
<pre><code> ./schweikh3</code></pre> <pre><code> ./schweikh3</code></pre>
<h2 id="judges-remarks">Judges’ remarks:</h2> <h2 id="judges-remarks">Judges’ remarks:</h2>
<p>The source fails to compile on compilers that recognize the inline <p>The source fails to compile on compilers that recognize the inline
keyword by default. For gcc, you may need to use <code>-ansi</code>.</p> keyword by default. For <code>gcc</code>, you may need to use <code>-ansi</code>.</p>
<p>See the file <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1996/schweikh3/schweikh3.info">schweikh3.info</a> for example output from various <p>See the file <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1996/schweikh3/schweikh3.info">schweikh3.info</a> for example output from various
systems.</p> systems.</p>
<p>But still it is a useful utility. To use try:</p> <p>But still it is a useful utility. To use try:</p>
@@ -433,11 +433,14 @@ disgusting. Besides, requiring <code>iso646.h</code> will render the program
uncompilable on many systems that have not yet incorporated uncompilable on many systems that have not yet incorporated
Amendment One to The Standard. If you, dear reader, suffer from Amendment One to The Standard. If you, dear reader, suffer from
this disease, just read <code>iso646.h</code>.</p> this disease, just read <code>iso646.h</code>.</p>
<p>There are no <code>if' statements. They have been replaced by</code>switch () case 1:<code>or</code>switch () case 0:<code>etc. At least one</code>switch<code>has a declaration after the opening brace, booh! Identifiers are named after random programming languages, BASIC (as</code>Basic`), <p>There are no <code>if</code> statements. They have been replaced by
<code>switch () case 1:</code> or <code>switch () case 0:</code> etc. At least one
<code>switch</code> has a declaration after the opening brace, booh!
Identifiers are named after random programming languages, BASIC (as <code>Basic</code>),
COBOL, F77, awk etc.</p> COBOL, F77, awk etc.</p>
<p>You have to select maximum ANSI C conformance of your <p>You have to select maximum ANSI C conformance of your
compiler. The source fails to compile under a C++ compiler due to compiler. The source fails to compile under a C++ compiler due to
the `new’ identifier which is a C++ reserved word:</p> the <code>new</code> identifier which is a C++ reserved word:</p>
<pre><code> $ g++ schweikh3.c <pre><code> $ g++ schweikh3.c
schweikh3.c:9: parse error before `new&#39; schweikh3.c:9: parse error before `new&#39;
schweikh3.c:16: parse error before `new&#39; schweikh3.c:16: parse error before `new&#39;
@@ -447,19 +450,19 @@ the `new’ identifier which is a C++ reserved word:</p>
[...] [...]
schweikh3.c:91: confused by earlier errors, bailing out</code></pre> schweikh3.c:91: confused by earlier errors, bailing out</code></pre>
<p>The source fails to compile on compilers that recognize the inline <p>The source fails to compile on compilers that recognize the inline
keyword by default, e.g. gcc:</p> keyword by default, e.g. <code>gcc</code>:</p>
<pre><code> $ gcc schweikh3.c <pre><code> $ gcc schweikh3.c
schweikh3.c:46: parse error before `void&#39; schweikh3.c:46: parse error before `void&#39;
schweikh3.c: In function `main&#39;: schweikh3.c: In function `main&#39;:
schweikh3.c:91: parse error before `inline&#39; schweikh3.c:91: parse error before `inline&#39;
schweikh3.c: At top level: schweikh3.c: At top level:
schweikh3.c:97: parse error before `void&#39;</code></pre> schweikh3.c:97: parse error before `void&#39;</code></pre>
<p>The <code>-ansi</code> option to gcc fixes this.</p> <p>The <code>-ansi</code> option to <code>gcc</code> fixes this.</p>
<p>The source fails to compile on obsolete systems with obsolete <p>The source fails to compile on obsolete systems with obsolete
memory models due to the identifier <code>far</code> (to be honest: this is memory models due to the identifier <code>far</code> (to be honest: this is
untested :-) ).</p> untested :-) ).</p>
<p>Does your indent cope with backslash/newline pairs in between keywords like in <p>Does your <code>indent(1)</code> cope with backslash/newline pairs in between keywords like in
<code>re\turn</code> where the <code>re\</code> is at the end of a line? ? Solaris’ indent inserts <code>re\turn</code> where the <code>re\</code> is at the end of a line? ? Solaris’ <code>indent(1)</code> inserts
spaces and thereby renders the source uncompilable…</p> spaces and thereby renders the source uncompilable…</p>
<p>The indented source will exhibit different semantics when indenting <p>The indented source will exhibit different semantics when indenting
changes the number of lines (due to using the <code>__LINE__</code> macro in an changes the number of lines (due to using the <code>__LINE__</code> macro in an
+3 -3
View File
@@ -4,9 +4,9 @@
make all make all
``` ```
There is another version which is the original entry. See [alternate There is another version which is the original entry. See [Alternate
version](#alternate-code) for details as to how to use and why it was made the code](#alternate-code) for details as to how to use and why it was made the
alt version. alt version.
## To use: ## To use:
+2 -2
View File
@@ -409,8 +409,8 @@ Location: <a href="../../location.html#US">US</a> - <em>United States of America
<!-- BEFORE: 1st line of markdown file: 1996/westley/README.md --> <!-- BEFORE: 1st line of markdown file: 1996/westley/README.md -->
<h2 id="to-build">To build:</h2> <h2 id="to-build">To build:</h2>
<pre><code> make all</code></pre> <pre><code> make all</code></pre>
<p>There is another version which is the original entry. See <a href="#alternate-code">alternate <p>There is another version which is the original entry. See <a href="#alternate-code">Alternate
version</a> for details as to how to use and why it was made the code</a> for details as to how to use and why it was made the
alt version.</p> alt version.</p>
<h2 id="to-use">To use:</h2> <h2 id="to-use">To use:</h2>
<pre><code> ./clock1.sh <pre><code> ./clock1.sh
+2 -2
View File
@@ -1570,7 +1570,7 @@ compilers to use the program but this file is missing. Can you provide it?</p>
<h3 id="status-missing-or-dead-link-or-links---please-provide-it-or-them">STATUS: missing or dead link or links - please provide it or them</h3> <h3 id="status-missing-or-dead-link-or-links---please-provide-it-or-them">STATUS: missing or dead link or links - please provide it or them</h3>
<h3 id="source-code-1996gandalfgandalf.c">Source code: <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1996/gandalf/gandalf.c">1996/gandalf/gandalf.c</a></h3> <h3 id="source-code-1996gandalfgandalf.c">Source code: <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1996/gandalf/gandalf.c">1996/gandalf/gandalf.c</a></h3>
<h3 id="information-1996gandalfindex.html">Information: <a href="1996/gandalf/index.html">1996/gandalf/index.html</a></h3> <h3 id="information-1996gandalfindex.html">Information: <a href="1996/gandalf/index.html">1996/gandalf/index.html</a></h3>
<p>The link was http://www.tc3.co.uk/~gandalf/G.HTML but this no longer exists as <p>The link was <code>http://www.tc3.co.uk/~gandalf/G.HTML</code> but this no longer exists as
it was instead requiring a login / password.</p> it was instead requiring a login / password.</p>
<p>Do you have an updated link? We welcome your help!</p> <p>Do you have an updated link? We welcome your help!</p>
<div id="1996_huffman"> <div id="1996_huffman">
@@ -1615,7 +1615,7 @@ almost be done except that some of the output of the
<h3 id="information-1996jonthindex.html">Information: <a href="1996/jonth/index.html">1996/jonth/index.html</a></h3> <h3 id="information-1996jonthindex.html">Information: <a href="1996/jonth/index.html">1996/jonth/index.html</a></h3>
<p>If X is not running this program will very likely crash or do something funny. <p>If X is not running this program will very likely crash or do something funny.
This should NOT be fixed.</p> This should NOT be fixed.</p>
<p>NOTE: the two boards will be on top of each other so you will have to drag one <p><strong>NOTE</strong>: the two boards will be on top of each other so you will have to drag one
off the other so that you can properly play.</p> off the other so that you can properly play.</p>
<h3 id="status-missing-or-dead-link-or-links---please-provide-it-or-them-1">STATUS: missing or dead link or links - please provide it or them</h3> <h3 id="status-missing-or-dead-link-or-links---please-provide-it-or-them-1">STATUS: missing or dead link or links - please provide it or them</h3>
<p>As well: the link which was http://www.uio.no/~jonth is no longer valid and <p>As well: the link which was http://www.uio.no/~jonth is no longer valid and
+2 -2
View File
@@ -1704,7 +1704,7 @@ We would appreciate anyone who has it or even just knows the name! Thank you.
### Source code: [1996/gandalf/gandalf.c](%%REPO_URL%%/1996/gandalf/gandalf.c) ### Source code: [1996/gandalf/gandalf.c](%%REPO_URL%%/1996/gandalf/gandalf.c)
### Information: [1996/gandalf/index.html](1996/gandalf/index.html) ### Information: [1996/gandalf/index.html](1996/gandalf/index.html)
The link was http://www.tc3.co.uk/~gandalf/G.HTML but this no longer exists as The link was `http://www.tc3.co.uk/~gandalf/G.HTML` but this no longer exists as
it was instead requiring a login / password. it was instead requiring a login / password.
Do you have an updated link? We welcome your help! Do you have an updated link? We welcome your help!
@@ -1764,7 +1764,7 @@ But since it does not for the time being it is advisable to just redirect
If X is not running this program will very likely crash or do something funny. If X is not running this program will very likely crash or do something funny.
This should NOT be fixed. This should NOT be fixed.
NOTE: the two boards will be on top of each other so you will have to drag one **NOTE**: the two boards will be on top of each other so you will have to drag one
off the other so that you can properly play. off the other so that you can properly play.