improve how markdown code language is commented
We added a space between the markdown triple code mark and language that was enclosed in HTML comments. So a line of the form: ```` ```<!---c---> ```` became: ```` ``` <!---c---> ```` This was done to **help** some code see that the HTML comment string was not a markdown code specifier. Not all code understands this after this changed. For example, `pandoc(1)` still forms HTML classes of the form "<!---c-->" when it encounters the above mentioned change. We also fixed a problem with `2019/dogon/README.md` regarding a markdown code block. We also fixed a problem with `2020/yang/README.md` regarding a markdown code block.
This commit is contained in:
1 parent
c549f6585e
commit
3ddbac9e6b
357 files changed
+2432
-2399
No files matched your search
@@ -1,6 +1,6 @@
|
||||
## To build:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
make
|
||||
```
|
||||
|
||||
@@ -18,14 +18,14 @@ For more detailed information see [2019 adamovsky bugs](../../bugs.html#2019_ada
|
||||
|
||||
## To use:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./prog file.unl
|
||||
```
|
||||
|
||||
|
||||
## Try:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./try.sh
|
||||
```
|
||||
|
||||
@@ -47,7 +47,7 @@ Functional programming is not a panacea against core dumps, after all.
|
||||
|
||||
This can be demonstrated by:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./prog crash.unl
|
||||
```
|
||||
|
||||
@@ -84,7 +84,7 @@ by the sheer length of the dividing line and totally overlooks the rest of the p
|
||||
|
||||
When built directly using
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
make
|
||||
```
|
||||
|
||||
@@ -92,7 +92,7 @@ the program (`prog`) accepts a single parameter with the name of an Unlambda pro
|
||||
download the [Colossal Cave Adventure][1] (the [advent.unl](advent.unl) file)
|
||||
and run it like this:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./prog advent.unl
|
||||
```
|
||||
|
||||
@@ -105,7 +105,7 @@ entries from [quine contest][4].
|
||||
There is an alternative build path that requires the 2018 IOCCC size tool to complete. Put the tool
|
||||
source [iocccsize_2018.c](iocccsize_2018.c) in the project directory and call
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
make identify
|
||||
```
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
## To build:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
make
|
||||
```
|
||||
|
||||
@@ -18,7 +18,7 @@ For more detailed information see [2019 burton bugs](../../bugs.html#2019_burton
|
||||
|
||||
## To use:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./prog < file
|
||||
|
||||
./cow file
|
||||
@@ -27,7 +27,7 @@ For more detailed information see [2019 burton bugs](../../bugs.html#2019_burton
|
||||
|
||||
## Try:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./try.sh
|
||||
```
|
||||
|
||||
@@ -51,7 +51,7 @@ The output should look familiar.
|
||||
|
||||
Compiles cleanly with:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
WARN="-Wno-implicit-int -Wno-missing-variable-declarations -Wno-parentheses"
|
||||
cc -Wall -Wextra -Weverything -pedantic $WARN -include stdio.h -o prog prog.c
|
||||
```
|
||||
@@ -63,7 +63,7 @@ programs, it is silent upon success; any output demonstrates an error. Instead
|
||||
of checking correctness, the [check.sh](check.sh) script can simply output the
|
||||
results: (The Makefile contains the spoiler):
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
out=cat ./check.sh ./prog
|
||||
```
|
||||
|
||||
@@ -97,7 +97,7 @@ interface.
|
||||
|
||||
Included is a version without compilation warnings:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
cc -Wall -Wextra -Weverything -pedantic -include stdio.h -o prog.clean prog.clean.c
|
||||
```
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
## To build:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
make
|
||||
```
|
||||
|
||||
@@ -22,14 +22,14 @@ For more detailed information see [2019 ciura bugs](../../bugs.html#2019_ciura).
|
||||
|
||||
## To use:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./getwords.sh en | grep .. | ./prog string
|
||||
```
|
||||
|
||||
|
||||
## Try:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./try.sh
|
||||
```
|
||||
|
||||
@@ -42,7 +42,7 @@ newline. See the Author's remarks for more information.
|
||||
|
||||
### Alternate build:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
make alt
|
||||
```
|
||||
|
||||
@@ -54,7 +54,7 @@ Use `prog.alt` as you would `prog` above.
|
||||
|
||||
### Alternate try:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./try.alt.sh
|
||||
```
|
||||
|
||||
@@ -83,7 +83,7 @@ of the alphabet exactly once.
|
||||
|
||||
#### Example execution:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
$ grep .. /usr/share/dict/words | ./prog abcdefghijklmnopqrstuvwxyz
|
||||
qualm fjord wiz pyx vs beg kc nth
|
||||
quartz jinx vs fed kc womb glyph
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
## To build:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
make
|
||||
```
|
||||
|
||||
|
||||
## To use:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./prog < file > file.Z
|
||||
```
|
||||
|
||||
|
||||
## Try:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./try.sh
|
||||
```
|
||||
|
||||
@@ -37,19 +37,19 @@ compresses differently? The judges know. :)
|
||||
|
||||
#### Usage:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./prog < input.txt > input.txt.Z
|
||||
```
|
||||
|
||||
#### Example:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./prog < guidelines.txt > guidelines.txt.Z
|
||||
```
|
||||
|
||||
#### Check for correctness:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
zcat guidelines.txt.Z > guidelines2.txt
|
||||
diff -s guidelines.txt guidelines2.txt
|
||||
```
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
## To build:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
make
|
||||
```
|
||||
|
||||
|
||||
## To use:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./prog
|
||||
```
|
||||
|
||||
|
||||
## Try:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./try.sh
|
||||
```
|
||||
|
||||
@@ -33,7 +33,7 @@ that you are dreaming? Or is it, wake up from the simulation?
|
||||
|
||||
This program prints its own SHA-512 hash. To verify, run:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
$ sha512sum prog.c; ./prog
|
||||
43bd0c4381a5078d2850fca9ae5e0647596bcc03cd67d8d973ad02ff35c316c728e7b347ca70abe6c74e745e63646cc7643cb0cffcd3d9a969cbf31a7ce5bf68 prog.c
|
||||
43bd0c4381a5078d2850fca9ae5e0647596bcc03cd67d8d973ad02ff35c316c728e7b347ca70abe6c74e745e63646cc7643cb0cffcd3d9a969cbf31a7ce5bf68
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
## To build:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
make
|
||||
```
|
||||
|
||||
@@ -18,14 +18,14 @@ For more detailed information see [2019 dogon bugs](../../bugs.html#2019_dogon).
|
||||
|
||||
## To use:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./prog < pattern.mc
|
||||
```
|
||||
|
||||
|
||||
## Try:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./try.sh
|
||||
```
|
||||
|
||||
@@ -247,13 +247,13 @@ of his vast knowledge regarding GOL programming and hashlife. As a free bonus,
|
||||
Tom has allowed me to show his code which is probably the most efficient yet
|
||||
most obfuscated way of calculating the GOL function on a 64 bits `8*8` leaf:
|
||||
|
||||
```<!---`c-->
|
||||
``` <!---c-->
|
||||
unsigned long life8x8(long a) { unsigned long aw = a << 1, ae = a >> 1, s0 = aw
|
||||
^ ae, s1 = aw & ae, hs0 = s0 ^ a, hs1 = (s0 & a) | s1, hs0w8 = hs0 >> 8, hs0e8 =
|
||||
hs0 << 8, hs1w8 = hs1 >> 8, hs1e8 = hs1 << 8, ts0 = hs0w8 ^ hs0e8, ts1 = (hs0w8
|
||||
& hs0e8) | (ts0 & s0); return (hs1w8 ^ hs1e8 ^ ts1 ^ s1) & ((hs1w8 | hs1e8) ^
|
||||
(ts1 | s1)) & ((ts0 ^ s0) | a); }
|
||||
```<!---`-->
|
||||
```
|
||||
|
||||
This uses only 19 bitwise operations and six shifts to calculate the inner 6x6
|
||||
next generation bits of the input 8x8 !
|
||||
|
||||
@@ -321,7 +321,11 @@ master, who reviewed some earlier versions of the entry and freely shared some
|
||||
of his vast knowledge regarding GOL programming and hashlife. As a free bonus,
|
||||
Tom has allowed me to show his code which is probably the most efficient yet
|
||||
most obfuscated way of calculating the GOL function on a 64 bits <code>8*8</code> leaf:</p>
|
||||
<p><code><!---`c--> unsigned long life8x8(long a) { unsigned long aw = a << 1, ae = a >> 1, s0 = aw ^ ae, s1 = aw & ae, hs0 = s0 ^ a, hs1 = (s0 & a) | s1, hs0w8 = hs0 >> 8, hs0e8 = hs0 << 8, hs1w8 = hs1 >> 8, hs1e8 = hs1 << 8, ts0 = hs0w8 ^ hs0e8, ts1 = (hs0w8 & hs0e8) | (ts0 & s0); return (hs1w8 ^ hs1e8 ^ ts1 ^ s1) & ((hs1w8 | hs1e8) ^ (ts1 | s1)) & ((ts0 ^ s0) | a); }</code><!---`--></p>
|
||||
<pre class="<!---c-->"><code> unsigned long life8x8(long a) { unsigned long aw = a << 1, ae = a >> 1, s0 = aw
|
||||
^ ae, s1 = aw & ae, hs0 = s0 ^ a, hs1 = (s0 & a) | s1, hs0w8 = hs0 >> 8, hs0e8 =
|
||||
hs0 << 8, hs1w8 = hs1 >> 8, hs1e8 = hs1 << 8, ts0 = hs0w8 ^ hs0e8, ts1 = (hs0w8
|
||||
& hs0e8) | (ts0 & s0); return (hs1w8 ^ hs1e8 ^ ts1 ^ s1) & ((hs1w8 | hs1e8) ^
|
||||
(ts1 | s1)) & ((ts0 ^ s0) | a); }</code></pre>
|
||||
<p>This uses only 19 bitwise operations and six shifts to calculate the inner 6x6
|
||||
next generation bits of the input 8x8 !</p>
|
||||
<!--
|
||||
|
||||
+10
-10
@@ -1,6 +1,6 @@
|
||||
## To build:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
make
|
||||
```
|
||||
|
||||
@@ -21,20 +21,20 @@ For more detailed information see [2019 duble bugs](../../bugs.html#2019_duble).
|
||||
|
||||
## To use:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./prog file
|
||||
```
|
||||
|
||||
|
||||
## Try:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./prog /tmp/drawing
|
||||
```
|
||||
|
||||
Open another window / terminal.
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./prog /tmp/drawing
|
||||
```
|
||||
|
||||
@@ -42,13 +42,13 @@ Open more terminals and repeat...
|
||||
|
||||
You might also wish to try a full screen size. For this try:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
make clobber fullscreen
|
||||
```
|
||||
|
||||
Alternatively, if you want to change the size, do something like:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
make clobber LINES=20 COLUMNS=20 all
|
||||
```
|
||||
|
||||
@@ -69,7 +69,7 @@ the editor.
|
||||
|
||||
After editing the file and quitting, try:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
/tmp/drawing
|
||||
```
|
||||
|
||||
@@ -97,7 +97,7 @@ alternate code might not work as well in macOS.
|
||||
|
||||
### Alternate build:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
make alt
|
||||
```
|
||||
|
||||
@@ -132,7 +132,7 @@ To build, type `make` (assuming gcc) or `make CC=clang`.
|
||||
|
||||
Then you can start the program. It expects a file path as its first argument:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./prog /tmp/drawing
|
||||
```
|
||||
|
||||
@@ -216,7 +216,7 @@ Note: the drawing files `prog` generates are probably even more portable than
|
||||
The default size is the one of my xterm (see top of Makefile).
|
||||
You may set it to the full size of your terminal window by typing:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
make clobber fullscreen
|
||||
```
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
## To build:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
make
|
||||
```
|
||||
|
||||
@@ -21,7 +21,7 @@ For more detailed information see [2019 endoh bugs](../../bugs.html#2019_endoh).
|
||||
|
||||
## To use:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./prog
|
||||
```
|
||||
|
||||
@@ -30,7 +30,7 @@ For more detailed information see [2019 endoh bugs](../../bugs.html#2019_endoh).
|
||||
|
||||
If you have `gdb(1)` installed:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./try.sh
|
||||
```
|
||||
|
||||
@@ -40,7 +40,7 @@ only been tested with linux.
|
||||
|
||||
You might also wish to try:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
gdb ./prog || lldb ./prog
|
||||
```
|
||||
|
||||
@@ -59,20 +59,20 @@ ascii` when debugging it to reveal its purpose.
|
||||
|
||||
Compile prog.c with no optimization.
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
cc -g -O0 -o prog prog.c
|
||||
```
|
||||
|
||||
Then, run it. You will see a segmentation fault.
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
$ ./prog
|
||||
Segmentation fault (core dumped)
|
||||
```
|
||||
|
||||
Let's debug. As usual, run it under gdb.
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
$ gdb ./prog
|
||||
(gdb) run
|
||||
Starting program: /home/.../prog
|
||||
@@ -132,7 +132,7 @@ The original program can be used as a GDB command file.
|
||||
|
||||
By using this, you can confirm that it is actually a quine.
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
gdb -q -x prog.c ./prog | sed -n -r 's/#.*:([0-9]+)/\1/p' | awk '{printf "%c",$1}' > prog2.c
|
||||
diff prog.c prog2.c
|
||||
```
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
## To build:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
make
|
||||
```
|
||||
|
||||
|
||||
## To use:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./prog infile.wav outfile.wav
|
||||
```
|
||||
|
||||
|
||||
## Try:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./try.sh
|
||||
```
|
||||
|
||||
@@ -62,7 +62,7 @@ Interesting fact: The size of the program from `./iocccsize -i` is 2019.
|
||||
|
||||
#### How to use:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./prog input [output [size [dry [wet [damping]]]]]
|
||||
prog.exe input [output [size [dry [wet [damping]]]]]
|
||||
```
|
||||
@@ -87,7 +87,7 @@ The default settings are designed to make the effect obvious rather than subtle,
|
||||
so it may be a good idea to adjust the ratio of "dry" to "wet", to give a more
|
||||
pleasant result:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./prog in.wav out.wav 1.8 80% 15%
|
||||
```
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
## To build:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
make
|
||||
```
|
||||
|
||||
@@ -21,13 +21,13 @@ For more detailed information see [2019 karns bugs](../../bugs.html#2019_karns).
|
||||
|
||||
## To use:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./prog < textfile_that_fits_on_the_screen
|
||||
```
|
||||
|
||||
You might want to type:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
reset
|
||||
```
|
||||
|
||||
@@ -36,13 +36,13 @@ after running the program to restore the terminal to its previous state.
|
||||
|
||||
## Try:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./try.sh
|
||||
```
|
||||
|
||||
If you have more time you might want to try:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./prog < README.md
|
||||
```
|
||||
|
||||
@@ -82,7 +82,7 @@ connected with anything.
|
||||
|
||||
This program usually compiles under both GCC and clang. Build with:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
$(CC) -std=c99 -o tbfs prog.c
|
||||
```
|
||||
|
||||
@@ -90,13 +90,13 @@ where `$(CC)` is cc, gcc, clang, or some other C compiler.
|
||||
|
||||
You can then run it with:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
cat <input file> | ./tbfs
|
||||
```
|
||||
|
||||
Examples:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./tbfs < maze
|
||||
./tbfs < prog.c
|
||||
```
|
||||
|
||||
+11
-11
@@ -1,6 +1,6 @@
|
||||
## To build:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
make
|
||||
```
|
||||
|
||||
@@ -18,14 +18,14 @@ For more detailed information see [2019 lynn bugs](../../bugs.html#2019_lynn).
|
||||
|
||||
## To use:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./prog
|
||||
```
|
||||
|
||||
|
||||
## Try:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./try.sh
|
||||
```
|
||||
|
||||
@@ -62,7 +62,7 @@ typeclasses. Just pass dictionaries explicitly.
|
||||
|
||||
Build the compiler:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
cc -o prog prog.c
|
||||
```
|
||||
|
||||
@@ -72,7 +72,7 @@ Build the compiler:
|
||||
|
||||
Test the compiler on [fib.hs](fib.hs):
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
(./prog < fib.hs ; cat prog.c) > fib.c
|
||||
```
|
||||
|
||||
@@ -81,7 +81,7 @@ Compiling the output produces a binary that prints the 30th Fibonacci number.
|
||||
The file [ghcfib.hs](ghcfib.hs) includes [fib.hs](fib.hs) with some glue code,
|
||||
and shows GHC also accepts our subset of Haskell:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
ghc ghcfib.hs
|
||||
```
|
||||
|
||||
@@ -93,7 +93,7 @@ instead provide [hint.hs](hint.hs), the output of a certain stage of the
|
||||
compiler when run on itself. This intermediate output is hopefully difficult to
|
||||
understand, yet is accepted by our compiler:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
(./prog < hint.hs ; cat prog.c) > hint.c
|
||||
make hint
|
||||
./hint
|
||||
@@ -116,7 +116,7 @@ languages"](https://www.cs.dartmouth.edu/~doug/nfa.pdf). We exercise it by
|
||||
showing the first entries of the length-ordered list of all strings consisting
|
||||
of the characters `a` and `b` that contain an even number of `a`s.
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
(./prog < lol.hs ; cat prog.c) > lol.c
|
||||
make lol
|
||||
./lol
|
||||
@@ -124,7 +124,7 @@ of the characters `a` and `b` that contain an even number of `a`s.
|
||||
|
||||
A GHC wrapper is provided:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
ghc ghclol.hs
|
||||
```
|
||||
|
||||
@@ -135,14 +135,14 @@ See [scc.hs](scc.hs) (and its GHC wrapper [ghcscc.hs](ghcscc.hs)) for an elegant
|
||||
way to print the strongly-connected components of a graph in reverse topological
|
||||
order.
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
(./prog < scc.hs ; cat prog.c) > scc.c
|
||||
```
|
||||
|
||||
It expects the input to be in a similar format as a previous entry
|
||||
(2018 vokes). For example:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
make scc
|
||||
./scc < example-1.txt
|
||||
./scc < example-2.txt
|
||||
|
||||
+22
-22
@@ -1,6 +1,6 @@
|
||||
## To build:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
make
|
||||
```
|
||||
|
||||
@@ -18,7 +18,7 @@ For more detailed information see [2019 mills bugs](../../bugs.html#2019_mills).
|
||||
|
||||
## To use:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
make cpclean
|
||||
# Let this run for about about an hour and then kill it:
|
||||
./prog Shakespeare.txt
|
||||
@@ -27,7 +27,7 @@ For more detailed information see [2019 mills bugs](../../bugs.html#2019_mills).
|
||||
|
||||
## Try:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./try.sh
|
||||
```
|
||||
|
||||
@@ -92,19 +92,19 @@ OMLET has three operating modes:
|
||||
For your first OMLET experiment, we will try training a simple single-level
|
||||
RNN to write some [Shakespeare][5] plays. Start by typing
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
make
|
||||
```
|
||||
|
||||
After it builds, train it using
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./prog Shakespere.txt
|
||||
```
|
||||
|
||||
This will immediately start outputting gibberish to the output, e.g.
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./prog Shakespere.txt
|
||||
```
|
||||
|
||||
@@ -259,7 +259,7 @@ doing `Control-C`.
|
||||
You can continue training from a previous checkpoint by providing the
|
||||
checkpoint file name as the second parameter, for example:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./prog Shakespeare.txt cp01_1.970
|
||||
```
|
||||
|
||||
@@ -275,7 +275,7 @@ parameters to generate data. Inference mode takes the checkpoint file as
|
||||
*standard input* (not on the command line) and hence must be run with a
|
||||
command like
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./prog < cp55_1.807
|
||||
```
|
||||
|
||||
@@ -294,7 +294,7 @@ The default network for OMLET (the one you get if you type `make` with the
|
||||
executable name `prog`) is the simplest recurrent neural network. It looks
|
||||
like
|
||||
|
||||
```<!---c-->
|
||||
``` <!---c-->
|
||||
h = tanh(Wxh * x + Whh * h' + Bh)
|
||||
y = Why * h + By
|
||||
```
|
||||
@@ -317,26 +317,26 @@ It is the presence of the hidden state vector that allows the RNN to
|
||||
"remember" the past. We can see what would happen if we removed this hidden
|
||||
state. If you type
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
make lin1
|
||||
```
|
||||
|
||||
OMLET will create an [ADALINE][10] network that does
|
||||
|
||||
```<!---c-->
|
||||
``` <!---c-->
|
||||
y = Wxy * x + By
|
||||
```
|
||||
|
||||
This is a simple [linear][11] [feed-forward network][12]. You can run it with
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./lin1 Shakespeare.txt
|
||||
```
|
||||
|
||||
The linear network won't be able to get past the gibberish stage, because it
|
||||
lacks history:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./lin1 Shakespeare.txt
|
||||
```
|
||||
|
||||
@@ -388,7 +388,7 @@ the language but `per` with the digit 1).
|
||||
We can try to improve the RNN's performance by stacking RNN modules atop each
|
||||
other:
|
||||
|
||||
```<!---c-->
|
||||
``` <!---c-->
|
||||
h1 = RNN(h1', x)
|
||||
h2 = RNN(h2', h1)
|
||||
y = Why * h2 + By
|
||||
@@ -414,13 +414,13 @@ the hard limit with `limit -h stacksize` and set it with
|
||||
|
||||
You can try the deeper network by doing
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
make rnn2
|
||||
```
|
||||
|
||||
(or even `make rnn3` if you want a three-layer RNN) and train it with
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./rnn2 Shakespeare.txt
|
||||
```
|
||||
|
||||
@@ -444,13 +444,13 @@ gradient, worsening the exploding and vanishing gradient problem.
|
||||
solve this problem. Christopher Olah gives a good description of them
|
||||
at his [blog posting][20]. You can build a two-level LSTM by doing
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
make lstm2
|
||||
```
|
||||
|
||||
and train with it with
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./lstm2 Shakespeare.txt
|
||||
```
|
||||
|
||||
@@ -464,7 +464,7 @@ its hidden state via "gates". These gates are called
|
||||
|
||||
The basic LSTM equations are
|
||||
|
||||
```<!---c-->
|
||||
``` <!---c-->
|
||||
f = sigmoid(Wxf * x + Whf * h' + Bf)
|
||||
i = sigmoid(Wxi * x + Whi * h' + Bi)
|
||||
o = sigmoid(Wxo * x + Who * h' + Bo)
|
||||
@@ -496,7 +496,7 @@ simplified versions of an LSTM which combine the gates together, meaning they
|
||||
require fewer learned parameters. This allows them to train faster than a
|
||||
generic LSTM. You can build a two-layer GRU with
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
make gru2
|
||||
```
|
||||
|
||||
@@ -510,7 +510,7 @@ compiler's command-line by using `-D` directives. The network is defined by
|
||||
a `-DNW='...'` command which consists of a series of comma-separated
|
||||
assignments. For example, the simple one-layer RNN could be defined like
|
||||
|
||||
```<!---make-->
|
||||
``` <!---make-->
|
||||
-DNW=' x = I(n), hp = I(128), \
|
||||
h = C(hp, T(A(L(128, x), L(128, hp)))), \
|
||||
y = L(n, h)'
|
||||
@@ -555,7 +555,7 @@ training mode, this is used to generate the loss which is backpropagated.
|
||||
As an example of a more complicated network, we can look at a two-layer
|
||||
GRU network:
|
||||
|
||||
```<!---make-->
|
||||
``` <!---make-->
|
||||
-DHS=128, \
|
||||
-DNW=' x = I(n), \
|
||||
y = L(n, MD(MD(x)))' \
|
||||
|
||||
+10
-10
@@ -1,6 +1,6 @@
|
||||
## To build:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
make
|
||||
```
|
||||
|
||||
@@ -26,7 +26,7 @@ For more detailed information see [2019 poikola bugs](../../bugs.html#2019_poiko
|
||||
|
||||
## To use:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./prog 512 ./prog
|
||||
|
||||
sleep 86400; make clobber prog
|
||||
@@ -38,7 +38,7 @@ For more detailed information see [2019 poikola bugs](../../bugs.html#2019_poiko
|
||||
|
||||
If you wish for some documentation:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
make docs
|
||||
```
|
||||
|
||||
@@ -49,7 +49,7 @@ This will create the file `poikola.pdf` for your enjoyment.
|
||||
|
||||
If you don't have a few days, try:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./try.sh
|
||||
```
|
||||
|
||||
@@ -65,7 +65,7 @@ what can be done with the original entry.
|
||||
|
||||
### Alternate build:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
make alt
|
||||
```
|
||||
|
||||
@@ -77,7 +77,7 @@ Use `prog.alt` as you would `prog` above.
|
||||
|
||||
### Alternate try:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./try.alt.sh
|
||||
```
|
||||
|
||||
@@ -103,19 +103,19 @@ Nykänen](https://en.wikipedia.org/wiki/Matti_Nyk%C3%A4nen).
|
||||
|
||||
### How to build:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
gcc -O0 -o prog prog.c
|
||||
```
|
||||
|
||||
or
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
clang -O[0123s] -o prog prog.c
|
||||
```
|
||||
|
||||
e.g.:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
clang -O1 -o prog prog.c
|
||||
```
|
||||
|
||||
@@ -166,7 +166,7 @@ unnecessary checks, but either fails or gets stuck if invoked erroneously. The
|
||||
program is invoked in this way:
|
||||
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./prog <integer> <file>
|
||||
```
|
||||
|
||||
|
||||
+15
-15
@@ -1,6 +1,6 @@
|
||||
## To build:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
make
|
||||
```
|
||||
|
||||
@@ -18,7 +18,7 @@ For more detailed information see [2019 yang bugs](../../bugs.html#2019_yang).
|
||||
|
||||
## To use:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./prog sample_input.txt a b c d
|
||||
|
||||
cat a
|
||||
@@ -35,7 +35,7 @@ For more detailed information see [2019 yang bugs](../../bugs.html#2019_yang).
|
||||
|
||||
## Try:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./try.sh
|
||||
```
|
||||
|
||||
@@ -52,7 +52,7 @@ output again.
|
||||
|
||||
Scramble/unscramble to single file:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./prog original.txt > scrambled.txt
|
||||
|
||||
./prog < scrambled.txt > unscrambled.txt
|
||||
@@ -60,7 +60,7 @@ Scramble/unscramble to single file:
|
||||
|
||||
Scramble/unscramble to multiple files:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./prog input.txt output1.txt output2.txt ...
|
||||
|
||||
cat output1.txt output2.txt ... | ./prog > unscrambled.txt
|
||||
@@ -68,7 +68,7 @@ Scramble/unscramble to multiple files:
|
||||
|
||||
Re-scramble:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./prog original.txt | ./prog - > scrambled1.txt
|
||||
./prog original.txt | ./prog - | ./prog - > scrambled2.txt
|
||||
./prog original.txt | ./prog - | ./prog - | ... > scrambled3.txt
|
||||
@@ -76,7 +76,7 @@ Re-scramble:
|
||||
|
||||
Scramble slowly:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./prog input.txt | ruby prog.c
|
||||
```
|
||||
|
||||
@@ -87,14 +87,14 @@ Input must be in UTF-8 encoding.
|
||||
This is a text scrambling utility. To scramble text, specify input file name as
|
||||
the first argument:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./prog input.txt > output.txt
|
||||
```
|
||||
|
||||
If original input file was small enough to fit in your terminal, you
|
||||
can simply use `cat` to unscramble the output text.
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
cat output.txt
|
||||
```
|
||||
|
||||
@@ -106,7 +106,7 @@ order. This effect is more visible if there is a delay after each character is
|
||||
printed. For convenience, a utility is included in the source to output
|
||||
characters slowly:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./prog input.txt | ruby prog.c
|
||||
```
|
||||
|
||||
@@ -114,14 +114,14 @@ Scrambling order is deterministic, but you can reshuffle the output by
|
||||
piping it through the same utility again, by specifying `-` as the
|
||||
first argument:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./prog input.txt | ./prog - | ./prog - | ...
|
||||
```
|
||||
|
||||
You can also split the input to multiple files, each getting a subset
|
||||
of the original input characters:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./prog input.txt output1.txt output2.txt ...
|
||||
cat output1.txt output2.txt ... > unscrambled.txt
|
||||
```
|
||||
@@ -138,7 +138,7 @@ positions to be misaligned. But fear not, this utility also includes
|
||||
unscrambling functionality. If no argument is specified, input will
|
||||
be read through `stdin` and unscrambled to `stdout`:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./prog < scrambled.txt > unscrambled.txt
|
||||
```
|
||||
|
||||
@@ -146,7 +146,7 @@ Where this is useful is that if you scramble the input to multiple
|
||||
files and unscramble each output file individually, those output
|
||||
files can be printed on transparencies and distributed separately.
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./prog input.txt output1.txt output2.txt output3.txt
|
||||
./prog < output1.txt > layer1.txt
|
||||
./prog < output2.txt > layer2.txt
|
||||
@@ -159,7 +159,7 @@ In other words, this is a utility for facilitating
|
||||
This utility can also be used just for removing trailing whitespaces
|
||||
and expanding tabs to 8 spaces.
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./prog input.txt | ./prog
|
||||
```
|
||||
|
||||
|
||||
Reference in new issue
Block a user