diff --git a/2004/hoyle/.gitignore b/2004/hoyle/.gitignore index ca6a85851..da12b6de1 100644 --- a/2004/hoyle/.gitignore +++ b/2004/hoyle/.gitignore @@ -2,6 +2,8 @@ # sort with: sort -d -u *.dSYM hoyle +hoyle1.txt +hoyle2.txt hoyle.alt hoyle.orig indent diff --git a/2004/hoyle/README.md b/2004/hoyle/README.md index b78983ac7..7fd7a3e33 100644 --- a/2004/hoyle/README.md +++ b/2004/hoyle/README.md @@ -15,9 +15,7 @@ make ## Try: ```sh -./hoyle 10 0.5 -./hoyle 1 1 1 1 -./hoyle 2 0 1 0 -0.001 +./try.sh ``` @@ -37,7 +35,7 @@ coefficients `a`, `b`, `c`, etc. as double precision arguments. It allows up to 8 parameters (thus up to `x^7`). -### Points of note: +### Points of interest: - the [x axis](https://mathworld.wolfram.com/x-Axis.html) goes from `-32` to `+31`. @@ -45,7 +43,7 @@ coefficients `a`, `b`, `c`, etc. as double precision arguments. It allows up to - up to 8 [coefficients](https://en.wikipedia.org/wiki/Coefficient) may be passed in. - the graph will determine direction and use slashes and - dashes rather than simple block `X`s. + dashes rather than a simple block of `X`s. For example, to graph `y = x^2`: diff --git a/2004/hoyle/try.sh b/2004/hoyle/try.sh new file mode 100755 index 000000000..a2b138cd7 --- /dev/null +++ b/2004/hoyle/try.sh @@ -0,0 +1,64 @@ +#!/usr/bin/env bash +# +# try.sh - demonstrate IOCCC winner 2004/hoyle +# + +# 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 + + +read -r -n 1 -p "Press any key to run: ./hoyle 10 0.5 (space = next page, q = quit): " +echo 1>&2 +./hoyle 10 0.5 +echo 1>&2 + +read -r -n 1 -p "Press any key to run: ./hoyle 1 1 1 1 (space = next page, q = quit): " +echo 1>&2 +./hoyle 1 1 1 1 +echo 1>&2 + +read -r -n 1 -p "Press any key to run: ./hoyle 2 0 1 0 -0.001 (space = next page, q = quit): " +echo 1>&2 +./hoyle 2 0 1 0 -0.001 +echo 1>&2 + +read -r -n 1 -p "Press any key to run: ./hoyle 1 2 3 42 -0.42 (space = next page, q = quit): " +echo 1>&2 +./hoyle 1 2 3 42 -0.42 +echo 1>&2 + +read -r -n 1 -p "Press any key to run: ./hoyle 42 42 42 42 42 42 (space = next page, q = quit): " +echo 1>&2 +./hoyle 42 42 42 42 42 42 +echo 1>&2 + +read -r -n 1 -p "Press any key to run: ./hoyle 42 42 42 42 42 (space = next page, q = quit): " +echo 1>&2 +./hoyle 42 42 42 42 42 +echo 1>&2 + + +read -r -n 1 -p "Press any key to run: ./hoyle 0 0 1 | tee hoyle1.txt (space = next page, q = quit): " +echo 1>&2 +./hoyle 0 0 1 | tee hoyle1.txt | less -rEXF +echo 1>&2 + +read -r -n 1 -p "Press any key to run: ./hoyle 0 0 2 | tee hoyle2.txt (space = next page, q = quit): " +echo 1>&2 +./hoyle 0 0 2 | tee hoyle2.txt | less -rEXF +echo 1>&2 + +read -r -n 1 -p "Press any key to run: diff -s hoyle1.txt hoyle2.txt: " +echo 1>&2 +diff -s hoyle1.txt hoyle2.txt +echo "... why are they the same?" +rm -f hoyle1.txt hoyle2.txt diff --git a/thanks-for-help.md b/thanks-for-help.md index eeb7a39b2..072dc5554 100644 --- a/thanks-for-help.md +++ b/thanks-for-help.md @@ -3003,6 +3003,11 @@ all that was necessary but at least one or two URLs required the Internet Wayback Machine. +## [2004/hoyle](/2004/hoyle/hoyle.c) ([README.md](/2004/hoyle/README.md])) + +[Cody](#cody) added the [try.sh](/2004/hoyle/try.sh) script. + + ## [2004/jdalbec](/2004/jdalbec/jdalbec.c) ([README.md](/2004/jdalbec/README.md)) [Cody](#cody) fixed this to compile with gcc (it worked with clang). The problem was the