From 95ca0ca0080dee8f058189d4a632f1031996c159 Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Mon, 22 Jan 2024 09:53:58 -0800 Subject: [PATCH] Improve 2006/sykes1/try.sh --- 2006/sykes1/README.md | 43 ++++++++++++++++++++++++++++++++++++++- 2006/sykes1/try.sh | 47 +++++++++++++++++++++++++------------------ thanks-for-help.md | 4 +++- 3 files changed, 72 insertions(+), 22 deletions(-) diff --git a/2006/sykes1/README.md b/2006/sykes1/README.md index 2ceb2dcbe..b3811a902 100644 --- a/2006/sykes1/README.md +++ b/2006/sykes1/README.md @@ -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 . +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 diff --git a/2006/sykes1/try.sh b/2006/sykes1/try.sh index 899cfe4e7..8f05cd504 100755 --- a/2006/sykes1/try.sh +++ b/2006/sykes1/try.sh @@ -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 diff --git a/thanks-for-help.md b/thanks-for-help.md index ddaf57cbb..00a579838 100644 --- a/thanks-for-help.md +++ b/thanks-for-help.md @@ -3498,7 +3498,9 @@ bug to fix. ## [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.