Merge pull request #2095 from xexyl/mills22015-try

Improve 2015/mills2/try.sh
This commit is contained in:
Landon Curt Noll authored and GitHub committed 2024-01-29 15:41:57 -08:00
commit 2e2b52e02d
21 files changed
+391 -175

No files matched your search

+6 -27
View File
@@ -32,43 +32,22 @@ endoh3()
fi
if [[ -f "$1" && -r "$1" ]]; then
if [[ -n "$SOX" ]]; then
echo "$ cat $1 | ./endoh3 | $SOX -q -traw -r8000 -b8 -e unsigned-integer - -tcoreaudio" 1>&2
echo "$ ./endoh3 < $1 | $SOX -q -traw -r8000 -b8 -e unsigned-integer - -tcoreaudio" 1>&2
read -r -n 1 -p "Press any key to continue: "
echo 1>&2
# The author suggested the form below and it simplifies the command
# as well so we disable the supposed useless cat (there are no
# useless cats).
#
# SC2002 (style): Useless cat. Consider 'cmd < file | ..' or 'cmd file | ..' instead.
# https://www.shellcheck.net/wiki/SC2002
# shellcheck disable=SC2002
cat "$1" | ./endoh3 | "$SOX" -q -traw -r8000 -b8 -e unsigned-integer - -tcoreaudio
./endoh3 < "$1" | "$SOX" -q -traw -r8000 -b8 -e unsigned-integer - -tcoreaudio
echo 1>&2
elif [[ -n "$PADSP" ]]; then
echo "$ cat $1 | ./endoh3 | $PADSP tee /dev/dsp > /dev/null" 1>&2
echo "$ ./endoh3 < $1 | $PADSP tee /dev/dsp > /dev/null" 1>&2
read -r -n 1 -p "Press any key to continue: "
echo 1>&2
# The author suggested the form below and it simplifies the command
# as well so we disable the supposed useless cat (there are no
# useless cats).
#
# SC2002 (style): Useless cat. Consider 'cmd < file | ..' or 'cmd file | ..' instead.
# https://www.shellcheck.net/wiki/SC2002
# shellcheck disable=SC2002
cat "$1" | ./endoh3 | "$PADSP" tee /dev/dsp > /dev/null
./endoh3 < "$1" | "$PADSP" tee /dev/dsp > /dev/null
echo 1>&2
elif [[ -n "$RUBY" ]]; then
echo "$ cat $1 | ./endoh3 | $RUBY wavify.rb > $1.wav" 1>&2
echo "$ ./endoh3 < $1 | $RUBY wavify.rb > $1.wav" 1>&2
read -r -n 1 -p "Press any key to continue: "
echo 1>&2
# The author suggested the form below and it simplifies the command
# as well so we disable the supposed useless cat (there are no
# useless cats).
#
# SC2002 (style): Useless cat. Consider 'cmd < file | ..' or 'cmd file | ..' instead.
# https://www.shellcheck.net/wiki/SC2002
# shellcheck disable=SC2002
cat "$1" | ./endoh3 | "$RUBY" wavify.rb > "$1".wav
./endoh3 < "$1" | "$RUBY" wavify.rb > "$1".wav
echo "Now try playing $1.wav in a program that plays WAV files." 1>&2
echo 1>&2
else
+1 -1
View File
@@ -8,4 +8,4 @@ indent.o
prog
prog.alt
prog.orig
prog.raw
*.raw
+1 -1
View File
@@ -203,7 +203,7 @@ clean:
clobber: clean
${RM} -f ${TARGET} ${ALT_TARGET}
${RM} -rf *.dSYM
${RM} -f audio_file.raw prog.raw
${RM} -f *.raw
@-if [ -e sandwich ]; then \
${RM} -f sandwich; \
echo 'ate sandwich'; \
+4 -4
View File
@@ -23,16 +23,16 @@ For more detailed information see [2014 vik in bugs.md](/bugs.md#2014-vik).
## To use:
```sh
./prog > foo.c
echo foo | ./prog > audio_file.raw
echo foo | ./prog | mplayer -demuxer rawaudio -
```
## Try:
```sh
echo 'Want to hear me beep?' | ./prog > audio_file.raw
echo 'No. I want chocolate!' | ./prog | mplayer -demuxer rawaudio -
./try.sh
```
+70
View File
@@ -0,0 +1,70 @@
#!/usr/bin/env bash
#
# try.sh - demonstrate IOCCC winner 2014/vik
#
# 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
# remove target files for saving them
rm -f beep.raw chocolate.raw
write_to_raw()
{
if [[ "$#" -ne 2 ]]; then
echo "$0: usage: write_to_raw file arg" 1>&2
return
fi
read -r -n 1 -p "Press any key to run: echo $2 | ./prog > $1.raw: "
echo "$2" | ./prog > "$1".raw
}
# now determine if we have mplayer(1)
MPLAYER="$(type -P mplayer)"
if [[ -n "$MPLAYER" ]]; then
read -r -n 1 -p "Press any key to play: 'Want to hear me beep?': "
echo 1>&2
echo "$ echo 'Want to hear me beep?' | ./prog | mplayer -demuxer rawaudio -" 1>&2
echo 'Want to hear me beep?' | ./prog | mplayer -demuxer rawaudio -
echo 1>&2
read -r -n 1 -p "Press any key to run: ./prog e < beep.raw: "
echo 1>&2
./prog e < beep.raw
echo 1>&2
read -r -n 1 -p "Press any key to play: 'No. I want chocolate!': "
echo 1>&2
echo "$ echo 'No. I want chocolate!' | ./prog | mplayer -demuxer rawaudio - | tee chocolate.raw" 1>&2
echo 'No. I want chocolate!' | ./prog | mplayer -demuxer rawaudio - | tee chocolate.raw
read -r -n 1 -p "Press any key to run: ./prog e < chocolate.raw: "
echo 1>&2
fi
read -r -n 1 -p "Press any key to run: echo 'Want to hear me beep?' | ./prog > beep.raw: "
echo 1>&2
echo 'Want to hear me beep?' | ./prog > beep.raw
echo 1>&2
read -r -n 1 -p "Press any key to run: ./prog e < beep.raw: "
echo 1>&2
./prog e < beep.raw
echo 1>&2
read -r -n 1 -p "Press any key to run: echo 'No. I want chocolate!' | ./prog > chocolate.raw: "
echo 1>&2
echo 'No. I want chocolate!' | ./prog > chocolate.raw
echo 1>&2
read -r -n 1 -p "Press any key to run: ./prog e < chocolate.raw: "
echo 1>&2
./prog e < chocolate.raw
+29 -18
View File
@@ -15,41 +15,52 @@ make CC="$CC" all >/dev/null || exit 1
# clear screen after compilation so that only the entry is shown
clear
echo "$ ./calc '?0x3343<<2'" 1>&2
read -r -n 1 -p "Press any key to run: ./calc '?0x3343<<2': "
echo 1>&2
./calc '?0x3343<<2'
echo 1>&2
echo "$ echo '?0x3343<<2' | ./ecalc" 1>&2
read -r -n 1 -p "Press any key to run: echo '?0x3343<<2' | ./ecalc: "
echo 1>&2
echo '?0x3343<<2' | ./ecalc
echo "$ grep '[0-9]' prog.c" 1>&2
read -r -n 1 -p "Press any key to continue (notice how there are no digits!): "
echo 1>&2
grep -c '[0-9]' prog.c
read -r -n 1 -p "Press any key to run: ./calc < test.in: "
echo 1>&2
./calc < test.in
echo 1>&2
read -r -n 1 -p "Press any key to show try.this.txt: "
read -r -n 1 -p "Press any key to run: grep '[0-9]' prog.c || echo \"no digits in prog.c!\": "
echo 1>&2
cat try.this.txt
grep -q '[0-9]' prog.c || echo "no digits in prog.c!"
echo 1>&2
read -r -n 1 -p "Press any key to show calc.in (space = next page, q = quit): "
echo 1>&2
less -rEXFK test.in
echo 1>&2
read -r -n 1 -p "Press any key to run: ./calc < test.in (space = next page, q = quit): "
echo 1>&2
./calc < test.in | less -rEXFK
echo 1>&2
read -r -n 1 -p "Press any key to show try.this.txt (space = next page, q = quit): "
echo 1>&2
less -rEXFK try.this.txt
echo 1>&2
read -r -n 1 -p "Press any key to run: ./calc < try.this.txt: "
echo 1>&2
./calc < try.this.txt
read -r -n 1 -p "Press any key to show the hex value of 42: "
read -r -n 1 -p "Press any key to run: ./calc 42 # show hex value of 42: "
echo 1>&2
echo "$ ./calc 42" 1>&2
./calc 42
echo 1>&2
read -r -n 1 -p "Press any key to run: ./calc '1<<22-1' (show mask value for 22 bits): "
read -r -n 1 -p "Press any key to run: ./calc '1<<22-1' # show mask value for 22 bits: "
echo 1>&2
./calc '1<<22-1'
echo 1>&2
read -r -n 1 -p "Press any key to run: ./calc ?0x11223344 (byte-swapped value of 0x11223344): "
read -r -n 1 -p "Press any key to run: ./calc ?0x11223344 # byte-swapped value of 0x11223344: "
echo 1>&2
./calc ?0x11223344
echo 1>&2
+4
View File
@@ -21,6 +21,10 @@ echo Some text | ./prog
./try.sh
```
As the script says if you want to move to the next command at any point
(lorem-ipsum.txt takes a while to print in particular) you may do so by hitting
ctrl-c/sending intr.
## Alternate code:
+42 -6
View File
@@ -15,24 +15,60 @@ make CC="$CC" all >/dev/null || exit 1
# clear screen after compilation so that only the entry is shown
clear
echo "$ echo \"Hello, world!\" | ./prog" 1>&2
# set it so that when program is terminated through various signals we re-enable
# the cursor
trap "tput cnorm;echo" 0 1 2 3 15
# temporarily disable cursor
tput civis
echo "If you wish to move to the next command during the output of the current" 1>&2
echo "you may send ctrl-c/intr to do so. This might be especially useful if you" 1>&2
echo "get tired of watching lorem-ipsum.txt." 1>&2
echo 1>&2
read -r -n 1 -p "Press any key to run: echo \"Hello, world!\" | ./prog: "
echo 1>&2
echo "Hello, world!" | ./prog
echo 1>&2
echo "$ echo \"IOCCC 2015\" | ./prog" 1>&2
read -r -n 1 -p "Press any key to run: echo \"IOCCC 2015\" | ./prog: "
echo 1>&2
echo "IOCCC 2015" | ./prog
echo 1>&2
echo "$ DRAFT=1 ./prog < prog.c" 1>&2
read -r -n 1 -p "Press any key to show prog.c (space = next page, q = quit): "
echo 1>&2
less -rEXFK prog.c
echo 1>&2
read -r -n 1 -p "Press any key to run: DRAFT=1 ./prog < prog.c: "
echo 1>&2
DRAFT=1 ./prog < prog.c
echo 1>&2
echo "$ ./prog < prog.c" 1>&2
read -r -n 1 -p "Press any key to run: ./prog < prog.c: "
echo 1>&2
./prog < prog.c
echo 1>&2
echo "$ ./prog < lorem-ipsum.txt" 1>&2
read -r -n 1 -p "Press any key to show lorem-ipsum.txt (space = next page, q = quit): "
echo 1>&2
less -rEXFK lorem-ipsum.txt
echo 1>&2
read -r -n 1 -p "Press any key to run: ./prog < lorem-ipsum.txt: "
echo 1>&2
./prog < lorem-ipsum.txt
echo 1>&2
echo "Type in text, hitting enter after each line." 1>&2
echo "Watch the output each time and try again." 1>&2
echo "Hit ctrl-c to exit." 1>&2
echo 1>&2
echo "$ ./prog" 1>&2
read -r -n 1 -p "Press any key to start: "
echo 1>&2
./prog
# make sure to re-enable cursor
tput cnorm
+14 -6
View File
@@ -15,20 +15,28 @@ make CC="$CC" all >/dev/null || exit 1
# clear screen after compilation so that only the entry is shown
clear
echo "$ cat prog.c" 1>&2
read -r -n 1 -p "Press any key to run: cat prog.c: "
echo 1>&2
cat prog.c
echo 1>&2
echo "$ ./prog | diff -s - prog.c"
./prog | diff -s - prog.c
read -r -n 1 -p "Press any key to run: ./prog: "
echo 1>&2
./prog
echo 1>&2
echo "$ less -EXF prog.c" 1>&2
read -r -n 1 -p "Press any key to continue: "
read -r -n 1 -p "Press any key to run: less -rEXFK prog.c: "
echo 1>&2
less -EXF prog.c
echo 1>&2
echo "$ wc -c prog.c" 1>&2
read -r -n 1 -p "Press any key to run: ./prog | diff -s - prog.c: "
echo 1>&2
./prog | diff -s - prog.c
echo 1>&2
read -r -n 1 -p "Press any key to run: wc -c prog.c: "
echo 1>&2
wc -c prog.c
echo 1>&2
echo "Can you figure out the inconsistencies?" 1>&2
+6 -8
View File
@@ -13,24 +13,22 @@ fi
# clear screen so that only the entry is shown
clear
read -r -n 1 -p "Press any key to run: less -EXF prog.c (space = next page, q = quit): "
read -r -n 1 -p "Press any key to run: less -rEXFK prog.c (space = next page, q = quit): "
echo 1>&2
less -EXF prog.c
echo 1>&2
echo "$ make future" 1>&2
read -r -n 1 -p "Press any key to: make future: "
echo 1>&2
make future || exit 1
echo 1>&2
echo 1>&2
echo "Will go back to the future and run 1984/mullender through prog. To quit" 1>&2
echo "the program hit ctrl-c/intr." 1>&2
echo "the program hit ctrl-c/intr. We suggest you try hitting enter or another" 1>&2
echo "key when the output reaches the end of the line." 1>&2
echo 1>&2
echo "You might want to try hitting enter or another key when the output reaches" 1>&2
echo "the end of the line." 1>&2
echo 1>&2
read -r -n 1 -p "Press any key to continue: "
read -r -n 1 -p "Press any key to run: ./prog: "
echo 1>&2
echo "$ ./prog" 1>&2
./prog
+31 -14
View File
@@ -15,44 +15,61 @@ make CC="$CC" all >/dev/null || exit 1
# clear screen after compilation so that only the entry is shown
clear
# check if perl is installed (for later)
PERL="$(type -P perl)"
echo "$ ./prog @" 1>&2
read -r -n 1 -p "Press any key to run: ./prog @: "
echo 1>&2
./prog @
echo 1>&2
echo "$ ./prog @ @" 1>&2
read -r -n 1 -p "Press any key to run: ./prog @ @: "
echo 1>&2
./prog @ @
echo 1>&2
echo "$ ./prog @ @ @" 1>&2
read -r -n 1 -p "Press any key to run: ./prog @ @ @: "
echo 1>&2
./prog @ @ @
echo 1>&2
echo "$ ./prog @ @ @ @ @" 1>&2
read -r -n 1 -p "Press any key to run: ./prog @ @ @ @ @: "
echo 1>&2
./prog @ @ @ @ @
echo 1>&2
echo "$ ./prog @ @ @ @ @ @" 1>&2
read -r -n 1 -p "Press any key to run: ./prog @ @ @ @ @ @: "
echo 1>&2
./prog @ @ @ @ @ @
echo 1>&2
echo "$ ./prog @ @ @ @ @ @ @" 1>&2
read -r -n 1 -p "Press any key to run: ./prog @ @ @ @ @ @ @: "
echo 1>&2
./prog @ @ @ @ @ @ @
echo 1>&2
echo "$ ./prog @ @ @ @ @ @ @ @" 1>&2
read -r -n 1 -p "Press any key to run: ./prog @ @ @ @ @ @ @ @: "
echo 1>&2
./prog @ @ @ @ @ @ @ @
echo 1>&2
echo "$ ./prog @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @" 1>&2
read -r -n 1 -p "Press any key to run: ./prog @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @: "
echo 1>&2
./prog @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @
echo 1>&2
echo "$ ./prog @ @ @ @ @ @ @ @ @ @ @ @" 1>&2
read -r -n 1 -p "Press any key to run: ./prog @ @ @ @ @ @ @ @ @ @ @ @: "
echo 1>&2
./prog @ @ @ @ @ @ @ @ @ @ @ @
echo 1>&2
echo "$ ./prog \"\$(< Makefile)\"" 1>&2
read -r -n 1 -p "Press any key to continue: "
read -r -n 1 -p "Press any key to run: ./prog \"\$(< Makefile)\": "
echo 1>&2
./prog "$(< Makefile)"
echo 1>&2
if [[ -n "$PERL" ]]; then
echo "$ ./prog \$($PERL -e 'print "@ " x (2*3*5*7);')" 1>&2
read -r -n 1 -p "Press any key to continue: "
read -r -n 1 -p "Press any key to run: ./prog \"\$($PERL -e 'print \"@ \" x (2*3*5*7);')\": "
echo 1>&2
./prog "$($PERL -e 'print "@ " x (2*3*5*7);')"
fi
+1 -1
View File
@@ -27,7 +27,7 @@ echo something | ./prog
## Try:
```sh
echo "" | ./prog
./try.sh
```
+27 -10
View File
@@ -16,30 +16,47 @@ make CC="$CC" all >/dev/null || exit 1
clear
echo "$ echo IOCCC | ./prog" 1>&2
read -r -n 1 -p "Press any key to run: echo IOCCC | ./prog: "
echo 1>&2
echo IOCCC | ./prog
echo 1>&2
echo "$ ./prog < rfc1321.txt" 1>&2
./prog < rfc1321.txt
read -r -n 1 -p "Press any key to run: head -n 13 rfc1321.txt (space = next page, q = quit): "
echo 1>&2
head rfc1321.txt -n 13 | less -rEXFK
echo 1>&2
echo "$ echo \"\" | ./prog" 1>&2
read -r -n 1 -p "Press any key to run: ./prog < rfc1321.txt: "
echo 1>&2
./prog < rfc1321.txt | less -rEXFK
echo 1>&2
read -r -n 1 -p "Press any key to run: echo \"\" | ./prog: "
echo 1>&2
echo "" | ./prog
echo 1>&2
echo "For the next two, observe the magical values: "
read -r -n 1 -p "Press any key to continue: "
read -r -n 1 -p "Press any key to show prog.c (space = next page, q = quit): "
echo 1>&2
less -rEXFK prog.c
echo 1>&2
echo "For the next two, observe the magical values."
echo 1>&2
read -r -n 1 -p "Press any key to run: ./prog < prog.c | cut -c-5: "
echo 1>&2
echo "$ ./prog < prog.c | cut -c-5" 1>&2
./prog < prog.c | cut -c-5
echo "$ ./prog < Makefile | cut -c-4" 1>&2
read -r -n 1 -p "Press any key to run: ./prog < Makefile | cut -c-4: "
echo 1>&2
./prog < Makefile | cut -c-4
echo 1>&2
echo "$ wc -c large" 1>&2
read -r -n 1 -p "Press any key to run: wc -c large: "
echo 1>&2
wc -c large
echo 1>&2
echo "$ ./prog < large" 1>&2
read -r -n 1 -p "Press any key to run: ./prog < large: "
echo 1>&2
./prog < large
+1 -20
View File
@@ -1,31 +1,12 @@
#
# sort with: sort -d -u
123.tmp
1.tmp
ABCABBA.tmp
ABCDEFGHIJK.tmp
ABCDEF.tmp
ABCDE.tmp
ABCD.tmp
ABCEFGIJKDEFGHIJK.tmp
ABD.tmp
ABXYEFCD.tmp
ACBDEACBED.tmp
ACDBECFD.tmp
ACEBDABBABED.tmp
A.tmp
CBABAC.tmp
EMPTY.tmp
curds.tmp
*.dSYM
indent
indent.c
indent.o
makeholes
nuked.tmp
patch.tmp
prog
prog.alt
prog.orig
*.tmp
war-and-peace.txt
whey.tmp
+1 -1
View File
@@ -214,7 +214,7 @@ clean:
clobber: clean
${RM} -f ${TARGET} ${ALT_TARGET}
${RM} -rf *.dSYM
${RM} -f curds.tmp nuked.tmp whey.tmp makeholes
${RM} -f makeholes *.tmp
@-if [ -e sandwich ]; then \
${RM} -f sandwich; \
echo 'ate sandwich'; \
+66 -10
View File
@@ -16,22 +16,78 @@ make CC="$CC" all >/dev/null || exit 1
clear
read -r -n 1 -p "Press any key to run: ./prog prog.alt.c prog.c: "
echo 1>&2
./prog prog.alt.c prog.c
echo 1>&2
make test
read -r -n 1 -p "Press any key to run: make test (space = next page, q = quit): "
echo 1>&2
make test | less -rEXFK
echo 1>&2
read -r -n 1 -p "Press any key to run: ./prog -d ABXYEFCD.tmp ACDBECFD.tmp: "
echo 1>&2
./prog -d ABXYEFCD.tmp ACDBECFD.tmp
echo 1>&2
read -r -n 1 -p "Press any key to run: ./prog ABXYEFCD.tmp ACDBECFD.tmp: "
echo 1>&2
./prog ABXYEFCD.tmp ACDBECFD.tmp
echo 1>&2
rm -f curds.tmp whey.tmp
cp -f cc.1 curds.tmp
cp -f cc.1 whey.tmp
chmod 666 whey.tmp
make makeholes
./makeholes -n 1000 whey.tmp
./prog curds.tmp whey.tmp
./avgtime.sh 100 ./prog curds.tmp whey.tmp
read -r -n 1 -p "Press any key to run: cp -vf cc.1 curds.tmp: "
echo 1>&2
cp -vf cc.1 curds.tmp
echo 1>&2
read -r -n 1 -p "Press any key to run: cp -vf cc.1 whey.tmp: "
echo 1>&2
cp -vf cc.1 whey.tmp
cp -f war-and-peace.txt nuked.tmp
read -r -n 1 -p "Press any key to run: chmod -v 666 whey.tmp: "
echo 1>&2
chmod -v 666 whey.tmp
echo 1>&2
if [[ ! -x makeholes ]]; then
read -r -n 1 -p "Press any key to run: make makeholes: "
echo 1>&2
make makeholes
echo 1>&2
fi
read -r -n 1 -p "Press any key to run: ./makeholes -n 1000 whey.tmp: "
echo 1>&2
./makeholes -n 1000 whey.tmp
echo 1>&2
read -r -n 1 -p "Press any key to run: ./prog curds.tmp whey.tmp (space = next page, q = quit): "
echo 1>&2
./prog curds.tmp whey.tmp | less -rEXFK
echo 1>&2
read -r -n 1 -p "Press any key to run: ./avgtime.sh 100 ./prog curds.tmp whey.tmp: "
echo 1>&2
./avgtime.sh 100 ./prog curds.tmp whey.tmp
echo 1>&2
read -r -n 1 -p "Press any key to run: cp -vf war-and-peace.txt nuked.tmp: "
echo 1>&2
cp -vf war-and-peace.txt nuked.tmp
echo 1>&2
read -r -n 1 -p "Press any key to run: ./makeholes -c'~' -n 1000 nuked.tmp: "
echo 1>&2
./makeholes -c'~' -n 1000 nuked.tmp
./prog war-and-peace.txt nuked.tmp
echo 1>&2
read -r -n 1 -p "Press any key to run: ./prog war-and-peace.txt nuked.tmp (space = next page, q = quit): "
echo 1>&2
./prog war-and-peace.txt nuked.tmp | less -rEXFK
echo 1>&2
read -r -n 1 -p "Press any key to run: ./avgtime.sh 100 ./prog war-and-peace.txt nuked.tmp: "
echo 1>&2
./avgtime.sh 100 ./prog war-and-peace.txt nuked.tmp
echo 1>&2
+24 -20
View File
@@ -15,47 +15,51 @@ make CC="$CC" all >/dev/null || exit 1
# clear screen after compilation so that only the entry is shown
clear
echo "$ printf '000I\236\f\31H\260\240\301\203' > ioccc.Z" 1>&2
read -r -n 1 -p "Press any key to run: printf '000I\236\f\31H\260\240\301\203' > ioccc.Z: "
echo 1>&2
printf '000I\236\f\31H\260\240\301\203' > ioccc.Z
echo 1>&2
echo "$ ./prog ioccc.Z" 1>&2
read -r -n 1 -p "Press any key to run: ./prog ioccc.Z: "
echo 1>&2
./prog ioccc.Z
echo 1>&2
echo "$ dd bs=512 count=128 < /dev/urandom > test1" 1>&2
read -r -n 1 -p "Press any key to run: dd bs=512 count=128 < /dev/urandom > test1: "
echo 1>&2
dd bs=512 count=128 < /dev/urandom > test1
echo 1>&2
echo "$ compress < test1 > test1.Z" 1>&2
read -r -n 1 -p "Press any key to run: compress < test1 > test1.Z: "
echo 1>&2
compress < test1 > test1.Z
echo 1>&2
echo "$ time ./prog test1.Z | cmp - test1" 1>&2
time ./prog test1.Z | cmp - test1
read -r -n 1 -p "Press any key to run: time ./prog test1.Z | diff -s - test1: "
echo 1>&2
time ./prog test1.Z | diff -s - test1
echo 1>&2
echo "$ dd bs=512 count=128 < /dev/zero > test2" 1>&2
read -r -n 1 -p "Press any key to run: dd bs=512 count=128 < /dev/zero > test2: "
echo 1>&2
dd bs=512 count=128 < /dev/zero > test2
echo 1>&2
echo "$ compress < test2 > test2.Z" 1>&2
read -r -n 1 -p "Press any key to run: compress < test2 > test2.Z: "
echo 1>&2
compress < test2 > test2.Z
echo 1>&2
echo "$ time ./prog test2.Z | cmp - test2" 1>&2
time ./prog test2.Z | cmp - test2
read -r -n 1 -p "Press any key to run: time ./prog test2.Z | diff -s - test2: "
echo 1>&2
time ./prog test2.Z | diff -s - test2
echo 1>&2
read -r -n 1 -p "Press any key to run: ./prog ioccc_guidelines.txt.Z (space = next page, q = quit): "
echo 1>&2
./prog ioccc_guidelines.txt.Z | less -rEXFK
echo 1>&2
echo "$ ./prog ioccc_guidelines.txt.Z" 1>&2
read -r -n 1 -p "Press any key to continue (space = next page, q = quit): "
read -r -n 1 -p "Press any key to run: ./prog ioccc_rules.txt.Z (space = next page, q = quit): "
echo 1>&2
./prog ioccc_guidelines.txt.Z | less -EXF
echo 1>&2
echo "$ ./prog ioccc_rules.txt.Z" 1>&2
read -r -n 1 -p "Press any key to continue (space = next page, q = quit): "
echo 1>&2
./prog ioccc_rules.txt.Z | less -EXF
./prog ioccc_rules.txt.Z | less -rEXFK
+5 -7
View File
@@ -19,16 +19,15 @@ clear
echo "$ make -B V=2 run" 1>&2
read -r -n 1 -p "Press any key to continue (space = next page, q = quit): "
echo 1>&2
make CC="${CC}" -B V=2 run | less -EXF
read -r -n 1 -p "Press any key to run: make CC=${CC} -B V=2 run (space = next page, q = quit): "
echo 1>&2
make CC="${CC}" -B V=2 run | less -rEXFK
echo 1>&2
echo "$ strings prog | grep '(,)'" 1>&2
read -r -n 1 -p "Press any key to continue (space = next page, q = quit): "
read -r -n 1 -p "Press any key to run: strings prog | grep '(,)' (space = next page, q = quit): "
echo 1>&2
strings prog | grep '(,)' | less -EXF
echo 1>&2
echo 1>&2
for h in machine*.h; do
for t in tape*.h; do
@@ -37,9 +36,8 @@ for h in machine*.h; do
if [[ "$REPLY" == "q" || "$REPLY" == "Q" ]]; then
exit 0
fi
echo 1>&2
make -B MACHINE="$h" TAPE="$t" V=1 run
echo 1>&2
make CC="${CC}" -B MACHINE="$h" TAPE="$t" V=1 run
echo 1>&2
done
done
+10 -10
View File
@@ -20,32 +20,32 @@ echo "$ ./prog 19" 1>&2
read -r -n 1 -p "Press any key to run: ./prog 2410 (space = next page, q = quit): "
echo 1>&2
./prog 2410 | less -EXF
./prog 2410 | less -rEXFK
read -r -n 1 -p "Press any key to run: ./prog abfff (space = next page, q = quit): "
echo 1>&2
./prog abfff | less -EXF
./prog abfff | less -rEXFK
read -r -n 1 -p "Press any key to run: ./prog 27f8cebf (space = next page, q = quit): "
echo 1>&2
./prog 27f8cebf | less -EXF
./prog 27f8cebf | less -rEXFK
read -r -n 1 -p "Press any key to run: ./prog 246f8fddf (space = next page, q = quit): "
echo 1>&2
./prog 246f8fddf | less -EXF
./prog 246f8fddf | less -rEXFK
read -r -n 1 -p "Press any key to run: ./prog 2e95ab51ffea9de (space = next page, q = quit): "
echo 1>&2
./prog 2e95ab51ffea9de | less -EXF
./prog 2e95ab51ffea9de | less -rEXFK
read -r -n 1 -p "Press any key to run: ./prog e6a5c22fd7bde9f (space = next page, q = quit): "
echo 1>&2
./prog e6a5c22fd7bde9f | less -EXF
./prog e6a5c22fd7bde9f | less -rEXFK
read -r -n 1 -p "Press any key to run: ./prog 1b7dd73a937485bf (space = next page, q = quit): "
echo 1>&2
./prog 1b7dd73a937485bf | less -EXF
./prog 1b7dd73a937485bf | less -rEXFK
read -r -n 1 -p "Press any key to run: ./prog 7d3237680d190a77e53751b (space = next page, q = quit): "
echo 1>&2
./prog 7d3237680d190a77e53751b | less -EXF
./prog 7d3237680d190a77e53751b | less -rEXFK
read -r -n 1 -p "Press any key to run: ./prog 302ab3d052fb87c06228d249581be0e4 (space = next page, q = quit): "
echo 1>&2
./prog 302ab3d052fb87c06228d249581be0e4 | less -EXF
./prog 302ab3d052fb87c06228d249581be0e4 | less -rEXFK
echo 1>&2
read -r -n 1 -p "Press any key to run ./prog with a googol (10^100) (space = next page, q = quit): "
echo 1>&2
./prog 1249AD2594C37CEB0B2784C4CE0BF38ACE408E211A7CAAB24308A82E8F10000000000000000000000000 | less -EXF
./prog 1249AD2594C37CEB0B2784C4CE0BF38ACE408E211A7CAAB24308A82E8F10000000000000000000000000 | less -rEXFK
+40 -7
View File
@@ -3199,17 +3199,50 @@ This program will very likely crash if no arg is given.
### Source code: [2014/vik/prog.c](2014/vik/prog.c)
### Information: [2014/vik/README.md](2014/vik/README.md)
[Cody Boone Ferguson](/winners.html#Cody_Boone_Ferguson) discovered a bug that
shows itself in some cases (it works in others) when working on his winning
[2020 Enigma machine](2020/ferguson2/prog.c) ('Most enigmatic') entry. See his
[README.md](2020/ferguson2/README.md) for details (search for `vik` in the
file).
[Cody Boone Ferguson](/winners.html#Cody_Boone_Ferguson) discovered a bug to do
with translating sound to text that shows itself in some cases (it works in
others) when working on his winning [2020 Enigma machine](2020/ferguson2/prog.c)
('Most enigmatic') entry. See his [README.md](2020/ferguson2/README.md) for
details (search for `vik` in the file). This one might be more of a limitation
but this is not known.
He provides a tip in testing the problem: it might help to use his Enigma
machine to find problems as it will allow you to verify what is correct and what
is not. Again see his README.md for details!
is not. Again see his README.md for details. However it is also possible to not
rely on the entry as the below shows. One should be able to do:
If you want to try and fix this (mis)feature, you are welcome to try.
```sh
echo 'No. I want chocolate!' | ./prog > chocolate.raw
./prog e < chocolate.raw
```
and get:
```
No. I want some chocolate!
```
but instead we get:
```
IT FHOCOLITE!
```
which is very wrong. If however one does:
```
echo IOCCC | ./prog > ioccc.raw
./prog e < ioccc.raw
```
they will properly get:
```
IOCCC
```
# 2015
+8 -4
View File
@@ -4182,7 +4182,11 @@ clean`) removes those files and so that they are ignored by `.gitignore`.
## <a name="2014_vik"></a>[2014/vik](/2014/vik/prog.c) ([README.md](/2014/vik/README.md))
[Cody](#cody) added an alternate version that is based on the author's remarks that will
[Cody](#cody) added the [try.sh](/2014/vik/try.sh) script. Cody notes that there
is a bug that will show itself as one of the features does not work right. The
translation of the raw audio to text is buggy in some cases.
Cody also added an alternate version that is based on the author's remarks that will
theoretically work for Microsoft Windows compilers (if anything works in Windows
:-) ). We have no way of testing this and if anything has changed since 2014
that would break it we do not know.
@@ -4225,9 +4229,9 @@ This was done for both the [prog.c](/2015/burton/prog.c) and
[prog.alt.c](/2015/burton/prog.alt.c). The Makefile was also updated to build
`eprog` and `eprog.alt` to make use of the feature more easily. Each is a new
target (first in `TARGET` and second in `ALT_TARGET`) which have a prerequisite
of `${PROG}` and `${PROG}.alt` respectively and which copies `prog` and
`prog.alt` to `eprog` and `eprog.alt` respectively. With these changes now one
can easily use the echo feature the author implemented.
of `${PROG}` and `${PROG}.alt` respectively both of which also copy the `prog`
(`prog` or `eprog`) to the respective `eprog` (`eprog` or `eprog.alt`). With
these changes now one can easily use the echo feature the author implemented.
Cody also added the [try.sh](/2015/burton/try.sh) script. This involved
adding a text file, [try.this.txt](/2015/burton/try.this.txt).