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
|
||||
```
|
||||
|
||||
@@ -22,7 +22,7 @@ For more detailed information see [2018 algmyr bugs](../../bugs.html#2018_algmyr
|
||||
|
||||
## To use:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./prog < prog.c # Print garbage: might mess up your terminal
|
||||
./prog <file1> <file2> > out.raw
|
||||
./prog -d 2 0 out.raw # Decode the first (0th) channel out of two
|
||||
@@ -31,7 +31,7 @@ For more detailed information see [2018 algmyr bugs](../../bugs.html#2018_algmyr
|
||||
|
||||
## Try:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./try.sh
|
||||
```
|
||||
|
||||
@@ -164,13 +164,13 @@ standards compliant). This is used to print the usage instructions.
|
||||
|
||||
Compiling using
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
gcc -Wall -Wextra -pedantic
|
||||
```
|
||||
|
||||
gives only `-Wmisleading-indentation` which is sensible considering the source code. While
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
clang -Wall -Wextra -pedantic
|
||||
```
|
||||
|
||||
@@ -179,7 +179,7 @@ bodies), `-Wstring-plus-int` (since apparently some people think string+`int` is
|
||||
concatenation) and one of the weirder warnings I have seen from me splitting a
|
||||
negative constant with whitespace. Compiling using
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
clang -Wall -Wextra -pedantic -Weverything
|
||||
```
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
## To build:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
make
|
||||
```
|
||||
|
||||
@@ -10,14 +10,14 @@ code](#alternate-code) below for more details.
|
||||
|
||||
## To use:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./prog < textfile
|
||||
```
|
||||
|
||||
|
||||
## Try:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./try.sh
|
||||
```
|
||||
|
||||
@@ -31,7 +31,7 @@ it was not the shape of the Roman V that we, or the compiler, didn't like.
|
||||
|
||||
### Alternate build:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
make alt
|
||||
```
|
||||
|
||||
@@ -43,7 +43,7 @@ Use `prog.alt` as you would `prog` above.
|
||||
|
||||
### Alternate try:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./try.alt.sh
|
||||
```
|
||||
|
||||
@@ -58,7 +58,7 @@ down](http://en.wikipedia.org/wiki/River_%28typography%29)!
|
||||
|
||||
### Compiling the program:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
cc -Wall -Wextra -Wpedantic -O3 -std=c11 prog.c -o prog
|
||||
```
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
## To build:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
make
|
||||
```
|
||||
|
||||
@@ -10,7 +10,7 @@ code](#alternate-code) below.
|
||||
|
||||
## To use:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./prog > lena.ppm
|
||||
```
|
||||
|
||||
@@ -21,7 +21,7 @@ First open [Lenna.png](Lenna.png) in your graphics viewer of choice. Next, after
|
||||
running the above command (`./prog > lena.ppm`), open `lena.ppm` in your
|
||||
graphics viewer of choice. After that try:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./try.sh
|
||||
```
|
||||
|
||||
@@ -44,7 +44,7 @@ for Windows.
|
||||
|
||||
### Alternate build:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
make alt
|
||||
```
|
||||
|
||||
@@ -99,7 +99,7 @@ Although the program was optimized to decompress its built-in image,
|
||||
it accepts to decompress image files from its standard
|
||||
input. Examples:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./prog d < lena512.bin > lena512.ppm
|
||||
./prog d < fruits.bin > fruits.ppm
|
||||
./prog d < vintage_cars.bin > vintage_cars.ppm
|
||||
|
||||
+11
-11
@@ -1,6 +1,6 @@
|
||||
## To build:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
make
|
||||
```
|
||||
|
||||
@@ -10,14 +10,14 @@ code](#alternate-code) below.
|
||||
|
||||
## To use:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./prog < any-file
|
||||
```
|
||||
|
||||
|
||||
## Try:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./try.sh
|
||||
```
|
||||
|
||||
@@ -32,7 +32,7 @@ with `-Wno-` options.
|
||||
|
||||
### Alternate build:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
make alt
|
||||
```
|
||||
|
||||
@@ -82,7 +82,7 @@ and without bypassing the solution using `execve(2)`, or functions built upon it
|
||||
E.g:
|
||||
|
||||
|
||||
```<!---c-->
|
||||
``` <!---c-->
|
||||
main(){system("hd");} // it's turtles all the way down!
|
||||
```
|
||||
|
||||
@@ -96,7 +96,7 @@ This solution is pleasing, but a true one-liner was the hoped-for goal.
|
||||
Here is the 157 character version in it's entirety:
|
||||
|
||||
|
||||
```<!---c-->
|
||||
``` <!---c-->
|
||||
char O,o[ 20];L(O){
|
||||
putchar ( O+ 48+39 *(9<
|
||||
O));} I(O) {L(~ 15);
|
||||
@@ -115,7 +115,7 @@ The progression to the present size is interesting,
|
||||
and it is interesting that the same algorithm can be expressed so differently
|
||||
by slight rearrangement of its parts.
|
||||
|
||||
```<!---c-->
|
||||
``` <!---c-->
|
||||
// 119
|
||||
char O,o[20];main(l){for(;~(l=getchar());O||puts(o))o[O++]=isprint(l)?l:46,O&=15,printf("%02x ",l);O[o]=0;O&&puts(o);}
|
||||
// 116
|
||||
@@ -139,7 +139,7 @@ These do not compete in the same category, since their output is materially diff
|
||||
They are derived from the solutions above, but are still fascinating as concise utilities,
|
||||
so here is their progression, for the curious:
|
||||
|
||||
```<!---c-->
|
||||
``` <!---c-->
|
||||
// 102
|
||||
I;O(O){putchar(O+48+39*(9<O));}main(l){for(;~(l=getchar());O(++I&15?~15:~37))O(l>>4),O(l&15);O(-38);}
|
||||
// 80
|
||||
@@ -156,7 +156,7 @@ It is possible to reduce the size of each of these by one by eliding the trailin
|
||||
This was not reported above since the newline kept getting appended by processing software,
|
||||
and it is more interesting to remove characters by changing code than by filtering:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
$ tr -d '\012' < 109.c | wc -c
|
||||
108
|
||||
$ tr -d '\012' < 76.c | wc -c
|
||||
@@ -257,13 +257,13 @@ the expression within the ternary remains too complex.
|
||||
|
||||
Try:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
cat prog.c prog.alt.c
|
||||
```
|
||||
|
||||
or
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
cmp -b prog.c prog.alt.c
|
||||
```
|
||||
|
||||
|
||||
+13
-13
@@ -1,26 +1,26 @@
|
||||
## To build:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
make
|
||||
```
|
||||
|
||||
|
||||
## To use:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./prog [-tcksri] < file.c
|
||||
```
|
||||
|
||||
|
||||
## Try:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./try.sh
|
||||
```
|
||||
|
||||
If you get really stuck, try:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
man ./tac.1
|
||||
```
|
||||
|
||||
@@ -113,7 +113,7 @@ There is one (known) remaining problem with detection:
|
||||
* Comments between preprocessor hash and keyword are not replaced with whitespace;
|
||||
the following counts #include as two tokens, `#` and `include` (not as a reserved word):
|
||||
|
||||
```<!---c-->
|
||||
``` <!---c-->
|
||||
#/*this will not be counted*/include/*correctly*/<stdio.h>
|
||||
```
|
||||
|
||||
@@ -128,14 +128,14 @@ counting words correctly absent `-k`.
|
||||
|
||||
`tac` was run over all 366 previous IOCCC winning entries:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
find ~/src/obc -type f -name \*.c | wc
|
||||
```
|
||||
|
||||
The discrepancies found are documented and explained in the file
|
||||
[discrepancies.html](discrepancies.html).
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
find ~/src/obc -type f -a -name "*.c" | xargs ./spotcheck.sh ./prog | ./spotdiff.sh |
|
||||
grep -v keep | diff -bw - discrep* | grep "[<>] cl "
|
||||
```
|
||||
@@ -181,14 +181,14 @@ For instance, here is a simple token counter, useful in finding repeated long to
|
||||
frequency, or counting the references to identifiers, constants, or breadth of use of the
|
||||
language:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
#!/usr/bin/env bash
|
||||
cat $* | ./prog -t | sort | uniq -c | sort -k1nr
|
||||
```
|
||||
|
||||
And here is a C keyword frequency counter:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
#!/usr/bin/env bash
|
||||
function iskeyword {
|
||||
awk 'BEGIN{f="c11";while(getline<f)k[$1]=0} {if($1 in k)k[$1]++}END{for(i in k)print k[i],i}'
|
||||
@@ -222,7 +222,7 @@ simple code below is a serviceable obfuscated C de-obfuscator in a _scripting
|
||||
language_. It really is this easy with `tac`:
|
||||
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
#!/usr/bin/env bash
|
||||
script='
|
||||
BEGIN {
|
||||
@@ -342,7 +342,7 @@ which is neither complete (`#define`, `#ifndef`, `#undef` are missing
|
||||
-- yes, Virginia knows about `#define` omitted on purpose),
|
||||
nor correct (many more are added: `I`, `true`, `bool`, `compl`, ...):
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
(sed -n '1p' c11; sed -n '2,$p' ioccc.kw.freq | sort) | comm -3 - c11
|
||||
```
|
||||
|
||||
@@ -383,7 +383,7 @@ NB: This is *not* a portability concern, the one string holds only printable ASC
|
||||
|
||||
Thus:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
cc -ansi -Wall -trigraphs -Wno-trigraphs -Wno-parentheses -Wno-empty-body -Wno-char-subscripts -Wno-pointer-sign -DU=O -DW=\"keywords\" -o prog prog.c
|
||||
```
|
||||
|
||||
@@ -403,7 +403,7 @@ are not recognised when written as `-rs` in prose).
|
||||
|
||||
Try:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./manpage.sh tac
|
||||
|
||||
./manpage.sh -h
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
## To build:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
make
|
||||
```
|
||||
|
||||
@@ -11,14 +11,14 @@ below for more details.
|
||||
|
||||
## To use:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./prog < text
|
||||
```
|
||||
|
||||
|
||||
## Try:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./try.sh
|
||||
```
|
||||
|
||||
@@ -32,7 +32,7 @@ useful bug fix.
|
||||
|
||||
### Alternate build:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
make alt
|
||||
```
|
||||
|
||||
@@ -44,7 +44,7 @@ Use `prog.alt` as you would `prog` above.
|
||||
|
||||
### Alternate try:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./try.alt.sh
|
||||
```
|
||||
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
## To build:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
make
|
||||
```
|
||||
|
||||
|
||||
## To use:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./prog < textfile > output.gif
|
||||
```
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
To see the input files and feed them to the program, redirecting to GIF files:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./try.sh
|
||||
```
|
||||
|
||||
@@ -40,7 +40,7 @@ least 2MiB of memory to run in.
|
||||
|
||||
This program generates an animated GIF from a plain text. Run:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
cc -o prog prog.c
|
||||
./prog < invisible.txt > invisible.gif
|
||||
```
|
||||
@@ -51,14 +51,14 @@ letters that leave the mark and ones that do not?
|
||||
|
||||
Other examples:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./prog < golem.txt > golem.gif
|
||||
./prog < smily.txt > smily.gif
|
||||
```
|
||||
|
||||
The program itself has a hidden message.
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./prog < prog.c > prog.gif
|
||||
```
|
||||
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
## To build:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
make
|
||||
```
|
||||
|
||||
|
||||
## To use:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./prog
|
||||
```
|
||||
|
||||
|
||||
## Try:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./try.sh
|
||||
```
|
||||
|
||||
|
||||
+38
-38
@@ -1,6 +1,6 @@
|
||||
## To build:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
make
|
||||
```
|
||||
|
||||
@@ -10,14 +10,14 @@ monkey Eric. See [Alternate code](#alternate-code) below.
|
||||
|
||||
## To use:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./weasel
|
||||
```
|
||||
|
||||
|
||||
## Try:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./try.sh
|
||||
|
||||
# For those who believe in '"intelligent" design' or want to see how easy it is
|
||||
@@ -47,7 +47,7 @@ about this under the [keyboards](#keyboards) section, briefly referred to in the
|
||||
|
||||
### Alternate build:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
make alt
|
||||
```
|
||||
|
||||
@@ -59,7 +59,7 @@ Use `weasel.alt` as you would `weasel` above.
|
||||
|
||||
### Alternate try:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./try.alt.sh
|
||||
|
||||
# For those who believe in '"intelligent" design' or want to see how easy it is
|
||||
@@ -80,7 +80,7 @@ detail in the [S, M and N Constants](#constants) section. The script above will
|
||||
make use of some of these.
|
||||
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./try.alt.sh
|
||||
```
|
||||
|
||||
@@ -107,7 +107,7 @@ while using more Cenozoic minded code migration, read [rpm.html](rpm.html).
|
||||
|
||||
If you find yourself in an evolutionary dead end, try:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
man ./weasel.1
|
||||
```
|
||||
|
||||
@@ -139,7 +139,7 @@ texts. To resolve this I think the best way is referencing the judges' remarks:
|
||||
if you want a quick rundown of the entry try what they suggest and view the man
|
||||
page (it explains all the options and describes the program briefly):
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
man ./weasel.man
|
||||
```
|
||||
|
||||
@@ -444,7 +444,7 @@ has more than one word (that is it contains spaces) or anything else interpreted
|
||||
specially by your shell e.g. parentheses. For instance if you just want to find
|
||||
`METHINKS` you could do one of:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./weasel METHINKS
|
||||
./weasel "METHINKS"
|
||||
./weasel 'METHINKS'
|
||||
@@ -452,14 +452,14 @@ specially by your shell e.g. parentheses. For instance if you just want to find
|
||||
|
||||
If you wanted `YOU ARE A MONKEY`:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./weasel "YOU ARE A MONKEY"
|
||||
./weasel 'YOU ARE A MONKEY'
|
||||
```
|
||||
|
||||
If you do one of:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./weasel "METHINKS IT IS A" "MONKEY"
|
||||
./weasel METHINKS IT IS A MONKEY
|
||||
```
|
||||
@@ -472,7 +472,7 @@ If you actually do want to search for a string starting with a `-` you must
|
||||
disable further parsing of options by using the `-` option itself; for
|
||||
example if you were to do any of:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./weasel -q- -- -test
|
||||
./weasel -q- -test
|
||||
./weasel -q -- -test
|
||||
@@ -480,7 +480,7 @@ example if you were to do any of:
|
||||
|
||||
The target string will be: `-TEST`. This means though that here:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./weasel -q -- -test -r5
|
||||
```
|
||||
|
||||
@@ -498,7 +498,7 @@ are equivalent:
|
||||
|
||||
As for the caveat I referenced what does the following do?
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./weasel -qr 5
|
||||
```
|
||||
|
||||
@@ -510,7 +510,7 @@ note on the parsing of the `-` option; if the program is currently parsing
|
||||
the other options are in the command line it might still parse the options. Thus
|
||||
you have:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
$ ./weasel -qr-r5
|
||||
quiet output
|
||||
mutation rate out of range
|
||||
@@ -522,14 +522,14 @@ you have:
|
||||
Similarly this would set quiet output, then an invalid mutation rate and then a
|
||||
mutation rate of 5:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./weasel --qrr5
|
||||
```
|
||||
|
||||
|
||||
If you were instead to do one of (for example):
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./weasel -q -- -r
|
||||
./weasel -q -q- -r
|
||||
```
|
||||
@@ -568,7 +568,7 @@ requested? There are at least two ways to go about it: I took the monkey safe
|
||||
('fool safe') method; *if you explicitly request monkey mode you cannot disable
|
||||
it in the same invocation of `weasel`!
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
$ ./weasel -qr101r5r101r1r test
|
||||
quiet output
|
||||
mutation rate out of range
|
||||
@@ -633,7 +633,7 @@ in monkey mode.
|
||||
|
||||
Another example:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
$ ./weasel -q -r101 test -r5
|
||||
quiet output
|
||||
mutation rate out of range
|
||||
@@ -649,7 +649,7 @@ which means that it'll use the genetic algorithm.
|
||||
|
||||
One more example of monkey mode:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
$ ./weasel -q -mr101 test -r5
|
||||
quiet output
|
||||
mutation rate out of range
|
||||
@@ -771,13 +771,13 @@ with.
|
||||
|
||||
Try:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
make test
|
||||
```
|
||||
|
||||
This will essentially make sure the program is compiled and then do:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
chmod +x test.sh
|
||||
./test.sh
|
||||
```
|
||||
@@ -793,7 +793,7 @@ processed).
|
||||
You can pass additional options directly to the script but remember that it
|
||||
stops when there are no more strings in the file - so if you try:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./test.sh -q test
|
||||
```
|
||||
|
||||
@@ -825,7 +825,7 @@ program prints an error message and then exits (returning 1). But since the
|
||||
keyboard doesn't have `'\n'` if you were to type a `'` and send a
|
||||
`'\n'` before the closing `'` you might see something like:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
$ ./weasel '!!
|
||||
> '
|
||||
|
||||
@@ -858,7 +858,7 @@ as well as some C keywords.
|
||||
|
||||
2. The way `main()` is declared is:
|
||||
|
||||
```<!---c-->
|
||||
``` <!---c-->
|
||||
/* Special C main() handler (encapsulation): */
|
||||
#define r(main) main
|
||||
r(k main(k a, E **V)) {
|
||||
@@ -952,7 +952,7 @@ somewhere!).
|
||||
The Makefile simplifies how to reconfigure this value with the variable
|
||||
`MAX_SIZE`:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
make clobber MAX_SIZE=55 all
|
||||
```
|
||||
|
||||
@@ -965,7 +965,7 @@ number attempts without waiting for a very long time.
|
||||
The Makefile simplifies how to reconfigure this value with the variable
|
||||
`MAX_ATTEMPTS`:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
make clobber MAX_ATTEMPTS=100 all
|
||||
```
|
||||
|
||||
@@ -982,7 +982,7 @@ and the larger the values the more memory it'll require.
|
||||
The Makefile simplifies how to reconfigure this value with the variable
|
||||
`OFFSPRING`:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
make clobber OFFSPRING=55 all
|
||||
```
|
||||
|
||||
@@ -993,7 +993,7 @@ Skip to [Portability](#portability).
|
||||
|
||||
The following options **must always be passed to the compiler:**
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
-DQ='typedef' -D'g(o)'='goto o;' -D'w(x)'="x:" -D'H(main)'='r(main)'
|
||||
```
|
||||
|
||||
@@ -1003,13 +1003,13 @@ which running `make` will always do.
|
||||
If you want to increase the number of offspring to `50` (`N`) and the size of the
|
||||
chromosome to `75` (`S`) you would do:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
make clobber OFFSPRING=50 MAX_SIZE=75 everything
|
||||
```
|
||||
|
||||
If you wanted to change `N` to `3`:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
make clobber OFFSPRING=3 everything
|
||||
```
|
||||
|
||||
@@ -1020,7 +1020,7 @@ result. Remember too that `S` (`MAX_SIZE`) cannot be less than `38`. Both `S` an
|
||||
|
||||
If you wanted to change the maximum number attempts to 100 you could do:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
make clobber MAX_ATTEMPTS=100 everything
|
||||
```
|
||||
|
||||
@@ -1038,7 +1038,7 @@ Originally I tested it on the below systems.
|
||||
|
||||
#### Fedora 26:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
$ clang --version|head -n1
|
||||
clang version 4.0.1 (tags/RELEASE_401/final)
|
||||
$ gcc --version|head -n1
|
||||
@@ -1051,7 +1051,7 @@ Originally I tested it on the below systems.
|
||||
|
||||
#### CentOS Linux release 7.4.1708 (Core)
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
$ clang --version|head -n1
|
||||
clang version 3.4.2 (tags/RELEASE_34/dot2-final)
|
||||
$ gcc --version|head -n1
|
||||
@@ -1064,7 +1064,7 @@ Originally I tested it on the below systems.
|
||||
|
||||
#### Fedora 27:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
$ clang --version|head -n1
|
||||
clang version 5.0.1 (tags/RELEASE_501/final)
|
||||
$ gcc --version|head -n1
|
||||
@@ -1080,7 +1080,7 @@ Originally I tested it on the below systems.
|
||||
System Version: macOS 10.13.4 (17E199)
|
||||
Kernel Version: Darwin 17.5.0
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
$ gcc -v
|
||||
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
|
||||
Apple LLVM version 9.1.0 (clang-902.0.39.1)
|
||||
@@ -1209,7 +1209,7 @@ When we found others were actually trying to programs with A, we quickly added
|
||||
additional cryptic features and evolved into B, BCPL, and finally C. We stopped
|
||||
when we got a clean compile on the following syntax:
|
||||
|
||||
```<!---c-->
|
||||
``` <!---c-->
|
||||
for(;P("\n"),R=;P("|"))for(e=C;e=P("_"+(*u++/
|
||||
8)%2))P("|"+(*u/4)%2);
|
||||
```
|
||||
@@ -1252,7 +1252,7 @@ is a lack of common sense but since he was part of its creation I don't think
|
||||
it's a bad thing; **on the contrary it makes all of us C programmers even more
|
||||
talented! :)** I do wonder if he tested that bit of C code though:
|
||||
|
||||
```<!---c-->
|
||||
``` <!---c-->
|
||||
for(;P("\n"),R=;P("|"))for(e=C;e=P("_"+(*u++/
|
||||
8)%2))P("|"+(*u/4)%2);
|
||||
```
|
||||
|
||||
@@ -4,21 +4,21 @@ This entry requires SDL2 to be installed. See [FAQ 3.8: How do I compile an
|
||||
IOCCC entry that requires SDL1 or SDL2?](../../faq.html#SDL) if you don't have it
|
||||
installed and don't know how to do so.
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
make
|
||||
```
|
||||
|
||||
|
||||
## To use:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./prog
|
||||
```
|
||||
|
||||
|
||||
## Try:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./prog ioccc.txt
|
||||
|
||||
./prog prog.c
|
||||
|
||||
+3
-3
@@ -1,6 +1,6 @@
|
||||
## To build:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
make
|
||||
```
|
||||
|
||||
@@ -18,7 +18,7 @@ For more detailed information see [2018 hou bugs](../../bugs.html#2018_hou).
|
||||
|
||||
## To use:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./prog < input.json > output.html
|
||||
```
|
||||
|
||||
@@ -27,7 +27,7 @@ View `output.html` in a browser.
|
||||
|
||||
## Try:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./try.sh
|
||||
```
|
||||
|
||||
|
||||
+11
-11
@@ -1,6 +1,6 @@
|
||||
## To build:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
make
|
||||
```
|
||||
|
||||
@@ -8,7 +8,7 @@ If you wish to save state so that you can run the program and keep files changed
|
||||
(for instance you don't want to compile `mullender.c` again) you can compile it
|
||||
like:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
make clobber SAVE=1 all
|
||||
```
|
||||
|
||||
@@ -31,14 +31,14 @@ For more detailed information see [2018 mills bugs](../../bugs.html#2018_mills).
|
||||
|
||||
## To use:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./prog
|
||||
```
|
||||
|
||||
|
||||
## Try:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./prog
|
||||
```
|
||||
|
||||
@@ -47,7 +47,7 @@ At the `>boot` prompt, type return.
|
||||
At the `:` prompt, type `rk(0,0)rkunix` and wait for it to initialise itself.
|
||||
Now try typing:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
cat > prog.c
|
||||
main(){ printf("Hello, world!\n"); }
|
||||
^D
|
||||
@@ -59,7 +59,7 @@ where `^D` is EOF.
|
||||
|
||||
Next try:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
cc mullender.c
|
||||
a.out
|
||||
```
|
||||
@@ -81,7 +81,7 @@ Do small machines only need small programs? This program weighs in at just
|
||||
This program can take you back to the start of everything, it is possible to
|
||||
run v0. Just type:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./v0
|
||||
```
|
||||
|
||||
@@ -91,7 +91,7 @@ You will be greeted with a familiar prompt of "login". The username and
|
||||
password are "dmr" and "dmr". To make things more familiar you'll need to
|
||||
create '.' as it hasn't been invented yet on this image!
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
@ ln dd dmr .
|
||||
```
|
||||
|
||||
@@ -102,7 +102,7 @@ together like `ops.s bl.s hello.s bi.s` (in that order) to produce a.out!
|
||||
But wait, we said this was the start of it all! This program can also run a
|
||||
program that replaces an even larger machine that can run BSD 2.9. To start this,
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./prog
|
||||
```
|
||||
|
||||
@@ -118,7 +118,7 @@ shown earlier.
|
||||
|
||||
But wait, there is even more! Try:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./v6
|
||||
```
|
||||
|
||||
@@ -220,7 +220,7 @@ only a quarter of a century ago -- how much could things have changed?).
|
||||
Let's try some:
|
||||
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
# ls
|
||||
.cshrc .profile boot hkunix mnt tmp
|
||||
.login 2.9stamp dev lib mullender.c unix
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
## To build:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
make
|
||||
```
|
||||
|
||||
|
||||
## To use:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./prog
|
||||
```
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
On a terminal that supports 24 bit color, has black background, and size at
|
||||
least 125x38, try:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./try.sh
|
||||
```
|
||||
|
||||
@@ -40,13 +40,13 @@ And those in the deep south might wish to go north for a better view.
|
||||
|
||||
### How to build:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
cc -o prog -std=gnu11 -O3 prog.c
|
||||
```
|
||||
|
||||
or
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
make
|
||||
```
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
## To build:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
make
|
||||
```
|
||||
|
||||
@@ -18,14 +18,14 @@ For more detailed information see [2018 vokes bugs](../../bugs.html#2018_vokes).
|
||||
|
||||
## To use:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./prog < file.txt
|
||||
```
|
||||
|
||||
|
||||
## Try:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./try.sh
|
||||
```
|
||||
|
||||
|
||||
+9
-9
@@ -1,6 +1,6 @@
|
||||
## To build:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
make
|
||||
```
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
The author suggested that after compilation one should look at the generated
|
||||
files. For instance:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
less generated1.c
|
||||
less generated2.c
|
||||
less generated3.c
|
||||
@@ -19,7 +19,7 @@ files. For instance:
|
||||
|
||||
## Try:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./try.sh
|
||||
```
|
||||
|
||||
@@ -44,7 +44,7 @@ of `./left`, `./right` and `./shift` and the additionally generated programs.
|
||||
|
||||
The final message can be revealed using
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./msg9 < prog.c
|
||||
```
|
||||
|
||||
@@ -59,7 +59,7 @@ But what combinations will generate `./msg3`, `./msg4`, `./msg5`, `./msg6`,
|
||||
`Nuko` is a text rotator: given some text in `stdin`, `Nuko` will write the
|
||||
same text to `stdout`, but rotated 90 degrees counterclockwise.
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
cc prog.c -o left
|
||||
./left < input.txt > rotated_counterclockwise.txt
|
||||
```
|
||||
@@ -68,7 +68,7 @@ Due to static memory allocation, only the first 1K columns by 1K rows
|
||||
are rotated, the rest are silently ignored. But fear not, a separate
|
||||
tool with dynamic memory allocation is included:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./left < prog.c > r1.c
|
||||
cc r1.c -o right
|
||||
./right < input.txt > rotated_clockwise.txt
|
||||
@@ -83,7 +83,7 @@ rotate counterclockwise once more, we get another program. This
|
||||
program outputs a single message to `stdout`, which is the name of the
|
||||
series that `Nuko` came from.
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./left < prog.c | ./left > r2.c
|
||||
cc r2.c -o msg0
|
||||
./msg0
|
||||
@@ -92,7 +92,7 @@ series that `Nuko` came from.
|
||||
There is one final rotation, which produces a tool that removes
|
||||
leading whitespaces:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./left < prog.c | ./left | ./left > r3.c
|
||||
cc r3.c -o shift
|
||||
./shift < input.txt > no_leading_space.txt
|
||||
@@ -112,7 +112,7 @@ side). This shifted code behaves slightly different from the original
|
||||
program. For example, here are two more messages that can be
|
||||
produced:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./shift < prog.c | ./right > msg1.c && gcc msg1.c -o msg1 && ./msg1
|
||||
./shift < prog.c | ./left > msg2.c && gcc msg2.c -o msg2 && ./msg2
|
||||
```
|
||||
|
||||
Reference in new issue
Block a user