Merge pull request #395 from xexyl/1998-schnitzi
This commit is contained in:
3 files changed
+50
-45
No files matched your search
+47
-34
@@ -1,47 +1,56 @@
|
||||
# Best Flow Control:
|
||||
# Best Flow Control
|
||||
|
||||
Mark Schnitzius
|
||||
ISX Corporation
|
||||
1280 West Peachtree St. Apt. 1507
|
||||
Atlanta, GA 30309
|
||||
USA
|
||||
|
||||
http://east.isx.com/~schnitzi/
|
||||
Mark Schnitzius
|
||||
ISX Corporation
|
||||
1280 West Peachtree St. Apt. 1507
|
||||
Atlanta, GA 30309
|
||||
USA
|
||||
<http://computronium.org/ioccc.html>
|
||||
|
||||
## To build:
|
||||
|
||||
make all
|
||||
```sh
|
||||
make all
|
||||
```
|
||||
|
||||
## To run
|
||||
## To run:
|
||||
|
||||
./schnitzi 5 > sort.c
|
||||
make sort
|
||||
```sh
|
||||
./schnitzi 5 > sort.c
|
||||
make sort
|
||||
```
|
||||
|
||||
## Try:
|
||||
|
||||
./schnitzi 3 > sort.c
|
||||
make sort
|
||||
echo 123 > data
|
||||
echo 234 >> data
|
||||
echo 413 >> data
|
||||
echo 134 >> data
|
||||
echo 324 >> data
|
||||
./sort < data
|
||||
```sh
|
||||
./schnitzi 3 > sort.c
|
||||
make sort
|
||||
echo 123 > data
|
||||
echo 234 >> data
|
||||
echo 413 >> data
|
||||
echo 134 >> data
|
||||
echo 324 >> data
|
||||
./sort < data
|
||||
```
|
||||
|
||||
[Cody Boone Ferguson](/winners.html#Cody_Boone_Ferguson) fixed invalid data
|
||||
types which prevented this entry from working. There are two other segfaults
|
||||
that should not be fixed and they are discussed in [bugs.md](/bugs.md). Thank
|
||||
you Cody for your assistance!
|
||||
types which prevented this entry from working, causing a segfault. This showed
|
||||
itself in two parts which required two fixes, one for linux and further changes
|
||||
for macOS. He also fixed a segfault (after printing garbage) when the arg
|
||||
specified evaluated to 0. Thank you Cody for your assistance!
|
||||
|
||||
NOTE: the larger the number the number of lines of output can become
|
||||
substantially higher as well. Doing `./schnitzi 9` will actually print 771999
|
||||
### INABIAF - it's not a bug it's a feature
|
||||
|
||||
NOTE: the larger the number given to the program the longer the output becomes
|
||||
and quite substantially so. Doing `./schnitzi 9` will actually print 771999
|
||||
lines!
|
||||
|
||||
|
||||
## Judges' comments
|
||||
## Judges' remarks:
|
||||
|
||||
This is a beautiful program. How can a program with no conditional
|
||||
behavior at all have output which depends on anything?
|
||||
This is a beautiful program. How can a program with no conditional (except for
|
||||
the fixes for modern systems made by Cody) behavior at all have output which
|
||||
depends on anything?
|
||||
|
||||
For hints on deciphering this, see below past the Author's Comments;
|
||||
they're a nice summary, but they leave the mystery intact.
|
||||
@@ -52,7 +61,7 @@ letter E in the story. He did not note this but it has over 50000 (50 thousand)
|
||||
(!!) words without the letter E which is one of the most common letters!
|
||||
|
||||
|
||||
## Author's comments
|
||||
## Author's remarks:
|
||||
|
||||
In literary circles, there is a poetic form called a "lipogram",
|
||||
which is a poem in which a specific letter has been distinctly
|
||||
@@ -87,15 +96,19 @@ a depth of one.
|
||||
So what does it do? Give it an integer (1 < n < 27) on the command
|
||||
line, such as
|
||||
|
||||
./schnitzi 5
|
||||
```sh
|
||||
./schnitzi 5
|
||||
```
|
||||
|
||||
The output will itself be a lipographic program, one which inputs
|
||||
(in this case) five numbers and prints them out sorted. It sorts
|
||||
them, however, using only "if/else" statements, without arrays or
|
||||
looping. To see the resulting program run, redirect the output from
|
||||
"schnitzi" into another file, like this
|
||||
`schnitzi` into another file, like this
|
||||
|
||||
schnitzi 4 > sort.c
|
||||
```sh
|
||||
schnitzi 4 > sort.c
|
||||
```
|
||||
|
||||
and then compile it.
|
||||
|
||||
@@ -105,10 +118,10 @@ The big key to this program is figuring out what the names of the
|
||||
functions ought to be; a bit of research may allow you to guess at
|
||||
a few crucial ones.
|
||||
|
||||
The only function ever called is "O", but "O" is just set to point to
|
||||
The only function ever called is `O`, but `O` is just set to point to
|
||||
other functions all the time. Or, almost all the time.
|
||||
|
||||
So how does 'h' get set, and what to?
|
||||
So how does `h` get set, and what to?
|
||||
|
||||
## Copyright and CC BY-SA 4.0 License:
|
||||
|
||||
|
||||
@@ -52,5 +52,6 @@ void x_(){ O=g; *r=y[k-2]; _=r; j=o_; }
|
||||
void d (){ O=g; *r=y[k]; _=r; k=k+1; m=k<z; w=_t; l=p_; j=p; }
|
||||
void y_(){ O=g; *r=x[17][1]+k; _=r; j=q_; }
|
||||
void r_(){ O=_b; _=x[17]; s=(char**)_d; s=s+1; i=*s; q=0; }
|
||||
main(int v,char **V){ O=r_; _d=V;
|
||||
x: (O)(); goto x; }
|
||||
main(int v,char **V){ if (V[1]) {if(atoi(V[1])!=0) {
|
||||
q=0; O=r_; _d=V;
|
||||
x: (O)(); goto x; }}}
|
||||
@@ -764,15 +764,6 @@ $ ./schnitzi 9|wc -l
|
||||
771999
|
||||
```
|
||||
|
||||
There are two segfaults that were initially fixed but the fixes were undone to
|
||||
make the entry as close to possible as the original. These should not be fixed
|
||||
either:
|
||||
|
||||
- if one does not specify an arg the program will crash.
|
||||
- if the arg had any characters that were not digits 1 - 9 it will show invalid
|
||||
output and then crash. If it starts with 0 it can work as long as another digit
|
||||
follows it and there are no other non-digits.
|
||||
|
||||
|
||||
# 1999
|
||||
|
||||
|
||||
Reference in new issue
Block a user