Merge pull request #1419 from xexyl/huffman96
This commit is contained in:
2 files changed
+39
-8
No files matched your search
+31
-1
@@ -1,7 +1,37 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
#
|
||||||
|
# try.sh - show IOCCC winner 1996/huffman
|
||||||
|
#
|
||||||
|
# ...
|
||||||
|
#
|
||||||
|
# So, that's to end the story for you and me
|
||||||
|
# If you still give a listen, you just may
|
||||||
|
# Hear a big wolf-man or little piggy say
|
||||||
|
# Little pig, little pig, let me in
|
||||||
|
# Not by the hair of my chinny, chin, chin
|
||||||
|
# Little pig, little pig, let me in
|
||||||
|
# Not by the hair of my chinny, chin, chin
|
||||||
|
# Well, I'm huffin', I'm puffin', I'll blow your house in
|
||||||
|
# Huffin', puffin', blow your house in
|
||||||
|
# Huffin', puffin', blow your house in
|
||||||
|
# Huffin' and a puffin' and I'll blow your house in!
|
||||||
|
# And the moral of the story is
|
||||||
|
# band with no talent can easily amuse
|
||||||
|
# Idiots with a stupid, puppet show
|
||||||
|
#
|
||||||
|
# :-)
|
||||||
|
|
||||||
make all >/dev/null || exit 1
|
# make sure CC is set so that when we do make CC="$CC" it isn't empty. Doing it
|
||||||
|
# this way allows us to have the user specify a different compiler in an easy
|
||||||
|
# way.
|
||||||
|
if [[ -z "$CC" ]]; then
|
||||||
|
CC="cc"
|
||||||
|
fi
|
||||||
|
|
||||||
|
make CC="$CC" all >/dev/null || exit 1
|
||||||
|
|
||||||
|
# clear screen after compilation so that only the entry is shown
|
||||||
|
clear
|
||||||
|
|
||||||
echo "$ echo 'seeing or feeling is believing' | ./huffman" 1>&2
|
echo "$ echo 'seeing or feeling is believing' | ./huffman" 1>&2
|
||||||
echo 'seeing or feeling is believing' | ./huffman 2>/dev/null
|
echo 'seeing or feeling is believing' | ./huffman 2>/dev/null
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ make
|
|||||||
## To use:
|
## To use:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
./schneiderwent datafile
|
./schneiderwent
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@@ -57,20 +57,21 @@ deficiency.
|
|||||||
|
|
||||||
Obfuscation in this entry consists of:
|
Obfuscation in this entry consists of:
|
||||||
|
|
||||||
* `printf()`ing console messages stored as EBCDIC character values - this is not
|
* `printf(3)`ing console messages stored as
|
||||||
|
[EBCDIC](https://en.wikipedia.org/wiki/EBCDIC) character values - this is not
|
||||||
an attempt at encryption, but rather at cross platform compatibility.
|
an attempt at encryption, but rather at cross platform compatibility.
|
||||||
* ASCII character values are calculated from the EBCDIC in a particularly ugly
|
* [ASCII](https://en.wikipedia.org/wiki/ASCII) character values are calculated
|
||||||
abuse of the '?' operator.
|
from the EBCDIC in a particularly ugly abuse of the `?:` operator.
|
||||||
* Detection of whether to print the ASCII or EBCDIC values is done by taking the
|
* Detection of whether to print the ASCII or EBCDIC values is done by taking the
|
||||||
remainder of dividing the character `'J'` by `2` - the ASCII value of the
|
remainder of dividing the character `'J'` by `2` - the ASCII value of the
|
||||||
character is even, the EBCDIC value is odd.
|
character is even, the EBCDIC value is odd.
|
||||||
* The messages to be `printf`ed are determined via multiple table lookups and
|
* The messages to be `printf(3)`ed are determined via multiple table lookups and
|
||||||
bit-masked values.
|
bit-masked values.
|
||||||
* For minutes, the bit position turned on is multiplied by two to determine the
|
* For minutes, the bit position turned on is multiplied by two to determine the
|
||||||
message to be `printf`ed.
|
message to be `printf(3)`ed.
|
||||||
* For hours, the straight bit position is used.
|
* For hours, the straight bit position is used.
|
||||||
* This entry mostly eschews function calls for the often overlooked
|
* This entry mostly eschews function calls for the often overlooked
|
||||||
setjmp/longjmp combination.
|
`setjmp(3)`/`longjmp(3)` combination.
|
||||||
* The trigraphs are not there as obfuscation nor are they there to annoy the
|
* The trigraphs are not there as obfuscation nor are they there to annoy the
|
||||||
judges - it's just the easiest way to get around the absence of square brackets
|
judges - it's just the easiest way to get around the absence of square brackets
|
||||||
in a normal 3270 environment.
|
in a normal 3270 environment.
|
||||||
|
|||||||
Reference in new issue
Block a user