Add try.sh to 2014/endoh2 + formatting/typo checks
This commit is contained in:
1 parent
539e1dce7f
commit
c306944d3f
4 files changed
+68
-4
No files matched your search
@@ -1,2 +1,6 @@
|
|||||||
prog
|
prog
|
||||||
prog.orig
|
prog.orig
|
||||||
|
hello.c
|
||||||
|
hello
|
||||||
|
ioccc.c
|
||||||
|
ioccc
|
||||||
@@ -32,6 +32,7 @@ in the DNA code of the code? Perhaps there are 23 reasons? :-)
|
|||||||
|
|
||||||
## Author's remarks:
|
## Author's remarks:
|
||||||
|
|
||||||
|
|
||||||
### Remarks
|
### Remarks
|
||||||
|
|
||||||
This chromosome program synthesizes a double helix.
|
This chromosome program synthesizes a double helix.
|
||||||
@@ -39,14 +40,16 @@ The helix can also be compiled as a C program.
|
|||||||
|
|
||||||
Enjoy DNA programming!
|
Enjoy DNA programming!
|
||||||
|
|
||||||
### For more information / backgroud reading:
|
|
||||||
|
### For more information / background reading:
|
||||||
|
|
||||||
* This program was inspired by Acme::DoubleHelix:
|
* This program was inspired by Acme::DoubleHelix:
|
||||||
http://search.cpan.org/~xern/Acme-DoubleHelix-0.01/
|
<http://search.cpan.org/~xern/Acme-DoubleHelix-0.01/>
|
||||||
|
|
||||||
* The synthesized helix just includes the original program at the head.
|
* The synthesized helix just includes the original program at the head.
|
||||||
Do you see how `prog.c` determines whether it was invoked as a standalone program or included as a header file?
|
Do you see how [prog.c](prog.c) determines whether it was invoked as a
|
||||||
Note that it does not use any gcc extension such as `__INCLUDE_LEVEL__`.
|
standalone program or included as a header file? Note that it does not use any
|
||||||
|
gcc extension such as `__INCLUDE_LEVEL__`.
|
||||||
|
|
||||||
* The synthesized helix of course follows the base-pairing rules for DNA:
|
* The synthesized helix of course follows the base-pairing rules for DNA:
|
||||||
A is bonding only to T, and C is bonding only to G.
|
A is bonding only to T, and C is bonding only to G.
|
||||||
|
|||||||
Executable
+52
@@ -0,0 +1,52 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
#
|
||||||
|
# try.sh - demonstrate IOCCC winner 2014/endoh2
|
||||||
|
#
|
||||||
|
|
||||||
|
# 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: echo Hello | ./prog: "
|
||||||
|
echo 1>&2
|
||||||
|
echo Hello | ./prog
|
||||||
|
echo 1>&2
|
||||||
|
|
||||||
|
read -r -n 1 -p "Press any key to run: echo IOCCC | ./prog: "
|
||||||
|
echo 1>&2
|
||||||
|
echo IOCCC | ./prog
|
||||||
|
echo 1>&2
|
||||||
|
|
||||||
|
read -r -n 1 -p "Press any key to run: echo Hello | ./prog > hello.c: "
|
||||||
|
echo 1>&2
|
||||||
|
echo Hello | ./prog > hello.c
|
||||||
|
echo 1>&2
|
||||||
|
|
||||||
|
read -r -n 1 -p "Press any key to compile hello.c: "
|
||||||
|
echo 1>&2
|
||||||
|
make hello >/dev/null
|
||||||
|
echo 1>&2
|
||||||
|
read -r -n 1 -p "Press any key to run: ./hello: "
|
||||||
|
./hello
|
||||||
|
echo 1>&2
|
||||||
|
|
||||||
|
read -r -n 1 -p "Press any key to run: echo IOCCC | ./prog > ioccc.c: "
|
||||||
|
echo 1>&2
|
||||||
|
echo IOCCC | ./prog > ioccc.c
|
||||||
|
echo 1>&2
|
||||||
|
|
||||||
|
read -r -n 1 -p "Press any key to compile ioccc.c: "
|
||||||
|
echo 1>&2
|
||||||
|
make ioccc >/dev/null
|
||||||
|
echo 1>&2
|
||||||
|
read -r -n 1 -p "Press any key to run: ./ioccc: "
|
||||||
|
echo 1>&2
|
||||||
|
./ioccc
|
||||||
@@ -3705,6 +3705,11 @@ file to [spoilers.md](2014/endoh1/spoilers.md) to be clearer in its purpose as
|
|||||||
it is a file with spoilers (and too close to README.md?).
|
it is a file with spoilers (and too close to README.md?).
|
||||||
|
|
||||||
|
|
||||||
|
## [2014/endoh2](2014/endoh2/prog.c) ([README.md](2014/endoh2/README.md]))
|
||||||
|
|
||||||
|
[Cody](#cody) added the [try.sh](2014/endoh2/try.sh) script.
|
||||||
|
|
||||||
|
|
||||||
## [2014/maffiodo1](2014/maffiodo1/prog.c) ([README.md](2014/maffiodo1/README.md]))
|
## [2014/maffiodo1](2014/maffiodo1/prog.c) ([README.md](2014/maffiodo1/README.md]))
|
||||||
|
|
||||||
[Cody](#cody) fixed the build for this entry: it does not require
|
[Cody](#cody) fixed the build for this entry: it does not require
|
||||||
|
|||||||
Reference in new issue
Block a user