Add 2020/kurdyukov3/try.sh + format/typo checks

This commit is contained in:
Cody Boone Ferguson committed 2023-12-22 09:19:30 -08:00
1 parent 6e08da7f56
commit b6039b0aef
4 files changed
+70 -14

No files matched your search

+18 -13
View File
@@ -4,6 +4,9 @@
make
```
There is an alternate version of this program. See [Alternate
code](#alternate-code) below.
## To use:
@@ -15,27 +18,24 @@ make
### Try:
```sh
# first input to try
echo first input to try | ./prog
# try reading this output
echo International Obfuscated C Code Contest | ./prog
# try reading this other output
./prog < input.txt
./try.sh
```
## Alternate code:
There is an alternate version of this code in `prog.alt.c` where the main code is a macro.
The alternate version, [prog.alt.c](prog.alt.c), has the main code as a macro.
To compile this alternate version:
### Alternate build:
```sh
make alt
```
### Alternate use:
Use `prog.alt` as you would `prog` above.
@@ -50,12 +50,15 @@ languages) is called
[typoglycemia](https://www.mrc-cbu.cam.ac.uk/personal/matt.davis/Cmabrigde/)
(the article however is incorrect in stating that if the letters were more
jumbled or if other words were formed one could not read it: we know of some who
can in fact do exactly that).
can in fact do exactly that). Also, to be clear, there was no such study stated
in [input.txt](input.txt) but as you'll likely see you should be able to do
exactly what it says nonetheless.
## Author's remarks:
### Letter Mixer ###
### Letter Mixer
Compile and try this:
@@ -63,7 +66,9 @@ Compile and try this:
cat input.txt | ./prog
```
The program can work with letters that are not represented in English, as long as these letters are encoded in the higher part of the single-byte character set (use `iconv` to convert from UTF-8 and back).
The program can work with letters that are not represented in English, as long
as these letters are encoded in the higher part of the single-byte character set
(use `iconv` to convert from UTF-8 and back).
## Copyright and CC BY-SA 4.0 License:
+4 -1
View File
@@ -1 +1,4 @@
Using the incredible power of the human brain, according to research at Cambridge University, it doesn't matter in what order the letters in a word are, the only important thing is that the first and last letter be in the right place. The rest can be a total, mess and you can read it without a problem.
Using the incredible power of the human brain, according to research at
Cambridge University, it doesn't matter in what order the letters in a word
are, the only important thing is that the first and last letter be in the right
place. The rest can be a total, mess and you can read it without a problem.
+39
View File
@@ -0,0 +1,39 @@
#!/usr/bin/env bash
#
# try.sh - demonstrate IOCCC winner 2020/kurdyukov2
#
# 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
# first input to try
read -r -n 1 -p "Press any key to run: echo first input to try | ./prog: "
echo 1>&2
echo first input to try | ./prog
echo 1>&2
# try reading this output
read -r -n 1 -p "Press any key to run: echo International Obfuscated C Code Contest | ./prog: "
echo 1>&2
echo International Obfuscated C Code Contest | ./prog
echo 1>&2
# try reading this other output
read -r -n 1 -p "Press any key to show input.txt: "
echo 1>&2
cat input.txt
echo 1>&2
echo 1>&2
read -r -n 1 -p "Press any key to run: ./prog < input.txt: "
echo 1>&2
./prog < input.txt