Add 2004/hoyle/try.sh

This involved an update to .gitignore.
This commit is contained in:
Cody Boone Ferguson committed 2024-01-20 09:46:47 -08:00
1 parent 73512d2e81
commit 6c2bf8cb5a
4 files changed
+74 -5

No files matched your search

+2
View File
@@ -2,6 +2,8 @@
# sort with: sort -d -u
*.dSYM
hoyle
hoyle1.txt
hoyle2.txt
hoyle.alt
hoyle.orig
indent
+3 -5
View File
@@ -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`:
+64
View File
@@ -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
+5
View File
@@ -3003,6 +3003,11 @@ all that was necessary but at least one or two URLs required the Internet
Wayback Machine.
## <a name="2004_hoyle"></a>[2004/hoyle](/2004/hoyle/hoyle.c) ([README.md](/2004/hoyle/README.md]))
[Cody](#cody) added the [try.sh](/2004/hoyle/try.sh) script.
## <a name="2004_jdalbec"></a>[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