This was done by:
sgit -e 's/alt code/alternate code/g' . ; git co tmp/OLD_manifest
as well as updating the tmp/manifest.numbers spreadsheet and exporting
to the CSV file (though that would not strictly be necessary).
The way this works means that the update manifest script does not need
to be run as it sgit(1) touched the .entry.json files (any that needed
to be updated) and so would any index.html files. An example for both
.entry.json and index.html files being modified due to manifest is
2012/kang.
Numerous Makefiles were updated, any try scripts that had 'alt code'
instead of 'alternate code' and README.md/index.html files (unrelated to
the manifest as 'alt code' was used in other places too) and obviously
the manifest.numbers spreadsheet.
However to be safe I will do a run of the manifest script in a bit even
though it should not be necessary. If no commits are made it means all
is good and if any commits are made for the manifest it means that I
did not think of something (or else I made another change after this).
208 lines
6.2 KiB
Bash
Executable File
208 lines
6.2 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
#
|
|
# try.alt.sh - demonstrate IOCCC entry 2000/natori alternate code
|
|
#
|
|
|
|
# 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" everything >/dev/null || exit 1
|
|
|
|
# clear screen after compilation so that only the entry is shown
|
|
clear
|
|
|
|
NATORI="natori"
|
|
moon()
|
|
{
|
|
read -r -n 1 -p "Press any key to randomly show the northern/southern hemisphere Moon: "
|
|
echo 1>&2
|
|
for ((i=0;i<=10;i++)); do
|
|
RAND=$((RANDOM % 1000))
|
|
if [[ "$RAND" -le 500 ]]; then
|
|
./"$NATORI".alt
|
|
echo 1>&2
|
|
else
|
|
./"$NATORI"
|
|
echo 1>&2
|
|
fi
|
|
|
|
if [[ "$i" != 10 ]]; then
|
|
read -r -n 1 -p "Press any key to continue: "
|
|
echo 1>&2
|
|
fi
|
|
done
|
|
|
|
echo 1>&2
|
|
RAND=$((RANDOM % 1000))
|
|
if [[ "$RAND" -gt 500 ]]; then
|
|
read -r -n 1 -p "Press any key to alternate between the southern/northern hemisphere Moon: "
|
|
echo 1>&2
|
|
./"$NATORI".alt
|
|
read -r -n 1 -p "Press any key to continue: "
|
|
echo 1>&2
|
|
./"$NATORI"
|
|
read -r -n 1 -p "Press any key to continue: "
|
|
echo 1>&2
|
|
./"$NATORI".alt
|
|
read -r -n 1 -p "Press any key to continue: "
|
|
echo 1>&2
|
|
./"$NATORI"
|
|
read -r -n 1 -p "Press any key to continue: "
|
|
echo 1>&2
|
|
./"$NATORI".alt
|
|
read -r -n 1 -p "Press any key to continue: "
|
|
echo 1>&2
|
|
./"$NATORI"
|
|
else
|
|
read -r -n 1 -p "Press any key to alternate between the northern/southern hemisphere Moon: "
|
|
echo 1>&2
|
|
./"$NATORI"
|
|
read -r -n 1 -p "Press any key to continue: "
|
|
echo 1>&2
|
|
./"$NATORI".alt
|
|
read -r -n 1 -p "Press any key to continue: "
|
|
echo 1>&2
|
|
./"$NATORI"
|
|
read -r -n 1 -p "Press any key to continue: "
|
|
echo 1>&2
|
|
./"$NATORI".alt
|
|
read -r -n 1 -p "Press any key to continue: "
|
|
echo 1>&2
|
|
./"$NATORI"
|
|
read -r -n 1 -p "Press any key to continue: "
|
|
echo 1>&2
|
|
./"$NATORI".alt
|
|
fi
|
|
|
|
echo 1>&2
|
|
echo "We will now reverse the order." 1>&2
|
|
echo 1>&2
|
|
|
|
if [[ "$RAND" -le 499 ]]; then
|
|
read -r -n 1 -p "Press any key to alternate between the southern/northern hemisphere Moon: "
|
|
echo 1>&2
|
|
./"$NATORI".alt
|
|
read -r -n 1 -p "Press any key to continue: "
|
|
echo 1>&2
|
|
./"$NATORI"
|
|
read -r -n 1 -p "Press any key to continue: "
|
|
echo 1>&2
|
|
./"$NATORI".alt
|
|
read -r -n 1 -p "Press any key to continue: "
|
|
echo 1>&2
|
|
./"$NATORI"
|
|
read -r -n 1 -p "Press any key to continue: "
|
|
echo 1>&2
|
|
./"$NATORI".alt
|
|
read -r -n 1 -p "Press any key to continue: "
|
|
echo 1>&2
|
|
./"$NATORI"
|
|
else
|
|
read -r -n 1 -p "Press any key to alternate between the northern/southern hemisphere Moon: "
|
|
echo 1>&2
|
|
./"$NATORI"
|
|
read -r -n 1 -p "Press any key to continue: "
|
|
echo 1>&2
|
|
./"$NATORI".alt
|
|
read -r -n 1 -p "Press any key to continue: "
|
|
echo 1>&2
|
|
./"$NATORI"
|
|
read -r -n 1 -p "Press any key to continue: "
|
|
echo 1>&2
|
|
./"$NATORI".alt
|
|
read -r -n 1 -p "Press any key to continue: "
|
|
echo 1>&2
|
|
./"$NATORI"
|
|
read -r -n 1 -p "Press any key to continue: "
|
|
echo 1>&2
|
|
./"$NATORI".alt
|
|
fi
|
|
|
|
echo 1>&2
|
|
echo "Will now use less(1): 'q' = quit, space = next page, enter = next line." 1>&2
|
|
echo "We recommend that you try holding space down." 1>&2
|
|
echo 1>&2
|
|
RAND=$((RANDOM % 1000))
|
|
if [[ "$RAND" -gt 500 ]]; then
|
|
read -r -n 1 -p "Press any key to alternate between the southern/northern hemisphere Moon: "
|
|
echo 1>&2
|
|
( ./"$NATORI.alt"; ./"$NATORI" ; ./"$NATORI.alt" ; ./"$NATORI"; \
|
|
./"$NATORI.alt"; ./"$NATORI" ) | less -rEXF
|
|
else
|
|
read -r -n 1 -p "Press any key to alternate between the northern/southern hemisphere Moon: "
|
|
echo 1>&2
|
|
( ./"$NATORI"; ./"$NATORI.alt" ; ./"$NATORI" ; ./"$NATORI.alt"; \
|
|
./"$NATORI"; ./"$NATORI.alt" ) | less -rEXF
|
|
fi
|
|
|
|
echo 1>&2
|
|
echo "Will now use less(1): 'q' = quit, space = next page, enter = next line." 1>&2
|
|
echo "We now recommend that you try holding enter down." 1>&2
|
|
echo 1>&2
|
|
if [[ "$RAND" -gt 500 ]]; then
|
|
read -r -n 1 -p "Press any key to alternate between the southern/northern hemisphere Moon: "
|
|
echo 1>&2
|
|
( ./"$NATORI.alt"; ./"$NATORI" ; ./"$NATORI.alt" ; ./"$NATORI"; \
|
|
./"$NATORI.alt"; ./"$NATORI" ) | less -rEXF
|
|
else
|
|
read -r -n 1 -p "Press any key to alternate between the northern/southern hemisphere Moon: "
|
|
echo 1>&2
|
|
( ./"$NATORI"; ./"$NATORI.alt" ; ./"$NATORI" ; ./"$NATORI.alt"; \
|
|
./"$NATORI"; ./"$NATORI.alt" ) | less -rEXF
|
|
fi
|
|
echo 1>&2
|
|
|
|
echo "We will now reverse the order." 1>&2
|
|
echo 1>&2
|
|
echo "Will now use less(1): 'q' = quit, space = next page, enter = next line." 1>&2
|
|
echo "We recommend that you try holding space down." 1>&2
|
|
echo 1>&2
|
|
if [[ "$RAND" -le 499 ]]; then
|
|
read -r -n 1 -p "Press any key to alternate between the southern/northern hemisphere Moon: "
|
|
echo 1>&2
|
|
( ./"$NATORI.alt"; ./"$NATORI" ; ./"$NATORI.alt" ; ./"$NATORI"; \
|
|
./"$NATORI.alt"; ./"$NATORI" ) | less -rEXF
|
|
else
|
|
read -r -n 1 -p "Press any key to alternate between the northern/southern hemisphere Moon: "
|
|
echo 1>&2
|
|
( ./"$NATORI"; ./"$NATORI.alt" ; ./"$NATORI" ; ./"$NATORI.alt"; \
|
|
./"$NATORI"; ./"$NATORI.alt" ) | less -rEXF
|
|
fi
|
|
|
|
echo 1>&2
|
|
echo "Will now use less(1): 'q' = quit, space = next page, enter = next line." 1>&2
|
|
echo "We now recommend that you try holding enter down." 1>&2
|
|
echo 1>&2
|
|
if [[ "$RAND" -le 499 ]]; then
|
|
read -r -n 1 -p "Press any key to alternate between the southern/northern hemisphere Moon: "
|
|
echo 1>&2
|
|
( ./"$NATORI.alt"; ./"$NATORI" ; ./"$NATORI.alt" ; ./"$NATORI"; \
|
|
./"$NATORI.alt"; ./"$NATORI" ) | less -rEXF
|
|
else
|
|
read -r -n 1 -p "Press any key to alternate between the northern/southern hemisphere Moon: "
|
|
echo 1>&2
|
|
( ./"$NATORI"; ./"$NATORI.alt" ; ./"$NATORI" ; ./"$NATORI.alt"; \
|
|
./"$NATORI"; ./"$NATORI.alt" ) | less -rEXF
|
|
fi
|
|
echo 1>&2
|
|
|
|
# Finally, for the try.alt.sh (alternate code, southern hemisphere), force
|
|
# starting with southern hemisphere.
|
|
echo "Will now use less(1): 'q' = quit, space = next page, enter = next line." 1>&2
|
|
echo "We now recommend that you try holding enter down." 1>&2
|
|
read -r -n 1 -p "Press any key to alternate between the southern/northern hemisphere Moon: "
|
|
echo 1>&2
|
|
( ./"$NATORI.alt"; ./"$NATORI" ; ./"$NATORI.alt" ; ./"$NATORI"; \
|
|
./"$NATORI.alt"; ./"$NATORI" ) | less -rEXF
|
|
|
|
echo 1>&2
|
|
|
|
}
|
|
|
|
# show the Moon phase in artistic ways!
|
|
moon
|