Fix 2014/sinon + add try.sh + formatting

The mode where the game would play by itself did not work because the
code had 'sinon.c' in it but this does not exist. Now the code refers to
'prog.c'.

Add try.sh script that is an improvement over the previous try command
(or commands in a sequence) in that it loops, asking if you wish to try
again in case of a jam (or any other reason).

Format/typo check README.md.

This should complete the review of 2014/sinon.
This commit is contained in:
Cody Boone Ferguson committed 2023-12-04 12:34:27 -08:00
1 parent b3b93b42ea
commit 93d27e535d
4 files changed
+51 -7

No files matched your search

+12 -6
View File
@@ -8,16 +8,19 @@ make
## To use:
```sh
cp -f sinon.c run.c; ./hecate.sh
cp -f prog.c run.c; ./hecate.sh
```
### Try:
```sh
cp -f sinon.c run.c; ./hecate.sh; ./glock.sh; sleep 3; ./glock.sh; sleep 1; ./hecate.sh
./try.sh
```
This script will ask you if you wish to try again after each run. Type in any
character other than `y` or `Y` to exit at this point.
## Judges' remarks:
@@ -37,7 +40,7 @@ To start, compile and run the program. To resume, compile and run the
output repeatedly until you have won/lost the game. For example:
```sh
cp sinon.c run.c
cp prog.c run.c
gcc -O0 run.c -o run && ./run | tee run.c
gcc -O2 run.c -o run && ./run | tee run.c
...
@@ -74,6 +77,7 @@ need to be more precise. This is effectively playing the game on
"hard" mode. It is worth trying this mode even if you have the right
compilers.
### Compatibility
Sinon has been tested and verified to work on these platforms:
@@ -100,11 +104,13 @@ Sinon has a demo mode that plays the game automatically. Make sure
that there are no files named "run" and "run.c" in current directory
(they will be overwritten) and run:
perl sinon.c | bash
```sh
perl prog.c | bash
```
File size and CRC32 of sinon.c are embedded in line 7.
File size and CRC32 of [prog.c](prog.c) are embedded in line 7.
Process for making Sinon is included in spoiler.html.
Process for making Sinon is included in [spoiler.html](spoiler.html).
Layout of this code is based on Asada Shino, also known as "Sinon",
from Sword Art Online.
+1 -1
View File
@@ -14,7 +14,7 @@
"CYOUQWIN!]Q=;of8BQQ)88bc]QA98P'Qo]8>oQQ_8CP;QQ98b`_8@P8(Q`]'^Q=`']QB)88"
"bQQ]`8J;QQ`88bc99bd(`8iQ@''QQo^8E'`8c;QQ'Q``8?QQ`'kQ<o]8B9PQQ`';_Q<`_8<cbQ"
"<o_Q<o_QBdo`QQ';`Q=9`]8=bobQ_o_Q<o]8=';bQC(88cQ`bcgQ>oP']8<;cQ>98)^Q?''oc`Q>"
"oc']Q]8<;cQ>`8bbQA``QQ''`Q?88P;dQ=`)nQ?*/;;"/*}}=~/./;print"cp\40sinon.c\40r",
"oc']Q]8<;cQ>`8bbQA``QQ''`Q?88P;dQ=`)nQ?*/;;"/*}}=~/./;print"cp\40prog.c\40r",
"un.c\n";for($i=1;$i<21;$i++){for($j=0;$j<2;$j++){print"gcc\x20-O",$j*2,
"\40run.c\x20-o run&&./run|tee run.c\n"if!($i%(2+$j));}print"sleep $j\n";
} __DATA__ 8M*/;G(Z,60*(60*(10**s+s[1])+s[3]*10+s[4])+s[6]*10+s[7]-1933008
+27
View File
@@ -0,0 +1,27 @@
#!/usr/bin/env bash
#
# try.sh - demonstrate IOCCC winner 2014/sinon
#
# 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
while :; do
cp -f prog.c run.c; ./hecate.sh; ./glock.sh; sleep 3; ./glock.sh; sleep 1; ./hecate.sh
read -r -p "Do you want to try again (Y/N)? "
if [[ "$REPLY" != "y" && "$REPLY" != "Y" ]]; then
exit 0
fi
done
+11
View File
@@ -3695,6 +3695,17 @@ it is a file with spoilers.
[SDL2](https://www.libsdl.org) but SDL1 so there were linking errors.
## [2014/sinon](2014/sinon/prog.c) ([README.md](2014/sinon/README.md))
[Cody](#cody) fixed the code so that the game can play automatically like it
once did. The problem is that it expects a certain file name which was
`sinon.c`. The code now refers to `prog.c`.
Cody also added the [try.sh](2014/sinon/try.sh) script which is an improvement
over what was once suggested in that when it's over it will ask you if you wish
to try again, say because of a jam (see the README.md file for details).
## [2014/skeggs](2014/skeggs/prog.c) ([README.md](2014/skeggs/README.md))
[Cody](#cody) fixed the Makefile to compile this entry in modern systems. The problem was