Improve 2006/sykes1/try.sh

This commit is contained in:
Cody Boone Ferguson committed 2024-01-22 09:53:58 -08:00
1 parent ceb9bf768a
commit 95ca0ca008
3 files changed
+72 -22

No files matched your search

+42 -1
View File
@@ -4,6 +4,10 @@
make
```
There is an alt version based on the author's remarks. The [try.sh](try.sh)
script will compile and use both but if you wish to see the alternate version
specifically see the [Alternate code](#alternate-code) section below.
### Bugs and (Mis)features:
@@ -33,6 +37,15 @@ Next point your browser to the file: `sykes1.html`.
Refresh your browser.
You might also try:
```sh
./try.sh
```
This will run both the original entry and the alt code to show some differences.
### Also try:
If you have all day :-) and wish to find out how fast your machine can solve the
@@ -61,6 +74,33 @@ sys 0m0.110s
```
## Alternate code:
This alternate code is based on the author's remarks.
### Alternate build:
```sh
make alt
```
### Alternate use:
Use `sykes1.alt` as you would `sykes1` above.
### Alternate try:
The [try.sh](try.sh) script will use both versions to show some differences. You
can do so like:
```sh
./try.sh
```
## Judges' remarks:
Read the [sykes1.html](sykes1.html) page source.
@@ -86,7 +126,8 @@ puzzles in wikipedia](http://en.wikipedia.org/wiki/Bedlam_cube).
Some instructions on how to make your own cube are in the included file
[bedlam-cubes.pdf](bedlam-cubes.pdf).
Finally, you can watch it being solved at <https://www.youtube.com/watch?v=a8s1AcYMLBc>.
Finally, you can watch it being solved with the video file here,
[solving-bedlam-cube.mp4](solving-bedlam-cube.mp4).
Actually the cube is very hard to do by hand by just trying to fit it
together. I have not known anyone to solve it in this way - you would
+27 -20
View File
@@ -23,47 +23,54 @@ try()
SYKES1="$1"
fi
echo "$ diff -s $SYKES1.c $SYKES1.html" 1>&2
read -r -n 1 -p "Press any key to see $SYKES1.c (space = next page, q = quit): "
echo 1>&2
less -rEXF "$SYKES1.c"
echo 1>&2
read -r -n 1 -p "Press any key to run: diff -s $SYKES1.c $SYKES1.html: "
echo 1>&2
diff -s "$SYKES1".c "$SYKES1".html
echo 1>&2
echo "$ ./$SYKES1 | less" 1>&2
read -r -n 1 -p "Press any key to continue (use 'q' to quit pager, space to scroll a page down): "
./"$SYKES1" | less
read -r -n 1 -p "Press any key to run: ./$SYKES1 (space = next page, q = quit): "
echo 1>&2
./"$SYKES1" | less -rEXF
echo 1>&2
echo "$ ./$SYKES1 5 | less" 1>&2
read -r -n 1 -p "Press any key to continue (use 'q' to quit pager, space to scroll a page down): "
./"$SYKES1" 5 | less
read -r -n 1 -p "Press any key to run: ./$SYKES1 5 (space = next page, q = quit): "
echo 1>&2
./"$SYKES1" 5 | less -rEXF
echo 1>&2
echo "$ ./$SYKES1 -1 | less" 1>&2
read -r -n 1 -p "Press any key to continue ('q' to quit pager, space to scroll a page down): "
./"$SYKES1" -1 | less
read -r -n 1 -p "Press any key to run: ./$SYKES1 -1 (space = next page, q = quit): "
echo 1>&2
./"$SYKES1" -1 | less -rEXF
echo 1>&2
echo "What happened and why did it happen?" 1>&2
echo 1>&2
}
read -r -n 1 -p "Press any key to see the entry: "
try sykes1
echo 1>&2
read -r -n 1 -p "Press any key to see the alt version: "
echo 1>&2
try sykes1.alt
echo 1>&2
# clean up output files first
rm -f sykes1.out sykes1.alt.out
read -r -n 1 -p "Press any key to look at output differences of the two: "
read -r -n 1 -p "Press any key to run: ./sykes1 > sykes1.out: "
echo 1>&2
./sykes1 > sykes1.out
echo 1>&2
read -r -n 1 -p "Press any key to run: ./sykes1.alt > sykes1.alt.out: "
echo 1>&2
./sykes1.alt > sykes1.alt.out
echo 1>&2
echo "$ ./sykes1 > sykes1.out" 1>&2
./sykes1 > sykes1.out
echo "$ ./sykes1.alt > sykes1.alt.out" 1>&2
./sykes1.alt > sykes1.alt.out
echo "$ diff sykes1.out sykes1.alt.out | less" 1>&2
read -r -n 1 -p "Press any key to continue (use 'q' to quit pager, space to scroll down a page): "
diff sykes1.out sykes1.alt.out | less
read -r -n 1 -p "Press any key to run: diff sykes1.out sykes1.alt.out (space = next page, q = quit): "
echo 1>&2
diff sykes1.out sykes1.alt.out | less -rEXF
rm -f sykes1.out sykes1.alt.out
+3 -1
View File
@@ -3498,7 +3498,9 @@ bug to fix.
## <a name="2006_sykes1"></a>[2006/sykes1](/2006/sykes1/sykes1.c) ([README.md](/2006/sykes1/README.md]))
[Cody](#cody) provided the [alt code](/2006/sykes1/README.md#alternate-code) based on the
author's remarks and the [try.sh](/2006/sykes1/try.sh) script.
author's remarks.
Cody also added the [try.sh](/2006/sykes1/try.sh) script.
Cody also provided the [bedlam-cubes.pdf](/2006/sykes1/bedlam-cubes.pdf) file,
obtained from the Internet Wayback Machine, as the file was no longer available.