From 8a8140f089a2978c627b5c0c0f673e083a3352f0 Mon Sep 17 00:00:00 2001 From: Landon Curt Noll Date: Tue, 19 Mar 2024 21:20:52 -0700 Subject: [PATCH] render HTML after removing bold code --- 2018/ferguson/rpm.html | 2 +- 2020/ferguson1/cannibalism.log.html | 6 ++-- 2020/ferguson1/gameplay.html | 8 ++--- 2020/ferguson1/index.html | 41 ++++++++++++------------ 2020/ferguson1/terminals.html | 4 +-- 2020/ferguson1/troubleshooting.html | 2 +- bugs.html | 5 ++- thanks-for-help.html | 49 ++++++++++------------------- 8 files changed, 51 insertions(+), 66 deletions(-) diff --git a/2018/ferguson/rpm.html b/2018/ferguson/rpm.html index f3258dbab..bc4a2d915 100644 --- a/2018/ferguson/rpm.html +++ b/2018/ferguson/rpm.html @@ -146,7 +146,7 @@ website itself. I have set up an Examples -

In the below game dumps I have replaced the bug with B, the head with -H and where it is known, the tail with T, in order to help -distinguish where they are. Since the head is replaced with H I have noted +

In the below game dumps I have replaced the bug with B, the head with +H and where it is known, the tail with T, in order to help +distinguish where they are. Since the head is replaced with H I have noted the direction it was moving above each dump as well as at the right of the line; each line with a bug, the head or tail is marked with upper case text at the right to make it easier to find.

diff --git a/2020/ferguson1/gameplay.html b/2020/ferguson1/gameplay.html index 4f2206e9d..6cddac9c1 100644 --- a/2020/ferguson1/gameplay.html +++ b/2020/ferguson1/gameplay.html @@ -441,11 +441,11 @@ including how to find the bug, head and tail of the snake, at least where it was documented. The first run has several dumps. The final example has the snake inside itself.

Gameplay: Shedding (stretching)

-

This feature will make you grow by the value of SHEDS for every SHED +

This feature will make you grow by the value of SHEDS for every SHED movements (the counter isn’t incremented when you eat a bug). Basically growing without eating a bug (stretching would be better name here).

Gameplay: Winning

-

If you ever get to the MAXSIZE the game is won. You can force a win by +

If you ever get to the MAXSIZE the game is won. You can force a win by setting the max size to a smaller value than the size you specify (or the default) or setting the size to higher than the default (or < 0 which will end up being > the max size though I suppose there might be some value that makes it @@ -486,7 +486,7 @@ improved over time.

the modes below.

Photosensitive epilepsy/Stimulation overload trigger warnings

If you have photosensitive epilepsy please be careful especially with low values -for both WAIT and EVADE. It appears that the number of hertz (flashes) +for both WAIT and EVADE. It appears that the number of hertz (flashes) per second triggering seizures is wide but depending on the variables it easily can be in the range.

There are different patterns and lights flashing at different speeds so please @@ -674,7 +674,7 @@ gameplay modes (as shown above) but here are some general notes about a few of t to a value that’s better for you. Remember it’s a wait time so if you want the snake to move slower you have to increase the wait time!

EVADE: Bug evasion frequency

-

For every EVADE snake movements the bug will try and find a new place to +

For every EVADE snake movements the bug will try and find a new place to occupy. It might be very close to it and I do not ensure it’s a new place at all.

Each time the bug is placed the counter will be reset whether from eating the diff --git a/2020/ferguson1/index.html b/2020/ferguson1/index.html index 8e34de83c..0c6431b2b 100644 --- a/2020/ferguson1/index.html +++ b/2020/ferguson1/index.html @@ -152,50 +152,51 @@ Location: US - United States of America and non-zero).

Variables:

@@ -260,17 +261,17 @@ some features! The variables mentioned in the to run section at the top of this file modify the behaviour of Snake.

Here are some other features of the game:

There are no complicated command line invocations; it’s just a matter of passing into the game descriptively named variables and I include a script that sets up @@ -482,7 +483,7 @@ a pun and every pun deserves to be shed).

They grow through a process called moulting - shedding their skin (other creatures also moult). This takes place over some days and unlike humans snakes never stop growing (though growth slows down as they mature). I chose the -variables SHED and SHEDS for simplicity and because the words are +variables SHED and SHEDS for simplicity and because the words are shorter. I don’t like the words because it’s rather a misnomer but what I had chosen before was longer - STRETCH and STRETCHES.

Any other interesting things about snakes?

diff --git a/2020/ferguson1/terminals.html b/2020/ferguson1/terminals.html index 4a0395d55..1e8b2afe9 100644 --- a/2020/ferguson1/terminals.html +++ b/2020/ferguson1/terminals.html @@ -173,8 +173,8 @@ approximately the snake_size / growth_size i.e. how many bugs it will take to win the game. The max bugs in the bugs line is approximately max_snake_size / growth_size i.e. how many bugs it’ll take to win at the maximum (capped) snake size.

-

If I pass in any of the variables GROW, MAXSIZE, SIZE and/or -LINES or COLUMNS it bases its calculations on those variables. For +

If I pass in any of the variables GROW, MAXSIZE, SIZE and/or +LINES or COLUMNS it bases its calculations on those variables. For example:

terminal supports cursor movement
 terminal supports making cursor invisible
diff --git a/2020/ferguson1/troubleshooting.html b/2020/ferguson1/troubleshooting.html
index 4f92c8034..d9c728396 100644
--- a/2020/ferguson1/troubleshooting.html
+++ b/2020/ferguson1/troubleshooting.html
@@ -424,7 +424,7 @@ so that by setting the size to -1 it went to the max unsigned value):

$ MAXSIZE=-1 ./prog
 memory error
 X:0/157 Y:0/42 S:3/18446744073709551614 B:0
-

BTW: There are two arrays that have to be MAXSIZE (technically + 1).

+

BTW: There are two arrays that have to be MAXSIZE (technically + 1).

Is it possible that some value specified by the user could mess this up? I do not know but what I do know is that because it’s unsigned it can’t be negative; if the max size is 0 then the array size will be 1 but it won’t matter because diff --git a/bugs.html b/bugs.html index 6f5f1340c..026f9d94f 100644 --- a/bugs.html +++ b/bugs.html @@ -283,8 +283,7 @@ the same issue.

clang despite the fact it might appear to be gcc: no symlink and both gcc and clang exist but the gcc is clang which you’ll see if you run gcc --version.

A tip and some fix methods from Cody: in the older days args to main() not given -a type were implicit ints but when they’re required to be char ** this can -cause a problem. In some cases Cody was able to use a char * inside main() +a type were implicit ints but when they’re required to be char ** this can cause a problem. In some cases Cody was able to use achar *insidemain()` (see 1989/tromp/tromp.c and 1986/holloway/holloway.c for two examples though done slightly differently). In other cases he was able to dereference the pointers to be used @@ -2183,7 +2182,7 @@ used.

This program supports only “Combinator-calculus style notation” of Lazy K. “Unlambda style” and “Iota and Jot” style are not supported.

Also, it requires a space between identifiers. In short, use (S K) instead of -(SK), “`sk”, **i*i*i*ii*i*i*ii, or 11111100011100.

+(SK), “`sk”, **iiiiiiiii, or11111100011100`.

Huge memory may be required to compile the program (about 300 MB on my machine).

In addition, there are some limitations (and workarounds) mentioned in Spoiler section.

diff --git a/thanks-for-help.html b/thanks-for-help.html index 39b543f49..dcbb04820 100644 --- a/thanks-for-help.html +++ b/thanks-for-help.html @@ -181,21 +181,14 @@ be kept in:

char x {sizeof( double(%s,%D)(*)())

This does mean that there cannot be a second arg to main() -as clang requires that to be a char ** and the char redefined would not -allow this. Some versions of clang say that main() must have either 0, 2 or 3 -args but these versions do not object to 1 arg. However as the char macro -seems more obscure and it is possible that a new version of clang will be even -more strict the int i parameter in main() was moved to be inside main(), -set to non-zero (setting i to 0 will not work). This way main() has zero +as clang requires that to be a char ** and thecharredefined would not allow this. Some versions of clang say thatmain()must have either 0, 2 or 3 args but these versions do not object to 1 arg. However as thecharmacro seems more obscure and it is possible that a new version of clang will be even more strict theint iparameter inmain()was moved to be insidemain(), set to non-zero (settingito 0 will not work). This waymain()` has zero args.

Observe how on line 29 there is a call to main() which does pass in a parameter. It has never been observed to be an error to pass in too many parameters to a function (main() or otherwise - it warns with other functions but does not appear to with main()) but only that main() itself has a certain number of args (in some versions) and that the first arg is an int and -the others are char **s. This is why the arg was removed and the call to -main() was not updated beyond what had to be done to fix it for compilers that -do not support -traditional-cpp.

+the others are char **s. This is why the arg was removed and the call tomain()was not updated beyond what had to be done to fix it for compilers that do not support-traditional-cpp`.

If the ANSI C committee or a new version of clang messes this up (both of which seems possible) it is easy to fix but it is hoped that this won’t happen.

Originally Yusuke supplied a patch so that this entry would compile with gcc - @@ -367,7 +360,7 @@ program the added input.txt file.

1986/holloway (index.html)

Cody fixed this to compile and work with clang (it already worked with gcc). The problem was that clang is more strict about the type of second arg to -main(). However simply changing it to a char ** and updating the *s to **s +main(). However simply changing it to a char ** and updating the*sto **s caused a segfault. By adding a new variable, char *t, initialising it to s and then using t instead of s it compiles and runs successfully under clang and gcc.

@@ -605,11 +598,11 @@ index.html file for more details.

publication, in the remarks, to help understand the entry, and for fun.

1988/phillipps (index.html)

Cody fixed this for modern systems. It did not compile with clang because it -requires the second and third args of main() to be char ** but even before +requires the second and third args of main() to be `char ** but even before that with gcc it printed garbage and then crashed.

After fixing it for clang by changing the very main() (in fact it called itself up to 12 times!) to call the new function pain() (chosen because it’s a -pain that clang requires these args to be char ** :-), which is just as +pain that clang requires these args to be `char ** :-), which is just as recursive, with the correct args it now works with both gcc and clang.

Later Cody improved the fix to make it look a bit more like the original, using K&R style functions, and trying to match the format as best as possible of what @@ -771,25 +764,19 @@ might just not be possible.

The way it was fixed might be hard to see and describe but this is an attempt. Because main()’s args were all ints, main() had to call a new function which is allowed to have args as int (instead of main()’s args being int and -the rest being char **) but this is not as straight forward as it is for other -entries (if you look at the code you might see what is meant; the function called -is pain()).

+the rest being char **) but this is not as straight forward as it is for other entries (if you look at the code you might see what is meant; the function called ispain()`).

The args of main() had to be set to the right type but only three args, not four, even though the original program has four args. This is because not all versions of clang support four args and that is one of the issues with version 2 and 3 as it generates main() to have four args and the wrong type, all ints.

-

In the call to the new function, pain(), from main(), one of the char **s -is used twice, once as argc with bitwise AND with 2, naturally first being -cast to an int ((int)ABBA&2), and once as a char **, the fourth arg to +

In the call to the new function, pain(), from main(), one of the char **s is used twice, once asargcwith bitwise AND with 2, naturally first being cast to anint((int)ABBA&2), and once as achar **, the fourth arg to pain() (yes even though pain() takes all ints).

The argc,, meanwhile, tang, is used once and the second arg, char **gnat is used once (observe how tang is gnat spelt backwards as this is one of the things that makes this a masterpiece and very hard if not impossible to fix completely). Fortunately it is not actually necessary to use all four args (of main()) in the call which might or might not be surprising, especially as it -uses one of the args, a char **, instead of an int (through casts), twice -rather than just passing in for the fourth arg (the fourth arg passed in is the -third arg to main()).

+uses one of the args, a char **, instead of anint(through casts), twice rather than just passing in for the fourth arg (the fourth arg passed in is the third arg tomain()`).

This program heavily uses recursion and depending on the number of args it will print out output normally, ROT13 it, show it backwards or both. Along with the ROT13 and reversed output of the code, it is the comments that create the @@ -1246,7 +1233,8 @@ new char arrays (always cleared in the beginning of the loop) and then using both numbers (using "%o %o" does not solve the problem).

1992/westley (index.html)

Cody fixed this to work for clang by changing the third and fourth arg of -main() to be char ** inside main(); clang requires args 2 - 4 to be char ** and some versions do not even allow a fourth arg.

+main() to be char ** insidemain(); clang requires args 2 - 4 to bechar +** and some versions do not even allow a fourth arg.

He also added the alternate version that the author gave in the remarks that is specifically for the USA rather than the world. This had to be fixed for clang as well to make the args of main() be the correct type and by moving the body @@ -1341,13 +1329,12 @@ compile time. See the index.html for details.

Cody made this use fgets(3) not gets(3).

1993/vanb (index.html)

Cody fixed this to work with clang. The problem was that the third arg to main() -was not a char **. Instead O5() (which was main() via -DO5=main) is now +was not a char **. InsteadO5()(which wasmain()via-DO5=main`) is now its own function which main() calls with the right parameters.

Later Cody fixed it again to look much more like the original where only a single line is added, that of main(), which calls O5(). This was done through -include stdio.h at the compiler (in the Makefile) and by removing the O3 -variable (an int) at the top of the file, instead making it a char ** in -main() (O5() had three args) but then passing in 0 to O5() for the third +variable (an int) at the top of the file, instead making it a char ** inmain()(O5()had three args) but then passing in0toO5()` for the third arg (as it was 0 at file scope already this is perfectly fine and it means there’s no need to cast it to an int in the function call though that would also work).

@@ -1988,7 +1975,7 @@ compiler that does not support this would not work. Thus we use the modification by Yusuke.

2001/cheong (index.html)

Cody fixed this to work with clang by adding another function that is allowed to -have a third arg as an int, not a char **. He chose pain() because it’s a four +have a third arg as an int, not a char **. He chosepain()` because it’s a four letter word that would match the format and because it’s pain that clang forces this. :-) This fix makes a point of the author’s notes on portability no longer valid, BTW.

@@ -2046,9 +2033,7 @@ SC2248 (style): Prefer double quoting even when variables don't contain spec

2001/herrmann2 (index.html)

Cody fixed this to work with both 64-bit and 32-bit compilers by changing most of the ints (all but that in main(int ...)) to longs. He also fixed it to -compile with clang by changing the args of main to be int and char **, -respectively, and changing specific references to the argv arg, casting to -long (was int but the 64-bit fix requires long) which was its old type.

+compile with clang by changing the args of main to be int and char **, respectively, and changing specific references to theargvarg, casting tolong(wasintbut the 64-bit fix requireslong`) which was its old type.

Cody also added the try.sh script which might be more useful than any other place as the command to try is quite long with C code.

For some reason the original code was missing (presumingly because it had been @@ -2442,7 +2427,7 @@ bugs.html.

back for arrow keys in the alternate version.

2006/sloane (index.html)

Cody fixed this entry to work with clang which has a defect with the args to -main(): it requires specific types: int and char ** for the first and +main(): it requires specific types: int and `char ** for the first and latter args.

Cody also provided the alternate version, which allows one to see what is going on in modern systems, and which we recommend one @@ -2618,9 +2603,9 @@ everything, filtered through less.

find-font-table.rb.

2012/grothe (index.html)

Cody added the try.sh script.

-

Cody also changed argv to be not const char ** but char **, mostly out of an +

Cody also changed argv to be not const char ** butchar , mostly out of an abundance of caution in case clang, which already imposes restrictions on the -types of args to main() including to do with char **, decides to further +types of args to main() including to do with `char , decides to further restrict them.

Cody also restored the original code from the archive.

And although the URL works for now (via redirect), Cody changed the website