Add 2004/hoyle/try.sh
This involved an update to .gitignore.
This commit is contained in:
1 parent
73512d2e81
commit
6c2bf8cb5a
4 files changed
+74
-5
No files matched your search
@@ -2,6 +2,8 @@
|
|||||||
# sort with: sort -d -u
|
# sort with: sort -d -u
|
||||||
*.dSYM
|
*.dSYM
|
||||||
hoyle
|
hoyle
|
||||||
|
hoyle1.txt
|
||||||
|
hoyle2.txt
|
||||||
hoyle.alt
|
hoyle.alt
|
||||||
hoyle.orig
|
hoyle.orig
|
||||||
indent
|
indent
|
||||||
|
|||||||
@@ -15,9 +15,7 @@ make
|
|||||||
## Try:
|
## Try:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
./hoyle 10 0.5
|
./try.sh
|
||||||
./hoyle 1 1 1 1
|
|
||||||
./hoyle 2 0 1 0 -0.001
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@@ -37,7 +35,7 @@ coefficients `a`, `b`, `c`, etc. as double precision arguments. It allows up to
|
|||||||
8 parameters (thus up to `x^7`).
|
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
|
- the [x axis](https://mathworld.wolfram.com/x-Axis.html) goes from `-32` to
|
||||||
`+31`.
|
`+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
|
- up to 8 [coefficients](https://en.wikipedia.org/wiki/Coefficient) may be
|
||||||
passed in.
|
passed in.
|
||||||
- the graph will determine direction and use slashes and
|
- 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`:
|
For example, to graph `y = x^2`:
|
||||||
|
|
||||||
|
|||||||
Executable
+64
@@ -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
|
||||||
@@ -3003,6 +3003,11 @@ all that was necessary but at least one or two URLs required the Internet
|
|||||||
Wayback Machine.
|
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))
|
## <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
|
[Cody](#cody) fixed this to compile with gcc (it worked with clang). The problem was the
|
||||||
|
|||||||
Reference in new issue
Block a user