Add 1989/robison/try.sh
Also updated bugs.md with another case where the program might 'break into tiny bits' but as a feature not a bug. Checking the source code will give all you need to know about the 'problem' quite well.
This commit is contained in:
1 parent
4238aac1ac
commit
3267c2e625
4 files changed
+52
-16
No files matched your search
+6
-16
@@ -29,27 +29,17 @@ For more detailed information see [1989 robison in bugs.md](/bugs.md#1989-robiso
|
||||
```sh
|
||||
./robison
|
||||
11x10
|
||||
# enter other expressions
|
||||
|
||||
echo 1x10x111 | ./robison
|
||||
|
||||
echo 1+1+10 | ./robison
|
||||
|
||||
echo 100 - 1 | ./robison
|
||||
|
||||
echo -100 x 100 + 1 | ./robison
|
||||
./try.sh
|
||||
|
||||
echo 100 / 100 | ./robison # <-- what happens here ?
|
||||
```
|
||||
|
||||
NOTE: This program will very likely crash or break into tiny bits
|
||||
:-) if you feed it numbers with non-binary digits.
|
||||
|
||||
This is 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.
|
||||
```
|
||||
NOTE: This program will very likely crash or break into tiny bits :-) if you
|
||||
feed it numbers with non-binary digits. This, as you might notice if you try one
|
||||
of the above commands, can happen with other input as well. If you wish to
|
||||
understand why this happens check the source code.
|
||||
|
||||
|
||||
## Judges' remarks:
|
||||
|
||||
Executable
+41
@@ -0,0 +1,41 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# try.sh - demonstrate IOCCC winner 1989/robison
|
||||
#
|
||||
|
||||
# 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
|
||||
|
||||
read -r -n 1 -p "Press any key to run: echo 1x10x111 | ./robison: "
|
||||
echo 1>&2
|
||||
echo 1x10x111 | ./robison
|
||||
echo 1>&2
|
||||
|
||||
read -r -n 1 -p "Press any key to run: echo 1+1+10 | ./robison: "
|
||||
echo 1>&2
|
||||
echo 1+1+10 | ./robison
|
||||
echo 1>&2
|
||||
|
||||
read -r -n 1 -p "Press any key to run: echo 100 - 1 | ./robison: "
|
||||
echo 1>&2
|
||||
echo 100 - 1 | ./robison
|
||||
echo 1>&2
|
||||
|
||||
read -r -n 1 -p "Press any key to run: echo -100 x 100 + 1 | ./robison: "
|
||||
echo 1>&2
|
||||
echo -100 x 100 + 1 | ./robison
|
||||
echo 1>&2
|
||||
|
||||
read -r -n 1 -p "Press any key to run: echo 101x111-100 | ./robison: "
|
||||
echo 1>&2
|
||||
echo 101x111-100 | ./robison
|
||||
echo 1>&2
|
||||
Reference in new issue
Block a user