Improve and add scripts to 2018/ferguson
The id.sh and id.alt.sh scripts are (for entry and alt entry that I
submitted to the contest) are for those who want to try and prove that
'"intelligent" design' is real or for those who know better to see how
long it'll take Eric the monkey to type 'EVOLUTION IS A PROVEN FACT'.
These were both added by the judges at time of publication but I moved
them to the try scripts. Now however the id scripts limit to 250000 max
attempts (see below on this change) before giving up to save time (and
to maybe let them move on to the next step, see below also).
The monkey-words.sh and monkey-words.alt.sh are to see how long it is
before the monkey Eric can type 'words' or more likely how long it'll
take before he gives up or falls asleep. I am no longer sure if I added
this or the judges did but I'm pretty sure I did.
As for the max attempts this one might need to be moved to a second alt
version for both but if so I don't know what to name them. This
reconfiguration option was not originally submitted but to show what
will happen when Eric fails it was added. It would normally be put in
prog.alt.c but prog.alt.c already exists: a simpler keyboard. But if the
new feature was moved to prog.alt.c what would prog.alt.c be? Maybe
prog.alt2.c but then what about the simpler keyboard version? This can
be discussed because I am not sure I want it in prog.c and I am not sure
if it should be either as it was not part of the original entry (though
in retrospect it should have been). The try.sh and try.alt.sh scripts
now show what happens when Eric fails where previously one would have to
wait a very long time (max attempts SIZE_MAX - 1 is what it was set to
and still defaults to, being reset to it if it's < 100 which was
arbitrarily selected).
The Makefile has been improved to simplify redefining the macros that
specify how many offspring per generation to have and the max length of
the string (this has also been used in the try.sh and try.alt.sh scripts
if the user says they want to see the undocumented Easter egg).
The test.sh script now uses less(1) so one can look at the output one
page at a time.
The make test rule now has a '@' to silent the command being executed
('./test.sh').
This commit is contained in:
1 parent
1f9e31bca0
commit
55ca7f433f
12 files changed
+304
-80
No files matched your search
+36
-25
@@ -15,38 +15,49 @@ 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: ./weasel words (space = next page, q = quit): "
|
||||
read -r -n 1 -p "Press any key to run: ./weasel words (space = next page, q = quit, G = end): "
|
||||
echo 1>&2
|
||||
time ./weasel words | less -EXF
|
||||
time ./weasel words | less -rEXFK
|
||||
|
||||
read -r -n 1 -p "Press any key to see how long it'll take Eric the monkey to type his name: "
|
||||
echo 1>&2
|
||||
time ./weasel -mq Eric
|
||||
echo 1>&2
|
||||
|
||||
read -r -n 1 -p "Press any key to run: make test: "
|
||||
read -r -p "Do you want to run make test (Y/N)? "
|
||||
if [[ "$REPLY" = "Y" || "$REPLY" = "y" ]]; then
|
||||
make test
|
||||
fi
|
||||
|
||||
read -r -p "Do you wish to see the undocumented Easter egg (Y/N)? "
|
||||
if [[ "$REPLY" = "Y" || "$REPLY" = "y" ]]; then
|
||||
make -B OFFSPRING=97 everything 1>/dev/null || exit 1
|
||||
read -r -n 1 -p "Press any key to show Easter egg (./weasel): "
|
||||
echo 1>&2
|
||||
./weasel
|
||||
echo 1>&2
|
||||
fi
|
||||
|
||||
echo 1>&2
|
||||
make test
|
||||
read -r -n 1 -p "Press any key to change max attempts to 100: "
|
||||
echo 1>&2
|
||||
echo "$ make -B MAX_ATTEMPTS=100 everything >/dev/null || exit 1" 1>&2
|
||||
echo 1>&2
|
||||
make -B MAX_ATTEMPTS=100 everything >/dev/null || exit 1
|
||||
read -r -n 1 -p "Press any key to see what happens when the maximum attempts are reached: "
|
||||
echo 1>&2
|
||||
./weasel -m 'Eric the Monkey'
|
||||
|
||||
read -r -p "Do you wish to try and prove 'intelligent design' (Y/N)? "
|
||||
if [[ "$REPLY" == "Y" || "$REPLY" == "y" ]]; then
|
||||
echo "$ ./weasel -m 'INTELLIGENT DESIGN'" 1>&2
|
||||
echo "Press any key to continue. Send ctrl-c when convinced that intelligent" 1>&2
|
||||
read -r -n 1 -p "design is not real or you're tired of waiting: "
|
||||
echo 1>&2
|
||||
time ./weasel -m 'INTELLIGENT DESIGN'
|
||||
echo 1>&2
|
||||
else
|
||||
echo "$ ./weasel -q -r8 'EVOLUTION IS A PROVEN FACT'" 1>&2
|
||||
time ./weasel -q -r8 'EVOLUTION IS A PROVEN FACT'
|
||||
fi
|
||||
# recompile with default max attempts for the next steps
|
||||
make -B everything >/dev/null || exit 1
|
||||
|
||||
read -r -n 1 -p "Do you want to see how long it might take the monkey Eric to type 'words'? (Y/N)? "
|
||||
if [[ "$REPLY" == "Y" || "$REPLY" == "y" ]]; then
|
||||
echo 1>&2
|
||||
echo "Will not display until Eric succeeds or too many generations. Hit ctrl-c" 1>&2
|
||||
echo "to stop him early." 1>&2
|
||||
read -r -n 1 -p "Press any key to continue: "
|
||||
echo 1>&2
|
||||
time ./weasel -mq words
|
||||
fi
|
||||
# obviously '"intelligent" design' is false but who wants to try and prove
|
||||
# otherwise? Or if they know better how long will it take to show that evolution
|
||||
# is a proven fact?
|
||||
./id.sh
|
||||
|
||||
# If the user did not try and prove '"intelligent" design' or they waited a
|
||||
# long time (though saving them some time by limiting it to 900000 attempts) I
|
||||
# ask: can Eric the monkey type the word 'words' before falling asleep or
|
||||
# getting too hungry to continue?
|
||||
./monkey-words.sh
|
||||
Reference in new issue
Block a user