From 22bbe488e94644fd699f00154043190ff3aa56da Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Thu, 25 May 2023 02:53:26 -0700 Subject: [PATCH 01/16] Format fix 2019/poikola/README.md Yesterday I noticed that Timo wrote directly to me in his remarks and I wanted to address this by adding a link to myself (which is what is being done with all winners being referred to) but this naturally meant I should format fix the file too. I am very touched by this especially as 2019 was a very hard year for me and I didn't even think I was going to participate in that year (did in the end and didn't win but funnily enough some of my entry ideas actually won though with some differences of course) so I wanted to address it now. I might end up changing my name to my full name but I want to keep it as close to as possible (format fixed and links added notwithstanding) first to see how it looks. Thank you Timo! It means a great deal to me. In the paragraph to me Timo wrote about his 2018 entry and I linked to that too. I changed another winner Timo mentioned to be a link (the winner in winners.html as well as the winning entry referred to are now both links). Add some links and other format fixes. Added INABIAF section to both the README.md file and bugs.md. Typo fixes or at least adding a word here and there to make certain things a bit clearer. --- 2019/poikola/README.md | 149 +++++++++++++++++++++++++++-------------- bugs.md | 7 ++ 2 files changed, 106 insertions(+), 50 deletions(-) diff --git a/2019/poikola/README.md b/2019/poikola/README.md index a11b63629..4b8922c18 100644 --- a/2019/poikola/README.md +++ b/2019/poikola/README.md @@ -33,6 +33,11 @@ TZ=UTC48 make clobber prog ./prog 512 ./prog ``` +### INABIAF - it's not a bug it's a feature! :-) + +This program will not validate input so it might fail or get stuck if invoked +erroneously. + ## Judges' remarks: Do you have the time to see what this program does? Think again, come back and @@ -69,18 +74,20 @@ clang -O1 -o prog prog.c ### Poster: You can generate an A3 sized poster by `make docs`. This command creates a pdf -file `poikola.pdf`. +file `poikola.pdf`. This requires the +[pdfTeX](https://en.wikipedia.org/wiki/PdfTeX) tool. ### What this entry does: An old wise man mumbled to me: -> Implement a program, which can calculate SHA-3 checksum for a file +> Implement a program, which can calculate SHA-3 checksum for a file -- -I think it is easy, but the wizard didn't stop yet: +I thought it was easy, but the wizard didn't stop yet: > and primes and Fibonacci numbers. -Still easy. But the Gandalf the Grey impersonator is not ready: +Still easy. But the [Gandalf the +Grey](https://www.glyphweb.com/arda/g/gandalf.html) impersonator was not ready: > But use only `main()`, and do not use `math.h` nor predefined stuff at all. But wait, there are more rules: This work should reflect the extraordinary mind @@ -91,21 +98,34 @@ who passed away on fourth of February 2019. ### Oh boys: -So, I followed the rules given by Gandalf the White and the Judges of IOCCC. +So, I followed the rules given by [Gandalf the +White](https://www.glyphweb.com/arda/g/gandalf.html) and the [Judges of +IOCCC](/judges.html). + Output of `iocccsize`, using the [2019 version of iocccsize](https://www.ioccc.org/2019/iocccsize.c), is carefully selected. For the sake of clarity, I used single letter variables in the code. I also avoided -unnecessary use of functions. Like a tripundra, this program has three levels. +unnecessary use of functions. Like a +[tripundra](https://en.wikipedia.org/wiki/Tripundra), this program has three levels. In order to reveal all of them, you have to compile this program on three consecutive days. As this is a contest for obfuscated code, the program does not perform unnecessary checks, but either fails or gets stuck if invoked erroneously. The -program is invoked in this way: ./prog `` `` in where `` -is 224, 256, 384, 512 or even 1024. Yes, I know 1024 is not a supported length -of output, but as I said, the program does not validate its input in any way. -These same parameters should be given in calculating a Fibonacci sequence or -prime numbers. *Please note that maximum file size is one gigabyte.. +program is invoked in this way: + + +```sh +./prog + +``` + +where `` is 224, 256, 384, 512 or even 1024. Yes, I know 1024 is not a +supported length of output, but as I said, the program does not validate its +input in any way. These same parameters should be given in calculating a +[Fibonacci sequence](https://en.wikipedia.org/wiki/Fibonacci_sequence) or [prime +numbers](https://en.wikipedia.org/wiki/Prime_number). *Please note that maximum +file size is one gigabyte*! ### Obfuscation: @@ -116,67 +136,96 @@ the feeling that I've been here before. make your own decisions. Up there, it's all _up yours_. This code has some jumping too. I used some `goto`s instead of `longjmp()`. Some -Finnish ski jumping sites are used as labels, however, there is `lahti` instead -of salpausselkä. +Finnish [ski jumping](https://en.wikipedia.org/wiki/Ski_jumping) sites are used +as labels, however, there is `lahti` instead of salpausselkä. ### SHA-3-512 Compatibility chart ### Tested against [test vectors](https://www.di-mgt.com.au/sha_testvectors.html). -Clang-4.0: For optimization levels [0123s], the program compiles and produces correct output for every tested vector using -c11, c89, c90, c99, gnu11, gnu1x, gnu89, gnu90, gnu99, iso9899:1990, iso9899:199409, iso9899:1999 and -iso9899:2011 as argument of `-std=` -Gcc-6: For optimization level 0, correct output using -c11, c99, gnu11, gnu1x, gnu89, gnu90, gnu99, iso9899:1999 and iso9899:2011 +Clang-4.0: For optimization levels [0123s], the program compiles and produces +correct output for every tested vector using the C standards c11, c89, c90, c99, +gnu11, gnu1x, gnu89, gnu90, gnu99, iso9899:1990, iso9899:199409, iso9899:1999 +and iso9899:2011 (argument of `-std=`). + +GCC-6: For optimization level 0, correct output using the C standards +c11, c99, gnu11, gnu1x, gnu89, gnu90, gnu99, iso9899:1999 and iso9899:2011. ### Missing a prime -For obvious reason, the oddest prime is missing from output. +For obvious reason, the [oddest +prime](https://mathworld.wolfram.com/OddPrime.html) is missing from output. ### Observations -Gcc and clang are very fragile compilers. I spent numerous hours trying to achieve exactly the same output from -different optimization levels and compilers. Small change in code can produce really unexpected results, i.e. the compiler -can skip a few expressions or statements without obvious reason. +`gcc` and `clang` are very fragile compilers. I spent numerous hours trying to +achieve exactly the same output from different optimization levels and +compilers. Small change in code can produce really unexpected results, i.e. the +compiler can skip a few expressions or statements without obvious reason. ### Major spoilers -Please scroll down if you want to see spoilers. -
 
-It is commonly believed that [Mike Keith's algorithm](http://www.cadaeic.net/calendar.htm) published in _Journal of -Recreational Mathematics_, Vol. 22, No. 4, 1990, p. 280, is the shortest way to calculate weekday for given date. -Keith's algorithm:
-`(d+=m<3?y--:y-2,23*m/9+d+4+y/4-y/100+y/400)%7`
-My algorithm: I noticed that
-`(23*m/9+(m<3?y--:y-2)+d+4+y/4-y/100+y/400)%7`
-is one character shorter. In my solution, `m<3?y--:y-2` is used directly, instead of assign value for `d`. +It is commonly believed that [Mike Keith's +algorithm](http://www.cadaeic.net/calendar.htm) published in _Journal of +Recreational Mathematics_, Vol. 22, No. 4, 1990, p. 280, is the shortest way to +calculate the day of the week for a given date. -Q is pronounced in Finnish exactly like "kuu", a word for month or the Moon. So, `Q = k` is intended. +#### Keith's versus my algorithm -Last term of outputted Fibonacci sequence is the last one smaller than 264. It is plain coincidence (but a funny) -that value of '^' is 94 in ASCII table. +Kieth's algorithm is `(d+=m<3?y--:y-2,23*m/9+d+4+y/4-y/100+y/400)%7`. I noticed +that `(23*m/9+(m<3?y--:y-2)+d+4+y/4-y/100+y/400)%7` is one character shorter. In +my solution, `m<3?y--:y-2` is used directly, instead of assigning a value to +`d`. -For prime calculations: I recycled code from my high school C-programming course. Originally, I wrote it over 20 years -ago. My teacher said that it is (too) complicated to use bits stored in arrays, so I did it. +Q is pronounced in Finnish exactly like "kuu", a word for +[month](https://en.wikipedia.org/wiki/Month) or the +[Moon](https://en.wikipedia.org/wiki/Moon). So, `Q = k` is intended. + +Last term of outputted [Fibonacci +sequence](https://en.wikipedia.org/wiki/Fibonacci_sequence) is the last one +smaller than 264. It is a plain but funny coincidence +that the value of `^` is 94 in [ASCII](https://en.wikipedia.org/wiki/ASCII). + +For [prime calculations](https://en.wikipedia.org/wiki/Prime_number): I recycled +code from my high school C-programming course. Originally, I wrote it over 20 +years ago. My teacher said that it is (too) complicated to use bits stored in +arrays, so I did it. ### Other stuff -Cody: I really like that you enjoyed my previous entry. I hope that you will like this entry too. -Because I did not want to give too many clues to Judges, I tried to write this entry in a different way -than Most Stellar, but in this code there is at least one recycled thing from it. By the way, -answers to questions: 1. 255. 2. Try to compare binary representations of those floats and binary representation -of the string "25th IOCCC!". 3. I don't know. I used standard trigonometric functions from `math.h` for rotating the Big Dipper -and later replaced those functions with my own implementations. But there was a bug in my code and the effect was more -beautiful than intended. I did not even debug this bug and now it works as a feature. 4. It is not possible. If you -change a single bit, the Fletcher 16 checksum does not match anymore and `goto` jumps to end of the code. +[Cody](/winners.html#Cody_Boone_Ferguson): I really like that you enjoyed my +previous entry. I hope that you will like this entry too. Because I did not +want to give too many clues to [the Judges](/judges.html), I tried to write this +entry in a different way than [Most Stellar](/2018/poikola/prog.c), but in this +code there is at least one recycled thing from it. By the way, the answers to +the questions I posed: `(1)` 255. `(2)` Try to compare binary representations of +those floats and binary representation of the string "`25th IOCCC!`". `(3)` I +don't know. I used standard [trigonometric +functions](https://en.wikipedia.org/wiki/Trigonometric_functions) from +[math.h](https://en.wikipedia.org/wiki/C_mathematical_functions#Overview_of_functions) +for rotating the [Big Dipper](https://en.wikipedia.org/wiki/Big_Dipper) and +later replaced those functions with my own implementations. But there was a bug +in my code and the effect was more beautiful than intended. I did not even +debug this bug and now it works as a feature. `(4)` It is not possible. If you +change a single bit, the [Fletcher's 16 +checksum](https://en.wikipedia.org/wiki/Fletcher%27s_checksum#Fletcher-16) does +not match anymore and `goto` jumps to the end of the code. -I see that _Volker Diels-Grabsch_'s winner is awarded in category __Most self-aware__. In last year, my entry incorporates -the Fletcher 16 algorithm to ensure integrity of code. One of my first ideas for this year was to do the same thing, -but with SHA-3. Using Fletcher 16, calculating a checksum which matches with `sleeping time factor` took about one minute. -I realized that SHA-3 even with 224-bit output could take too much CPU time. +I see that one of the [Volker +Diels-Grabsch](/winners.html#Volker_Diels-Grabsch)'s winning entries is +awarded the category [Most self-aware](/2019/diels-grabsch2/prog.c). In last +year, my entry incorporates the [Fletcher's 16 +algorithm](https://en.wikipedia.org/wiki/Fletcher%27s_checksum#Fletcher-16) to +ensure integrity of code. One of my first ideas for this year was to do the same +thing, but with [SHA-3](https://en.wikipedia.org/wiki/SHA-3). Using Fletcher 16, +calculating a [checksum](https://en.wikipedia.org/wiki/Checksum) which matches +with `sleeping time factor` took about one minute. I realized that SHA-3 even +with 224-[bit](https://en.wikipedia.org/wiki/Bit) output could take too much +[CPU](https://en.wikipedia.org/wiki/Central_processing_unit) time. -I would like to say _thanks_ to PSP, because there were not too much interrupts during the coding phase. +I would like to say _thanks_ to PSP, because there were not too many +interruptions during the coding phase. ## Copyright and CC BY-SA 4.0 License: diff --git a/bugs.md b/bugs.md index f2506a5b0..74fc587ce 100644 --- a/bugs.md +++ b/bugs.md @@ -2033,6 +2033,13 @@ help! As a backtrace quine this entry is **SUPPOSED to segfault** so this should not be touched either. +## [2019/poikola](2019/poikola/prog.c) ([README.md](2019/poikola/README.md)) +## STATUS: INABIAF - please **DO NOT** fix + +This program will not validate input so it might fail or get stuck if invoked +erroneously. + + # 2020 ## [2020/burton](2020/burton/prog.c) ([README.md](2020/burton/README.md)) From ba30809ed768658dc351db93e87f36bb92580b17 Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Thu, 25 May 2023 03:03:21 -0700 Subject: [PATCH 02/16] Slight update to 2019/poikola/README.md Changed my name to my full name. I incidentally meant to say that yes I do like the entry Timo but space, stars, the sky, planets, constellations and all such things are much closer to my heart so the Most stellar entry is my favourite of the two! But still this is a nice one. Again thank you! --- 2019/poikola/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/2019/poikola/README.md b/2019/poikola/README.md index 4b8922c18..ac42d5195 100644 --- a/2019/poikola/README.md +++ b/2019/poikola/README.md @@ -194,7 +194,7 @@ arrays, so I did it. ### Other stuff -[Cody](/winners.html#Cody_Boone_Ferguson): I really like that you enjoyed my +[Cody Boone Ferguson](/winners.html#Cody_Boone_Ferguson): I really like that you enjoyed my previous entry. I hope that you will like this entry too. Because I did not want to give too many clues to [the Judges](/judges.html), I tried to write this entry in a different way than [Most Stellar](/2018/poikola/prog.c), but in this From 5881f728f574ef826564ccd1e8f2cc20d8d303c2 Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Thu, 25 May 2023 03:12:06 -0700 Subject: [PATCH 03/16] Fix Enigma chocolate cake files wrt twitter With commit f46e68740fd35574bdcd8842c4d88b4df019fdcd twitter links were converted to archived copies (due to Elon Musk threatening to delete accounts that are not active) and the chocolate cake files had a link to a tweet. However the 2020/ferguson2 chocolate cake files were encrypted with a key (one of 16 I gave to experiment with the entry itself) which means that the files were not updated. Now they have been so that when properly decrypted they will link not to twitter itself but twitter on the Internet Wayback Machine. Question: what's the difference between SpaceX rockets and Twitter? Elon Musk hasn't yet managed to blow up twitter! --- 2020/ferguson2/chocolate-cake.html | 246 ++++++++++++++--------------- 2020/ferguson2/chocolate-cake.md | 18 +-- 2 files changed, 132 insertions(+), 132 deletions(-) diff --git a/2020/ferguson2/chocolate-cake.html b/2020/ferguson2/chocolate-cake.html index 21ad1ab59..12db96033 100644 --- a/2020/ferguson2/chocolate-cake.html +++ b/2020/ferguson2/chocolate-cake.html @@ -47,157 +47,157 @@ moaumqp yssl oldpk mew XUS vvchf 'oq YMVBT': wl nxitrr xuom zil 'Mvwkhwfyucdih Jzxrll rs Ofztr, Zsapqagyp ekl Bxahm Jmaxnjuadsfvq'. Tbyhuyy. -Jwi ndqw owa Resabtlkthvkv Ubjdlzry Fmrmpbovr Gyln Ewxoodl omhas gxqb -lkpwnx ORZDI zfwayb Fodp Opaulixym (ErxZee) wc kubq mc rmm -UTRRA swvw krabmq ktnrl lx zmk hmwzmwu db hmh myvjs (zxkuk xi gguzshh qpvn -ji xdrna qq wgs ufij pusy IWAZ). +Jwi ndqw owa Ukbtffidnzzyk Ggvayqgt Esgdremmv Qxnf Ifvflwe kunfw

ifbk +mvureq WFBXV dcqgbo Tahr Axgqinmng (ZvzRel
) cc apnj mq ceq +QEFPX vscv zlivas tgkpx ln cdr vptbdwk wt szg wrsyw (xamfv yx jmbgchb fwtk +yl ydeld gk jja lcly lhla MZDH). -Vmzbpkajdkuj +Pqwfqlkefdui -Zyyy rco pshmzwqxwb qffs pm Zbmurfgp nncrgld lkxc ns ivg orwajarbrsyu jls oy blp -FW vaoqvqcrk. L hleg wtuztwmk (zkzr qlv isla gkif rfqy enkz mzudrmz) me -npsw://eqg.wozhlmodaeqqnfks.lqt/wlgtpom.ozs. Pfuh uyce loahexefdvig hzcmwa -whf sfdf, zycmoblzw, nhzrikqxtmz uqb brdbrl.
+Maun vlg kyghpdsxbn mess ny Bdlyzauf tnttpfr dawb uy zgz crohhjvyqjuo gxv hm pqg +SZ mrztkzlkr. F uevb wfengxss (xljh wnk ykgk zugq xptb ezbf xhwofsf) jo +tgzd://zsu.rkdyelqacxiwwrug.tzh/rhybkcu.dab. Bxsf tneo rxxzkamtbpfk tuyeku +hte acue, zduuqlwzf, vbusqevacen zdf frayxm. -Gjcym'w xbbtlzqpq +Dwvpl'g aprppcrfo -Ruovw'b lqvtazxpd ev n dlosb brnm rul oud setwnmr kz omyhofyc yw kyzjuwoqckx -xdpgrvizb mmmr ogfy utu cgedcr. Imubdurmb ni c xgcorjiori SIW vc qwpmh et -xsuslw cqxxwxpke qnhror: +Smtms'c muauqzvdx fe b jypyj izyr ucv ouu oprnshi hb jpnghmkp ot yhcahvjxupu +gvrmidhxp zkop igqk twn hefnpo. Mzgbbibff jp h rrcmbjcmrg XNJ om dqznb vs +luugow fstlcqylm oilkaf: -Tybhjw uckyhjdmd prooflkq zq boscn orl kw cunwh qyxehl 'whyzmipbolq' pn -'ovnwyv' xfhwgfrvx. Fw htwr bnchcbgdt cv'v hpkjws 100% tozqw qxdfw xm'u -fdrjzzvn fyiu dd zdhzkm eh xfrzy alnlt, feq dqdaszl xcbf. - +Nkrxyx anewkenhs wrkwbvle tt cbtvq lyi yg hdcio nfvjyx 'kawjwqciydh' xd +'wfjnaz' jwazdaeyk. Na ulyo lsdsbjqib lb'r ntmqcf 100% kimuf uuzvl tq't +vtxjqjpz efpp te sqjdge li qmrmh sbdzd, wcm tsqcgdt ctpz. + -Ivf PHR hsdypdji vnry riq rfsnm ztif af mmai yvy t nhzqiy oalovw imqx yzl Q -lqaorg szifn cfs hhzwvzpm qrxfbd jcvaa ruem aw'u laopuoiodfr qyesfauvx qoux wks -edemkk. Xaz UBB yjuza dnvdv kmgp ozidw fkxj gykpyuylpdx zzc U nywk ce zpgh azhn -eglj ewxmx bhcz dwd ta; D myapezi kawitme ya asmrvh'l wx dgkb. +Ztf YMI agderadm dcvh kqm hnqkp enfb vn vfsc ibn c hqmlho triaoz nqho dqc V +slkway jwmyh ddx ffkvgndh yegqfx wuooh lkzl yy'l sgrhdnoryje unxwlbpqy cxar tqy +ppppbz. Ylk EMC wuowe japho hqqf cmvno wkti gqkgkrbhdux dia O sqhb hn prju swfw +ejtb hhjeo lziv gfj yt; M cvgpnpi qmwurok hv geokxk'c sh cuip. -Yoifpg tml oeahqo qzvdq wqv nxjilqbsp zv qsj mnfuc rl pjb watumznon pr mmg dwidqk wzm -kkhpba sryyo pawgbix meph'nm ctsvak ecbjlrdbk! +Itqywj kps vizuzu oigkn bnl pmkhwmwyv ez zyf xfobq wf pmw iakkisygx gc oyt zduxqu dyb +mnwzgh wpkny qqqgxeb ozwr'df jwfkgw bwacwxftf! -Atbhglw jqhwh yvq dsc otct +Uhrzfjy bqkwv vky nli udgo -JJE RFDCH JVVUQXCKL NK LQGUO: +SNR WZUAO NPFXCPHPB GK AGWQL: - -LZV XKXRMAKDW. Jejeuc uctt zdd lklw fbzb. Ku tkr xjaud mj rarx rbxs pcb -vxqvxd hx conwr vcoxgc onn'ao isge wahqijiw; vb nlqd dxuv tjn cukpk! -Uenw qzp kqpuk rpys kwvsapm mub mhqs sv ioy adfptrzcliv bzxakxkhc vnlkyrm; -vohd ipun yj zn lzx qfion cyuo ziq fksi gju 1/4 saxma osel nwcpgd tf uu meiv qh -iwuz ofz kzqjql pn gv mmjmd ghq kjpkanc jz vsickm. Yql hxi nmeevixaaoof zqlw -je obsth'q zwg hjcpd. -Wgk awddppj hekqxhqkb ij QFFL KYB QXPT WVG DUOWJOQZZ QTCF. -LTGCJS RBV KGYZ GNCS ZEJ UTEV 2 OWXEABI TCHFU CDBVNUEE HAHF CKJG. Xepx nxziv -fz ehiwc aucw vi ztiei. Gjw xjbhowylv qlydn zu kjeo ojhn tra'o jusjtkvt. -Osfe zjb kympgb kow ospjv qacpzlp jwll qwzn ayfjkjtn idijo fg d ime; kuy -aa'h hibcvwetychvl yncca dj y hhe. Zv jfg nboibwzltvsw eblx zko eehyqs imx -wrqyw mokn 4 darz tsslu ucyhl fvclg. -Qvf yntx XJVAA ZZJM nzo jrky txryii; ers twnks'y vmgj cn hz zkwpef xxvmgkb -vzk pstrl oprb ain fcz C omnk dntcst lnmu rgrf lzonei ueo sbim xhy bm -ivfowdhdb pchq M dhfsc ddjsgvldw gtnrq fnxh hty zixc txpprp jaa. Lf svz osca -ua kjxfr kjy uitcv nq gtn ocjskz yztgvlpztu ol s L! -Ihk efhi IKUG EQDFHOZ QTOOGKX! Hu YRR QQU tuzjkzaqz suoubyg! - + +JML AMGEVNHAL. Decxsc jpsw fki ocqn ndqi. Ap gag spatw hk povc btxh mpq +roxzpe tm oxeik mklnui tag'mm erkd placxxpz; uz pmzf autz nhz qcafa! +Qcyq vtq krczt rlgd rneqsqh ayb chma hn reh xovjudihzxw tgcaakvmy dwnzfqj; +irhx gfam xf cb lis jyyzx unil set cdar iyz 1/4 vakmr rupy hymsvd oh jt yppq sz +uhcc cwk rkvxyl eh ns jvafl tno fbnoggn px jcybov. Kvq nyi ycyzpurkuixb fhtx +rj krtco'j frf zcxuu. +Cxw ffjxyqa hakqgqnvo iw KBPW NYG XYXG REV FTXBIPWVH DRJX. +LGWPWD QJU NSBA JNSZ FOD SCOL 2 EDMRVZR UJGKK NFXYFBXM TYVA DYQS. Koqr ynrkd +xr iwqbk gttb gy oqufp. Dfp bzqhqkcqq uwvvl qz igly gbbp bdm'k vhbmjvqu. +Giyd gwb zkgcjc mst zfjiz pogvxtu gckg qwyw yyouzahs hbsqi bl h rqn; hak +js'j nkrellvrctlcp mxuey fe f ria. Ep cqx alizdzlwossl tvcr lud hfbyqo khg +ehiwo hrnz 4 hycd encir lhfdc ckjso. +Byk wrld OWIFU SCPP yaw uzjy lgfazw; dzr hwddy'q lhcl yb wf atynbi utqrtch +fyl nwpge kyls msr wwv W dkht ubtmxy fasp koja rujzki ilv dlhy nxc hy +hxfqbvrzi sxjg C ixfxr vwwvcfwwf fwxyq hwcv qdw cadn kkkths arb. Bp xwn hxud +xo wxzog zzh fpmso xw obb nzxkap kqnyddablx zj q L! +Jgh kfbx CNTY CMLODVK XJLHJNE! Rj FMI THA fkmwvjrgf ufirmfu! + -Vrda Fdzsyqrmfwe +Yufc Toeoxltrfka - -3 iv lpucryvwjwk (Wyjfk'f) ekaugohin -2 zep 1/4 nnnv rtmle -2 fcvl yeffyq qtfw -1/2 vhs owgz -2 qdc 1/4 yybc bemfpg eqyfx qsnnm -3 vcpz -1 ssk 1/2 cme hlegnnp -1/2 gwbw ijvfhxpil -1 srd (dkvdfgl) mrviu -1 glt dzpz uwcmb - + +3 em bcercallqrf (Dvgly'v) ujtstjebq +2 mtw 1/4 wzfp prufp +2 hmkh pegtyd iiwv +1/2 exn lrsm +2 zej 1/4 lgnh dfgyna xminl umczm +3 pjfd +1 bwp 1/2 lrm coifagp +1/2 ehlq hfynqgdoc +1 tdj (acpzuem) mvyrh +1 lis ngrs ltxej + -Onat Mwigkegkmbi +Olbg Mkdfxaosmsi - -Utstgsx dqiuvq yuz 9 t 1.5 vkvi shaqt mcrb; ynakajt ykun uqoe iknsl. -Mkumqvh yojw eg 350 X (176.67 T). - + +Byxfysd xjnpgh xmn 9 t 1.5 ydtl xfwru dytj; bkxmmpt jvtw cext tdwzp. +Xvjwfer mjnh xp 350 O (176.67 I). + -Mrmo Bxchujaqxt +Hqlh Oynbsoyfsr - -Hzkn 3 qv gzofloubupp pbngxrsdt hf xzjxqi wvubbh bo xcjhm thcy nqdu -dxx (zgq kvr jqtuuws) rrffl; bki klqe dtagkl inrfrrnfuo.
-Pcel 2 1/4 trrf rbwjn, 2 zhg xmiace vnml, vjf 1/2 pgr gojs -Hzmj 1 wxzwb wozqjlhzo mz bkajl qfbf eyisc xraa. -Vam 2 1/4 gjfy ldtjux yaqui iyjtv smh 3 dzdy. Suvp xfamo yuiky zvq -lgbrbl. -Cfrj tq 1 1/2 gqr xyltxkl bfz bacsqi vczlvp bfgvlxgns. -Guwi ja iof akelsrjifrc wurffjqindu uybm 1 yqz qxzc wwcls; yrgjto pfgr -gqoqm pzkqpp. -Kktk tq 1 uyr qhrrngp dtsxl. -Xrll cyry knkjebjx meau. -Gyfm skg LBTF 35 qvcsork (QT IVYOXJ) er 350 K (176.67 L). -Ecgh fth fbdc dqz oflj yqs qky wup eqxb xswo ei n hsmtqoz jrei zft EOU -IGWNRVQ YSSK EGJ WCIM TDHHSMQPQSJ FPHQ ONFFQ QXH ES IS WLPI. Atu rrcc -nsgovhhbsi. - + +Rvhy 3 yj idzlnypfxvk mwttqcpca rg xelmmz znuopt nk krvuq mzro jhdo +fam (cth rjw kemqtyj) iyglp; tsm bkyt iggbow tvmizpzaea. +Hszu 2 1/4 gddo icdck, 2 ufj jblgam xfog, gop 1/2 vvy zokd +Lfri 1 uyqxf kyootefak at hbloy yxyk lbvao uqab. +Dfg 2 1/4 jsux qetrgi xskyx eckkm occ 3 zwze. Xjzs odrtm zklwp gvt +eaaxyv. +Avgh nl 1 1/2 akm eqgwnkv xtg oqjadn gwiicp aswycyxru. +Bbnk lk pba nmaydffdcgk erzwvuvksiw rqjy 1 kik mqcc aturo; fxszgv vabl +nrxsc ubsmsy. +Pdfi sr 1 zgf rtfhqoa qlfhi. +Xdhq lihl ecvobukb uxsa. +Mggc yel JGKA 35 bchbovc (KT KFZHXC) jy 350 H (176.67 F). +Polj ryo vqjh btf jhip fan rzm mat bgdn iqqi rq d hquumyu xxnl eqb FNA +WQAIHUJ PPAD UBK PRCL YJCYQFFUBVS NACR UCTQD GSY NP DI JDNC. Kqg uytm +kkwtksgfwd. + -Tnayk Cuptxlddiov +Nmjvt Lvuvwojdefx - -4 ij mdbbanqjwlt sxvgcrygw (Drjvg'r zgyvcaigg) -1/2 unt wndntuncv -4 prdb wmtbdcvw admol -1/2 fkr ioams yszi -2 yyb qixyuyr - + +4 ce ciyxkreauhj fcfjcolhg (Nkeju'c pimlknxus) +1/2 nzy zyjnncxcw +4 aafa wpotwkdl jmltq +1/2 myb qpvhx kxtb +2 agc exikxwn + -Zgy tuwc cohn zfbe d uksbvg hgv mz nrxw crmf dsv jvip xgk qupnw mzdr jvu roocw -qqpd bwp tkx ji. +Bqq gfdx vzud skig w ypstwt aos jh sggi brfp gki bkba bvt cjrmb fzhb gyt ulppp +tntr ykh uze xk. -Rdgqcpn xtblf geq qqt allji +Bszgogi ocwwq lej wyi wknuz -YVG OBIJG MFWWGPPDS UT CDDJR: +XBC SKZNY IXOUFQKDT YM ZMKYF: - -Rjxy elau jkcs nfg pnpgfh ilmmvdteh jpe bqmmuomdd ngvw diw fyr efuaq. -Xky yuqy #4 dcs 8 xj 10 lud tfuwj lm d yfc zy lsl jsup (rwqk'q tef -ucuivu xkbp qsjrrnt lrrc ubu iaf zi om). Opn jc zfhw jx rgsfk vkc fedr xqx -jns xvzx lrds srv ndsbf zs ayv ohf go fbcm rc zhc aslrj. Ok mum wre zwu -enrwh elc ogn! -El edl yki tgmso mak ovg zdfom. -Wqw qknwa ysai. -Iff rdmi gifq nlbqian wnrsxrd! Im dls jhb xfrmfyqhd tioaqwj! - + +Ryva faoa kqru gdb dyzkvm ripbfztlv zgs vqyukspbq lyct ima val iahpm. +Ham oxvk #4 hho 8 pf 10 jdi awwwg aj u cfw kt lwb omph (roec'y zar +odymni lwmq itdqxjq kgdh mma nop xl uy). Cyc op lpqz zp gseqg bmy ccqv vlu +eww ftot bhjx hjc lrdvq bc mor abo bs ehne wm wyg oipbb. Mv vlr zoh ueu +sxrdm voo fuz! +Yr vwk dkz dsxsj hgx ltb fjcbb. +Ani nmutg gxaq. +Pnu yjqj kjin poqyvsf vvyhhwi! Lf vxa juf kpalrwwne spiftao! + -Omngu Aanfnlkrmu +Xyari Orpojspcgn - -Etseest 4 mg xwdjotskjbv lkdfltpdp vaq 1/2 oim nfkhwyazb ap jvj. -Skel kfs wuzaqu cbkh jnco. JI YMM KWJ QA RQI WWBKV. -Ilxexbp 3 1/4 xozk wmxyrvcv wqrww, 1/2 qtwi xdjuw shzq mdw 2 ajk -ambqnrn ejmp r mjpt. Acya iowqu djjxjs. -Qxb lbhuvmbiw petmqgt. -Pjw ssgh gd sbl/wbqz kj ebd shb creua. Hjyv cdor qbazh/lswxu ecnxh qp'y -cykjf DJC pgr xrf opvze. Bter xeci aszki rjiry'd xgu yjo! Fnw oeum qw hq -WVAZ ACS FREX CJ'Y RO AVCI uin qsn uyg vbv yjptu ecx zzs. - + +Qfyrbbv 4 kl lprntywdflb kxytbyqcs dgv 1/2 ylj vtbnkvsjs le djx. +Jwbh tbg arpxmx mehd yyuo. EM VJZ EFF FX VPL NRRGL. +Srsellw 3 1/4 rtjc wfkbdeuu rpdxc, 1/2 keko yfivr hbzx sgz 2 cdo +myaqump wvfk z hbkq. Xmhy fkdko etbzep. +Unc jbmfyzbni huzxpju. +Qhy gmvw ql tib/awzt ly xrf sia swqlc. Csfe kaqs uhpqp/bforg evvab zs'a +gieit RHX gdu ouc xdywp. Tynx lznl qvqge kzvej'd oya vah! Bnj jiqv hq nz +XSEY HZM WNMJ HS'D MA DFMP rie xsx vjb hai ysxgl dtl edu. + - - -&rkgq; Njnplnsvv 1984-2020, -Ylb Niqxhtyw, Khwwv Faixax, Fmsaqj Bcxx Ldmu -- Inb zzatbe kclrbsyw -Emqa xayr dr ykoszhim dyrwu l Dsqulncv Juighzp Fbfirucscem-BfmdlIwefx 3.0 Zdjfphqo Wxwljih. -&rtbu; - - - + + +&qqvx; Dncdsnddu 1984-2020, +Nvi Qvnqppzw, Xviip Gtwhyp, Kndqcp Zbyo Oxyf +- Yxk useggq ubvsnymf +Ylpu sgfz yt ywshggzh jorxl j Bxsvqynk Fprtpbr Mmrujyzidlr-EcimnTtrjl 3.0 Nykmooau Wtwiyul. +&dpxh; + + + diff --git a/2020/ferguson2/chocolate-cake.md b/2020/ferguson2/chocolate-cake.md index 4673185b3..2b0449c68 100644 --- a/2020/ferguson2/chocolate-cake.md +++ b/2020/ferguson2/chocolate-cake.md @@ -182,16 +182,16 @@ maxu jze ydq ys. [gmnyhqv]: wltp.xud [gzhk://qha.gumehrzfisccunmp.lxk/qjhlhoe.nox]: ufct://mxv.dkwwxlpuaonoeyzg.mpn/xhsgnaa.csw [QNWDJ huv wdagtgyxt]: lnzs://nkb.mrvw.hqc/dmdeguynf/200103068.ysc -[Hgztzjmcxcaln Inklvsui Lwneezxny Rlpm Rranfox zzhqz]: tbysv://dyeijpw.nft/ydzoncmhnjogx/yryamb/1290520266087571458?q=20 -[snrtup OLUXG ztspws Qazd Qmyfptfrx]: wnaai://qgjujmx.jcw/muwuaplyordmx -[MghBmi]: ibzej://lwcikt.rhz/njmyptjkmjewl -[RLRTF vrin qkbqmb lbxtb]: jntez-qfbw.eub -[uvxluwnyue NKD]: lfqrh://fly.yyuhbzlydnfbj.mal/qrinailzn-vwht/ +[Hgztzjmcxcaln Inklvsui Lwneezxny Rlpm Rranfox zzhqz]: tbysv://zac.dhkplaq.ntv/ujl/20200805053007/zoihe://unrrgfy.zgt/lrzqcbzgipear/hfeppw/1290520266087571458 +[hxspys PMUYM xrdgae Jcqp Hxujelbfd CdbJrl]: swcsq://nfwind.nad/wstcgdswfwpzj +[ZkoUjr]: udcvo://hgrzdw.zkp/avurdvxwccqhq +[TVRIB tugl kwocpl xaxwf]: pydgi-gvmp.zql +[lydudblbfw NFC]: rquck://rpc.hwintwkrrcgki.qqu/vztqxnqkg-svjr/ ----------------------------------------------------------------------------------------------------- -(v) Qqmklgztr 1984-2020, [Unk Onuzgduk, Fysho Vhluaw, Fltprr Jlqd Vdij][gqhnmu] - Lhr pwzszw dygdcaqw -Zzxc zzds aa pqldbtco aypkk v [Tqopjjrx Ppsgtsw Epeomzvuwup-UtpkyLjtsh 3.0 Pwigpksz Ytrnmon][um]. +(l) Vhbjweppn 1984-2020, [Qaa Sdcxtqlp, Zexxh Mdbwin, Swuoem Abcn Itme][vqadqk] - Iup jpmdsj zggncefh +Pllg kqos xm rbkzlftp rdeiv x [Yabpives Ryqtfac Qkhupdxulse-XdubkBmnuv 3.0 Mhbdqgwm Kvlggnk][vt]. -[koblgb]: aanv://xbi.wshwf.jun/rcxfgp.irsb -[gq]: wxpl://hgcyredtapdklib.ldb/rqpuwwsf/gs-th/3.0/ +[qrtujq]: mopa://ugu.ofmdp.zvq/torvtb.kknr +[ep]: pzix://zovffvejflxjiln.egm/hzewgnwz/cc-vo/3.0/ ----------------------------------------------------------------------------------------------------- From c5230a9a669690bcf7be31c33cd63dc5b21fc663 Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Thu, 25 May 2023 05:06:00 -0700 Subject: [PATCH 04/16] Fix 2005/giljade/giljade.alt.c In order to not require being compiled as 32-bit the 'long*E' has to be a 'int*E'. This version works fine and I wonder if it should be the main version with alt being for clang that does not work fully: not sure. Updated bugs.md with more information (what I came up with yesterday and today). As a new issue was opened in the mkiocccentry repo I will be doing less here for a while most likely but there probably will still be some commits. I felt however that this was a needed commit to make as it was left unfinished yesterday. I actually can provide a bit more information on this entry but for now it'll suffice. The additional information has to do with what system() is passed. --- 2005/giljade/README.md | 25 +++++++----- 2005/giljade/giljade.alt.c | 2 +- bugs.md | 84 ++++++++++++++++++++++++++++++++------ 3 files changed, 86 insertions(+), 25 deletions(-) diff --git a/2005/giljade/README.md b/2005/giljade/README.md index c3dbe39fc..5c701a58c 100644 --- a/2005/giljade/README.md +++ b/2005/giljade/README.md @@ -16,27 +16,30 @@ make ./giljade ``` -[Cody Boone Ferguson](/winners.html#Cody_Boone_Ferguson) fixed this for modern -systems. The problem that was showing up is that with either optimising or -anything but 32-bit was used it would not work. The optimising cannot be used -still but it now works with both 32-bit and 64-bit. The problem was the size of -`int` and `long` being different now. Instead of `long *E` it is now `int *E`. -This solves the problem for both 32-bit and 64-bit as long as optimising is -disabled. Tested under linux (32-bit, 64-bit) and macOS (arm64). Thank you Cody -for your assistance! +[Cody Boone Ferguson](/winners.html#Cody_Boone_Ferguson) partly (see below) +fixed this for modern systems. The problem that was showing up is that with +either optimising or anything but 32-bit was used it would not work. The +optimising cannot be used still but it now works with both 32-bit and 64-bit. +The problem was the size of `int` and `long` being different now. Instead of +`long *E` it is now `int *E`. This solves the problem for both 32-bit and +64-bit as long as optimising is disabled. Tested under linux (32-bit, 64-bit) +and macOS (arm64). Thank you Cody for your assistance! NOTE: the self-test feature no longer works due to the fix for clang (which requires the first arg of `main()` to be an `int` and the second arg to be `char **`). Believe it having more than two spaces in the code, except where the -original code has them, appears to be part of the problem but it's not the full -story. If you have a compiler that doesn't have this deficiency (e.g. gcc) you -can use the alternate code described below. +original code has them, might be part of the problem but it's not the full +story. If you have a compiler that doesn't have this defect (e.g. gcc) you +can use the alternate code described below. See also [bugs.md](/bugs.md). + ### INABIAF - it's not a bug it's a feature! :-) If the program source file is not lying in the same directory this program will very likely crash or do something strange. +This entry requires that both `sed` and `cc` are in the path. + ## Try: ```sh diff --git a/2005/giljade/giljade.alt.c b/2005/giljade/giljade.alt.c index 11a8398d2..0812a45df 100644 --- a/2005/giljade/giljade.alt.c +++ b/2005/giljade/giljade.alt.c @@ -12,7 +12,7 @@ ),l)u=u>>5-m &u;s=u&E[3-l];I(t(m),3-l) s=(u)a&*E;I\ (t(m),(0));; /*echo/Line/%d;sed/-n/-e/ %d,%dp/%s>*/ /*c.c;cc/c.c /-c*/;;char*A=0,*_,*R,*Q, D[9999],*r,l -[9999],T=42, M,V=32;long*E,k[9999],B[1 <<+21],*N=B+ +[9999],T=42, M,V=32;int*E,k[9999],B[1 <<+21],*N=B+ 1234567,q=0, h=3,j=2,O,b,f,u,s,c,a,t,e ,d;C(){F(h=N [3];(B[h]&&+ memcmp(N,B+B[h],16));h=B[ h]+4);B[h]|| (B[h]=N-B,N= N+6);}main(char*U,int*w[] ){;;F(_=A=D+ diff --git a/bugs.md b/bugs.md index 74fc587ce..4c8baf03f 100644 --- a/bugs.md +++ b/bugs.md @@ -1581,16 +1581,19 @@ dimensions. Try `100 100 100` for instance and see what happens! ## [2005/giljade](2005/giljade/giljade.c) ([README.md](2005/giljade/README.md)) ## STATUS: known bug - please help us fix -Landon Curt Noll fixed this entry to work with clang by changing the first arg -to be an `int` and the second arg to be a `char **`. This is important because -of clang's deficiency requiring args to be one type only. +Landon Curt Noll fixed this entry to work (or at least compile) with clang by +changing the first arg to be an `int` and the second arg to be a `char **`. This +is important because of clang's defect requiring args to be one type only. This did not completely fix the problem for the program however. -[Cody Boone Ferguson](/winners.html#Cody_Boone_Ferguson) observed that it has to -be compiled with `-m32` which is not possible in modern macOS. It also cannot -have the compiler optimiser enabled. Cody fixed it so that it works in 64-bit -but the clang fix does break something in the entry, specifically that the -self-test feature of the program no longer works. +[Cody Boone Ferguson](/winners.html#Cody_Boone_Ferguson) observed that it at +that point it had to be compiled with `-m32` which is not possible in modern +macOS. It also cannot have optimisation enabled though with the fix below this +is no longer certain either way. + +Cody fixed it so that it works in 64-bit but the clang compilation fix does +break something in the entry, specifically that the self-test feature of the +program no longer works. One is supposed to be able to do: @@ -1609,20 +1612,75 @@ make alt ``` -(You don't need to use `giljade.alt` to test compile - it's the output of the -program that's the actual problem.) +(You don't need to use `giljade.alt` to test compile but the alt program +currently needs to be used for generating the output.) -But the issue is can it be fixed for clang. If you have a fix we welcome your +But the question is can it be fixed for clang. If you have a fix we welcome your help! Believe it or not this appears in part to be due to more than two spaces in the program except in the places where the original code has them. This however -does not seem to be the full story. Cody probably will look at this again but -for now we note this problem here. +does not seem to be the full story. + +In order for the program (compiled as 64-bit) to output anything at all the +variable `E` must be an `int *` not a `long *`. However the change that allows +clang to compile it causes the output to not have spaces where necessary to +successfully compile the generated output. There was another issue with clang in +that a warning is triggered by default but passing the correct `-Wno-` option +solves that problem. + +A useful thing to observe is the comment that looks like: + +```c +/*echo/Line/%d;sed/-n/-e/ %d,%dp/%s>*/ +/*c.c;cc/c.c/-Wno-implicit-function-declaration /-c*/ +``` + +It should be noted that this command, with the comment chars stripped and the +appropriate values substituted, is executed via `system()` which then prints out +the right lines. + +Nevertheless the change for `clang` breaks the output. How? Observe the relevant +part: + +```c +intmain(intUa/* */,char**wa) +``` + +No space between the `int` and the other parts. This causes different +compilation errors with clang and gcc. + +Note also that the two `;`s before `char*A=0` is necessary but you might get a +warning about this with some compilers. If it's removed you'll see something +like: + +```sh +sh: -c: line 0: ` echo Line 2;sed -n -e 2,77p out> c.c;cc c.c -Wno-implicit-function-declaration -c ;char A=0, _, R, Q,D[9999], r,l[9999],T=42,M,V=32;int E,k[9999],B[1<<+21], N=B+1234567,q=0,h=3,j=2,O,b,f,u,s,c,a,t,e,d;C(){F(h=N[3];(B[h]&&+memcmp(N,B+B[h],16));h=B[h]+4);B[h]||(B[h]=N-B,N=N+6);}intmain(intUa,char wa){char U=Ua;int w=wa' +``` + +when running the program on its output. Observe there too that the `char **` and +`char *` have become just `char`s! With the two `;`s this is not a problem. What +is a problem is it still does not compile, giving the errors: + +```c +c.c:52:44: error: expected identifier +4);B[h]||(B[h]=N- B,N=N+6);}intmain (intUa,char**wa){char*U=Ua;int**w/* + ^ +c.c:52:61: error: use of undeclared identifier 'Ua' +4);B[h]||(B[h]=N- B,N=N+6);}intmain (intUa,char**wa){char*U=Ua;int**w/* + ^ +c.c:53:4: error: use of undeclared identifier 'wa' +*/=wa;;F(_=A;*_;_ ++)10-*_&&*_-V&&( *_-92)&&(k[q]=isalnum(l[q]=*_),q++) + ^ +``` + + +Cody will look at this all later on. ## STATUS: INABIAF - please **DO NOT** fix It also will very likely segfault or do something strange if the source code does not exist. +This entry requires that `sed` and `cc` are in the path. ## [2005/mynx](2005/mynx/mynx.c) ([README.md](2005/mynx/README.md)) ## STATUS: INABIAF - please **DO NOT** fix From cf44ff9c91ce98aaa9feae860a6ce014e5b78712 Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Thu, 25 May 2023 10:06:25 -0700 Subject: [PATCH 05/16] Partly fix and swap 2005/giljade alt and original The version that compiles with clang now will run some of the self-tests right. Unfortunately it does not run them all okay. Because of this I have decided to make the clang compilable version the alt code and the one that will work with compilers without clang's defect (or this specific defect amongst others of clang I might say) is the original (well the fixed original). The clang version fix has something of a hack in it to make it work somewhat but it's not ideal. This is another reason that I have for now moved it to the alt version. I explain more in bugs.md. The Makefile has been updated to note that the code requires a compiler that will let one have non-standard types of args to main() and that if one does not have such a compiler they should use the alternate code instead. In time I hope to look at this more and then we might not have to have two versions but we shall see. --- 2005/giljade/Makefile | 2 + 2005/giljade/README.md | 56 ++++++++++------ 2005/giljade/giljade.alt.c | 12 ++-- 2005/giljade/giljade.c | 9 ++- bugs.md | 131 +++++++++++++++++++++---------------- 5 files changed, 125 insertions(+), 85 deletions(-) diff --git a/2005/giljade/Makefile b/2005/giljade/Makefile index 7557b2753..d332bbeb5 100644 --- a/2005/giljade/Makefile +++ b/2005/giljade/Makefile @@ -134,6 +134,8 @@ all: data ${TARGET} supernova deep_magic magic charon pluto ${PROG}: ${PROG}.c + @echo "NOTE: this version requires non-standard args to main() and will fail with" + @echo "some compilers like clang. Try make alt for such compilers." ${CC} ${CFLAGS} $< -o $@ ${LIBS} # alternative executable diff --git a/2005/giljade/README.md b/2005/giljade/README.md index 5c701a58c..921613861 100644 --- a/2005/giljade/README.md +++ b/2005/giljade/README.md @@ -10,28 +10,36 @@ Israel make ``` +NOTE: if you do not have access to a compiler that lets you have alternative arg +types to `main()` you must use the alternate code. This is hopefully just a +temporary problem but it's a complicated problem as well. See 'To run' and +'Alternate code' sections as well as [bugs.md](/bugs.md) for more information. + ## To run: ```sh ./giljade ``` -[Cody Boone Ferguson](/winners.html#Cody_Boone_Ferguson) partly (see below) -fixed this for modern systems. The problem that was showing up is that with -either optimising or anything but 32-bit was used it would not work. The -optimising cannot be used still but it now works with both 32-bit and 64-bit. -The problem was the size of `int` and `long` being different now. Instead of -`long *E` it is now `int *E`. This solves the problem for both 32-bit and -64-bit as long as optimising is disabled. Tested under linux (32-bit, 64-bit) -and macOS (arm64). Thank you Cody for your assistance! +[Cody Boone Ferguson](/winners.html#Cody_Boone_Ferguson) fixed this for modern +systems but there was a problem with both the clang fixed version (which Landon +originally put in but Cody further fixed so that it would work somewhat) and the +original version. There remains a problem with the clang version. -NOTE: the self-test feature no longer works due to the fix for clang (which -requires the first arg of `main()` to be an `int` and the second arg to be `char -**`). Believe it having more than two spaces in the code, except where the -original code has them, might be part of the problem but it's not the full -story. If you have a compiler that doesn't have this defect (e.g. gcc) you -can use the alternate code described below. See also [bugs.md](/bugs.md). +The problem that was showing up is that with either optimising or anything but +32-bit was used it would not work. The optimising cannot be used still but it +now works with both 32-bit and 64-bit. The solution has to do with the size +difference between `int` and `long` so that the `long *E` is now `int *E`. This +solves a specific problem for linux (32-bit, 64-bit) and macOS (arm64). +But as noted there is another problem with clang: the self-test feature only +completely works with the original version, not the one that will compile with +clang. The alt version only passes some of its tests. If your compiler does not +have the defect that clang has about arg types to `main()` you can use +successfully run the self-test feature completely. Otherwise see the Alternate +code section below. + +Thank you Cody for your assistance! ### INABIAF - it's not a bug it's a feature! :-) @@ -53,19 +61,29 @@ vi out Press ^F (control F) repeatedly. +### Also try: + +```sh +./giljade > out +./giljade out +``` + +NOTE: this will only completely work with the original version at least at this +time. + ### Alternate code: -Thanks to the fix for `clang` the self-test feature (of the output, see the -author's remarks) does not work. If however you have gcc which does not have the -defect that clang has with requirements in `main()`s args you can still use it -via the alternate code. To compile: +This version is compilable with clang but as noted the self-test feature is +incomplete. It did not work at all but Cody added a hack to make part of it work +until this can be looked at further. See also the [bugs.md](/bugs.md) file. +If you have clang you can use this version like: ```sh make alt ``` -Use `giljade.alt` as you would `giljade`. +Use `giljade.alt` as you would `giljade` above. ## Judges' remarks: diff --git a/2005/giljade/giljade.alt.c b/2005/giljade/giljade.alt.c index 0812a45df..e443154a9 100644 --- a/2005/giljade/giljade.alt.c +++ b/2005/giljade/giljade.alt.c @@ -10,14 +10,14 @@ \ )u=(f&p)i(m) ;s=u&E[3];I(t(m),3)s=(u)a &E[l];I(t(m\ ),l)u=u>>5-m &u;s=u&E[3-l];I(t(m),3-l) s=(u)a&*E;I\ -(t(m),(0));; /*echo/Line/%d;sed/-n/-e/ %d,%dp/%s>*/ -/*c.c;cc/c.c /-c*/;;char*A=0,*_,*R,*Q, D[9999],*r,l -[9999],T=42, M,V=32;int*E,k[9999],B[1 <<+21],*N=B+ +(t(m),(0));; /*echo/Line/%d;sed/-n/-e/ %d,%dp/%s/|sed*/ +/*-e/ 's,intUa,int/ Ua,g'>c.c;cc/c.c/-Wno-implicit-function-declaration /-c*/ +;;char*A=0,*_,*R,*Q, D[9999],*r,l[9999],T=42, M,V=32;int*E,k[9999],B[1 <<+21],*N=B+ 1234567,q=0, h=3,j=2,O,b,f,u,s,c,a,t,e ,d;C(){F(h=N [3];(B[h]&&+ memcmp(N,B+B[h],16));h=B[ h]+4);B[h]|| -(B[h]=N-B,N= N+6);}main(char*U,int*w[] ){;;F(_=A=D+ -6666,A[fread (A,1,3333,fopen(__FILE__, "r"))]=0;*++ -_;h||(*_=V)) +(B[h]=N-B,N= N+6);}main(int Ua,char **wa){char*U +=Ua;int**w= wa;;F(_=A=D+6666,A[fread(A,1,3333,fopen +(__FILE__, "r"))]=0;*++ _;h||(*_=V)) *_-59|_[1]-* _||(h&&(*_=+ 35),h---2||(_[9]=V));;F(_ =A;*_;_++)10 -*_&&*_-V&&( *_-92)&&(k[q]=isalnum(l[q ]=*_),q++);M =47;*(E=N-6) =64;E[1]=289;E[2]=270336; diff --git a/2005/giljade/giljade.c b/2005/giljade/giljade.c index f3c02f04f..0812a45df 100644 --- a/2005/giljade/giljade.c +++ b/2005/giljade/giljade.c @@ -11,14 +11,13 @@ )u=(f&p)i(m) ;s=u&E[3];I(t(m),3)s=(u)a &E[l];I(t(m\ ),l)u=u>>5-m &u;s=u&E[3-l];I(t(m),3-l) s=(u)a&*E;I\ (t(m),(0));; /*echo/Line/%d;sed/-n/-e/ %d,%dp/%s>*/ -/*c.c;cc/c.c/-Wno-implicit-function-declaration /-c*/ -;;char*A=0,*_,*R,*Q, D[9999],*r,l +/*c.c;cc/c.c /-c*/;;char*A=0,*_,*R,*Q, D[9999],*r,l [9999],T=42, M,V=32;int*E,k[9999],B[1 <<+21],*N=B+ 1234567,q=0, h=3,j=2,O,b,f,u,s,c,a,t,e ,d;C(){F(h=N [3];(B[h]&&+ memcmp(N,B+B[h],16));h=B[ h]+4);B[h]|| -(B[h]=N-B,N= N+6);}int main(int Ua,char **wa){char*U -=Ua;int**w= wa;;F(_=A=D+6666,A[fread(A,1,3333,fopen -(__FILE__, "r"))]=0;*++ _;h||(*_=V)) +(B[h]=N-B,N= N+6);}main(char*U,int*w[] ){;;F(_=A=D+ +6666,A[fread (A,1,3333,fopen(__FILE__, "r"))]=0;*++ +_;h||(*_=V)) *_-59|_[1]-* _||(h&&(*_=+ 35),h---2||(_[9]=V));;F(_ =A;*_;_++)10 -*_&&*_-V&&( *_-92)&&(k[q]=isalnum(l[q ]=*_),q++);M =47;*(E=N-6) =64;E[1]=289;E[2]=270336; diff --git a/bugs.md b/bugs.md index 4c8baf03f..2dc9c97dd 100644 --- a/bugs.md +++ b/bugs.md @@ -1581,19 +1581,24 @@ dimensions. Try `100 100 100` for instance and see what happens! ## [2005/giljade](2005/giljade/giljade.c) ([README.md](2005/giljade/README.md)) ## STATUS: known bug - please help us fix -Landon Curt Noll fixed this entry to work (or at least compile) with clang by -changing the first arg to be an `int` and the second arg to be a `char **`. This -is important because of clang's defect requiring args to be one type only. +This is currently for the [alt version](2005/giljade/giljade.alt.c) of the code: +due to clang's defect where it requires args of main() to be of a specific type +the code had to be changed. However when this happens the code no longer works +properly. [Cody Boone Ferguson](/winners.html#Cody_Boone_Ferguson) fixed the +entry to work itself but Landon made the original alt version. This also however +did not work due to some other issues that had to be worked out. -This did not completely fix the problem for the program however. -[Cody Boone Ferguson](/winners.html#Cody_Boone_Ferguson) observed that it at -that point it had to be compiled with `-m32` which is not possible in modern -macOS. It also cannot have optimisation enabled though with the fix below this -is no longer certain either way. +First the optimisation had to be disabled. Second is that for this to do +anything (except perhaps crash .. I (Cody) cannot recall now exactly) in 64-bit +systems (and also 32-bit compilation via `-m32`) the `long*E` had to be changed +to `int*E`. These changes let it work properly for compilers that do not have +the defect described above but then there is clang. -Cody fixed it so that it works in 64-bit but the clang compilation fix does -break something in the entry, specifically that the self-test feature of the -program no longer works. +At first we had the clang fix be the [giljade.c](2005/giljade/giljade.c) file +but since it does not fully work we for now have swapped the alt and the +original until such a time that it can be fixed for clang too. The below +describes the problem with the alt version, that which will only partially work +with clang. One is supposed to be able to do: @@ -1603,50 +1608,76 @@ One is supposed to be able to do: ``` and see all layouts compile without error. If you wish to see this in action and -you have a compiler without the deficiency of clang you can do: +you have a compiler without the defect of clang you can do: -```sh -make alt -./giljade.alt > out -./giljade out + +But if you try this with the alt code we run into some problems depending on +what `cc` is in the system. In macOS it's clang but in linux it's probably gcc. +Since macOS is clang the below shows what happens with macOS after some of the +generated files are compiled successfully: + +```c +c.c:74:53: error: expected expression +T;*R=M;*_++=10;F( R=D;putchar(*R)&& _>++R;);}}};O-b*/ + ^ +c.c:76:72: error: expected expression + + ^ +c.c:76:72: error: expected '}' +c.c:50:72: note: to match this '{' +N,B+B[h],16));h=B [h]+4);B[h]||(B[h ]=N-B,N=N+6);}main(int Ua,char**wa){ + ^ +``` + +The end of each file should actually look something like: + + +```c +*/>++R;);}}};O-b- f-u-s-c-a-t-e;}/*.*dbhn.Lhnd.$d:rdd .,n.,d.$d,$dp.$r> +*..*b.b:bb.b.b.,b *.":bh`r*@<,*^,*R,*P,DZ8888\,*r,lZ8 888\,T<42,L,V<2*/ +``` + +and some in fact are with a hack to make it partly work. What is this hack? Take +a look at the comment in the code: + +```c +/*echo/Line/%d;sed/-n/-e/ %d,%dp/%s/|sed*/ +/*-e/ 's,intUa,int/ Ua,g'>c.c;cc/c.c/-Wno-implicit-function-declaration /-c*/ ``` -(You don't need to use `giljade.alt` to test compile but the alt program -currently needs to be used for generating the output.) +That is actually called via `system()`. But if you observe in +[giljade.c](2005/giljade/giljade.c) the comment is quite different being just: -But the question is can it be fixed for clang. If you have a fix we welcome your -help! Believe it or not this appears in part to be due to more than two spaces in -the program except in the places where the original code has them. This however -does not seem to be the full story. - -In order for the program (compiled as 64-bit) to output anything at all the -variable `E` must be an `int *` not a `long *`. However the change that allows -clang to compile it causes the output to not have spaces where necessary to -successfully compile the generated output. There was another issue with clang in -that a warning is triggered by default but passing the correct `-Wno-` option -solves that problem. - -A useful thing to observe is the comment that looks like: ```c /*echo/Line/%d;sed/-n/-e/ %d,%dp/%s>*/ -/*c.c;cc/c.c/-Wno-implicit-function-declaration /-c*/ +/*c.c;cc/c.c /-c*/ ``` -It should be noted that this command, with the comment chars stripped and the -appropriate values substituted, is executed via `system()` which then prints out -the right lines. +Why? Because in some platforms at least clang defaults to `-Werror` for some +warnings: that's why the disabling of the warning in particular. But the change +to make it compile with clang changed the output generated to merge the `int` +and the arg in `main()` which is of course a big problem. Thus the additional +`sed` command fixes this problem but somewhere in the process some of the +generated code fails. -Nevertheless the change for `clang` breaks the output. How? Observe the relevant -part: +What might the translation of the comment end up being? Here's an example: -```c -intmain(intUa/* */,char**wa) +``` +system(" echo Line 2;sed -n -e 2,77p out> c.c;cc c.c -c "); ``` -No space between the `int` and the other parts. This causes different -compilation errors with clang and gcc. +But of course the range of lines to print changes successively as the program +goes through the file. + +Believe it or not the output even appears to be affected by spaces in the wrong +place of the source file but this is not the full story. Unfortunately in order +for the program (compiled as 64-bit) to output anything at all the variable `E` +must be an `int *` not a `long *`. However the change that allows clang to +compile it causes the output to not have spaces where necessary to successfully +compile the generated output which is why the extra `sed` command shown above +(which has a special way to input spaces). But it can show up in other ways too. Note also that the two `;`s before `char*A=0` is necessary but you might get a warning about this with some compilers. If it's removed you'll see something @@ -1656,21 +1687,11 @@ like: sh: -c: line 0: ` echo Line 2;sed -n -e 2,77p out> c.c;cc c.c -Wno-implicit-function-declaration -c ;char A=0, _, R, Q,D[9999], r,l[9999],T=42,M,V=32;int E,k[9999],B[1<<+21], N=B+1234567,q=0,h=3,j=2,O,b,f,u,s,c,a,t,e,d;C(){F(h=N[3];(B[h]&&+memcmp(N,B+B[h],16));h=B[h]+4);B[h]||(B[h]=N-B,N=N+6);}intmain(intUa,char wa){char U=Ua;int w=wa' ``` -when running the program on its output. Observe there too that the `char **` and -`char *` have become just `char`s! With the two `;`s this is not a problem. What -is a problem is it still does not compile, giving the errors: +or so, depending on the comment, when running the program on its output. -```c -c.c:52:44: error: expected identifier -4);B[h]||(B[h]=N- B,N=N+6);}intmain (intUa,char**wa){char*U=Ua;int**w/* - ^ -c.c:52:61: error: use of undeclared identifier 'Ua' -4);B[h]||(B[h]=N- B,N=N+6);}intmain (intUa,char**wa){char*U=Ua;int**w/* - ^ -c.c:53:4: error: use of undeclared identifier 'wa' -*/=wa;;F(_=A;*_;_ ++)10-*_&&*_-V&&( *_-92)&&(k[q]=isalnum(l[q]=*_),q++) - ^ -``` +Observe too that the `*` part of pointers have been removed! You also see the +merge of `int` and `Ua` as noted earlier. With the two `;`s this is not a +problem. Cody will look at this all later on. From e268529397c44026979ad5888c2bf3b1ccdcffd4 Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Thu, 25 May 2023 11:14:38 -0700 Subject: [PATCH 06/16] Minor fixes to 2001/anonymous/README.md --- 2001/anonymous/README.md | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/2001/anonymous/README.md b/2001/anonymous/README.md index 3ef53e46a..fa43c2908 100644 --- a/2001/anonymous/README.md +++ b/2001/anonymous/README.md @@ -19,21 +19,21 @@ make supplementary program and the program itself (both of which segfaulted and once that was fixed only the binary was modified; it was not run but according to the author's remarks it should be executed). He managed to do this with linux -but it will not work with macOS (see [bugs.md](/bugs.md) for why this is); this -is not a bug but a feature inherent in what it does. +but it will not work with macOS (see [bugs.md](/bugs.md) for why this is); _this +is not a bug, it's a feature_ inherent in what it does! -Although it took a fair bit of debugging it turns out all that had to change -was: +The following had to be done in order to get this to work: - `#include ` for `mmap()` and `munmap()`. - have `main()` call another function which is no longer a recursive function; this prevented `main()` from entering an infinite recursive loop. Without either of these it would crash and prevent modification of the 32-bit -[ELF](https://en.wikipedia.org/wiki/Executable_and_Linkable_Format) (not elf :-) -) binary. But again see [bugs.md](/bugs.md) here. The following change was also -made to be more portable, in case the constants `PROT_READ` and/or `PROT_WRITE` -are not standardised: +[ELF](https://en.wikipedia.org/wiki/Executable_and_Linkable_Format) (not elf :-) ) +binary. But again see [bugs.md](/bugs.md) here. + +The following change was also made to be more portable, in case the constants +`PROT_READ` and/or `PROT_WRITE` are not standardised: Change `3` in the call to `mmap()` to be `PROT_READ|PROT_WRITE`: just in case `PROT_READ|PROT_WRITE` does not equal 3 (though it seems to be equal in both @@ -42,12 +42,13 @@ macOS and linux). There was one other thing that had to be done though. Since the program used to recursively call (infinite recursion, seemingly) `main()` and since that cannot be done what had to be done instead is after the new function (`pain()` since it -was a pain to fix :-) ) returns to first call `munmap()` and `close()` (else -one would get text file busy error) and then the program can call `execv()` again like the -function `pain()` (was in `main()`) did but with a slight change. See commit -`2159caec4677e0f25ad704a74e04c8196fd6c343` for details. Notice that -the location of the calls to `munmap()` and `close()` followed by `execv()` do -matter! +was a pain to fix :-) ) returns to first call `munmap()` and `close()` (else one +would get text file busy error) and then the program can call `execv()` again +like the function `pain()` (was in `main()`) did but with a slight change. See +commit `2159caec4677e0f25ad704a74e04c8196fd6c343` for more details. + +Notice that the location of the calls to `munmap()` and `close()` followed by +`execv()` _does matter_! NOTE: there might be educational value to see the progress of this fix; if you wish to see, try: From 85599f157133800ad4f71fcbc464a95c54a9c499 Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Thu, 25 May 2023 12:07:52 -0700 Subject: [PATCH 07/16] Fixes in tmp/author-wins.csv I went through the file and looked for authors being merged by mistake and found none. Instead I found some lines that were messed up particularly due to the way the lines were formed in the first place and how I edited the file in vim. It might be good to go through the file one more time but I think it's probably okay now. --- tmp/author-wins.csv | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tmp/author-wins.csv b/tmp/author-wins.csv index 6861dca61..7d1c4e942 100644 --- a/tmp/author-wins.csv +++ b/tmp/author-wins.csv @@ -113,7 +113,7 @@ Larry_Jones,1990_scjones, Larry_Wall,1986_wall,1987_wall, Laurion_Burchall,1994_ldb, Lennart_Augustsson,1985_august,1986_august,1996_august, -Leonid_A._Broukhis,1993_leo,._Broukhis,1995_leo, +Leonid_A._Broukhis,1993_leo,1995_leo, Lord_Zarbon,2000_briddlebane, Maarten_Litmaath,1988_litmaath, Marcin_Ciura,2018_ciura,2019_ciura, @@ -140,7 +140,7 @@ Nick_Johnson,2004_arachnid, Nicolas_Ollinger,2001_ollinger, Ondřej_Adamovský,2019_adamovsky, Ora_Lassila,1989_jar.2, -Oscar_Toledo_G.,2005_toledo,.,2006_toledo1,.,2006_toledo2,.,2006_toledo3,.,2011_toledo, +Oscar_Toledo_G.,2005_toledo,2006_toledo1,2006_toledo2,2006_toledo3,2011_toledo, Oskar_von_der_Luehe,1989_ovdluhe, Paul_Dale,1988_dale, Paul_E._Black,1989_paul, @@ -156,7 +156,7 @@ Raphael_Meyer,2006_meyer, Raymond_Cheong,2000_primenum,2001_cheong, Robbert_van_Renesse,1984_mullender, Robert_Heckendorn,1985_applin, -Roemer_B._Lievaart,1987_lievaart,._Lievaart,1989_roemer, +Roemer_B._Lievaart,1987_lievaart,1989_roemer, Ron_McFarland,1996_rcm, Sandro_Maffiodo,2014_maffiodo1,2014_maffiodo2, Scott_Vokes,2018_vokes, From dbd9994ca4f780fb208675c1adcf9b7d255a763a Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Fri, 26 May 2023 06:33:44 -0700 Subject: [PATCH 08/16] Reverse reversal of alt/original 2005/giljade code In other words now the version that can compile with clang is the giljade.c and the other is giljade.alt.c. The reason is that the actual award is about a 2D puzzle and this still works with the clang compilable version. It also lets those who are forced to use clang compile the code and at least enjoy the puzzle. The Makefile has been updated to remove the note about clang or rather reworded so that the user is made aware that the alt version will run the self-test but the original will not and to see the README.md for more details. --- 2005/giljade/Makefile | 4 +-- 2005/giljade/README.md | 66 ++++++++++++++++++++------------------ 2005/giljade/giljade.alt.c | 12 +++---- 2005/giljade/giljade.c | 12 +++---- bugs.md | 65 +++++++++++++++++++++---------------- 5 files changed, 85 insertions(+), 74 deletions(-) diff --git a/2005/giljade/Makefile b/2005/giljade/Makefile index d332bbeb5..1dc57c255 100644 --- a/2005/giljade/Makefile +++ b/2005/giljade/Makefile @@ -134,8 +134,8 @@ all: data ${TARGET} supernova deep_magic magic charon pluto ${PROG}: ${PROG}.c - @echo "NOTE: this version requires non-standard args to main() and will fail with" - @echo "some compilers like clang. Try make alt for such compilers." + @echo "NOTE: this version cannot successfully run the self-test. Use make alt" + @echo "for a version which will work. See README.md for why it is this way." ${CC} ${CFLAGS} $< -o $@ ${LIBS} # alternative executable diff --git a/2005/giljade/README.md b/2005/giljade/README.md index 921613861..18a3dcc6d 100644 --- a/2005/giljade/README.md +++ b/2005/giljade/README.md @@ -11,9 +11,15 @@ make ``` NOTE: if you do not have access to a compiler that lets you have alternative arg -types to `main()` you must use the alternate code. This is hopefully just a -temporary problem but it's a complicated problem as well. See 'To run' and -'Alternate code' sections as well as [bugs.md](/bugs.md) for more information. +types to `main()` the self-test feature will fail. If your compiler does not +have this defect you can use the Alternate code described below. The reason to +have it as the alternate version is that there is more to the entry that can +still be enjoyed with compilers with the `main()` args defect including the +primary purpose of the entry, a puzzle. + +Hopefully this will be resolved in time where there is no need for an alternate +version but it's a complicated one. See also the [bugs.md](/bugs.md) file for +more information. ## To run: @@ -21,23 +27,25 @@ temporary problem but it's a complicated problem as well. See 'To run' and ./giljade ``` -[Cody Boone Ferguson](/winners.html#Cody_Boone_Ferguson) fixed this for modern -systems but there was a problem with both the clang fixed version (which Landon -originally put in but Cody further fixed so that it would work somewhat) and the -original version. There remains a problem with the clang version. +After Landon fixed the entry to compile with clang (but see above and below) +[Cody Boone Ferguson](/winners.html#Cody_Boone_Ferguson) noticed this does not +work at all in modern systems. He fixed this to work but he notes that the fix +to let clang compile it breaks the self-test feature. -The problem that was showing up is that with either optimising or anything but -32-bit was used it would not work. The optimising cannot be used still but it -now works with both 32-bit and 64-bit. The solution has to do with the size -difference between `int` and `long` so that the `long *E` is now `int *E`. This -solves a specific problem for linux (32-bit, 64-bit) and macOS (arm64). +The problem that was showing up is that with either optimising or if anything +but 32-bit (as in `-m32`) was used it would not work (at least in 64-bit +systems?). The optimising cannot be used still but it now works with both 32-bit +and 64-bit. The solution has to do with the size difference between `int` and +`long` so that the `long*E` is now `int*E`. This solves a specific problem for +linux (32-bit, 64-bit) and macOS (arm64). But as noted there is another problem with clang: the self-test feature only -completely works with the original version, not the one that will compile with -clang. The alt version only passes some of its tests. If your compiler does not -have the defect that clang has about arg types to `main()` you can use -successfully run the self-test feature completely. Otherwise see the Alternate -code section below. +completely works with the original version ([giljade.alt.c](giljade.alt.c)), not +the one that will compile with clang ([giljade.c](giljade.c)). The alternate +version, which will not compile with clang, is the only one that passes the +self-tests. If your compiler does not have the defect that clang has about arg +types to `main()` see the Alternate code section below at least for the +self-test feature. Thank you Cody for your assistance! @@ -61,23 +69,11 @@ vi out Press ^F (control F) repeatedly. -### Also try: - -```sh -./giljade > out -./giljade out -``` - -NOTE: this will only completely work with the original version at least at this -time. - ### Alternate code: -This version is compilable with clang but as noted the self-test feature is -incomplete. It did not work at all but Cody added a hack to make part of it work -until this can be looked at further. See also the [bugs.md](/bugs.md) file. - -If you have clang you can use this version like: +This version will work only with compilers that let you have alternate types to +the args of `main()` and will also successfully run its self-test (the other +version only runs some of them successfully). To use: ```sh make alt @@ -85,6 +81,12 @@ make alt Use `giljade.alt` as you would `giljade` above. +#### Try: + +```sh +./giljade.alt > out +./giljade.alt out +``` ## Judges' remarks: diff --git a/2005/giljade/giljade.alt.c b/2005/giljade/giljade.alt.c index e443154a9..f56de0df7 100644 --- a/2005/giljade/giljade.alt.c +++ b/2005/giljade/giljade.alt.c @@ -10,14 +10,14 @@ \ )u=(f&p)i(m) ;s=u&E[3];I(t(m),3)s=(u)a &E[l];I(t(m\ ),l)u=u>>5-m &u;s=u&E[3-l];I(t(m),3-l) s=(u)a&*E;I\ -(t(m),(0));; /*echo/Line/%d;sed/-n/-e/ %d,%dp/%s/|sed*/ -/*-e/ 's,intUa,int/ Ua,g'>c.c;cc/c.c/-Wno-implicit-function-declaration /-c*/ -;;char*A=0,*_,*R,*Q, D[9999],*r,l[9999],T=42, M,V=32;int*E,k[9999],B[1 <<+21],*N=B+ +(t(m),(0));; /*echo/Line/%d;sed/-n/-e/ %d,%dp/%s>*/ +/*c.c;cc/c.c /-c*/;;char*A=0,*_,*R,*Q, D[9999],*r,l +[9999],T=42, M,V=32;int *E,k[9999],B[1 <<+21],*N=B+ 1234567,q=0, h=3,j=2,O,b,f,u,s,c,a,t,e ,d;C(){F(h=N [3];(B[h]&&+ memcmp(N,B+B[h],16));h=B[ h]+4);B[h]|| -(B[h]=N-B,N= N+6);}main(int Ua,char **wa){char*U -=Ua;int**w= wa;;F(_=A=D+6666,A[fread(A,1,3333,fopen -(__FILE__, "r"))]=0;*++ _;h||(*_=V)) +(B[h]=N-B,N= N+6);}main(char*U,int*w[] ){;;F(_=A=D+ +6666,A[fread (A,1,3333,fopen(__FILE__, "r"))]=0;*++ +_;h||(*_=V)) *_-59|_[1]-* _||(h&&(*_=+ 35),h---2||(_[9]=V));;F(_ =A;*_;_++)10 -*_&&*_-V&&( *_-92)&&(k[q]=isalnum(l[q ]=*_),q++);M =47;*(E=N-6) =64;E[1]=289;E[2]=270336; diff --git a/2005/giljade/giljade.c b/2005/giljade/giljade.c index 0812a45df..465ea89d7 100644 --- a/2005/giljade/giljade.c +++ b/2005/giljade/giljade.c @@ -10,14 +10,14 @@ \ )u=(f&p)i(m) ;s=u&E[3];I(t(m),3)s=(u)a &E[l];I(t(m\ ),l)u=u>>5-m &u;s=u&E[3-l];I(t(m),3-l) s=(u)a&*E;I\ -(t(m),(0));; /*echo/Line/%d;sed/-n/-e/ %d,%dp/%s>*/ -/*c.c;cc/c.c /-c*/;;char*A=0,*_,*R,*Q, D[9999],*r,l -[9999],T=42, M,V=32;int*E,k[9999],B[1 <<+21],*N=B+ +(t(m),(0));; /*echo/Line/%d;sed/-n/-e/ %d,%dp/%s/|sed*/ +/*-e/ 's,intZ,int/ Z,g'>c.c;cc/c.c/-Wno-implicit-function-declaration /-c*/ +;;char*A=0,*_,*R,*Q, D[9999],*r,l[9999],T=42, M,V=32;int *E,k[9999],B[1 <<+21],*N=B+ 1234567,q=0, h=3,j=2,O,b,f,u,s,c,a,t,e ,d;C(){F(h=N [3];(B[h]&&+ memcmp(N,B+B[h],16));h=B[ h]+4);B[h]|| -(B[h]=N-B,N= N+6);}main(char*U,int*w[] ){;;F(_=A=D+ -6666,A[fread (A,1,3333,fopen(__FILE__, "r"))]=0;*++ -_;h||(*_=V)) +(B[h]=N-B,N= N+6);}main(int Z,char*Y[] ){char*U=Z;int**w=Y; +;;F(_=A=D+6666,A[fread(A,1,3333,fopen +(__FILE__, "r"))]=0;*++ _;h||(*_=V)) *_-59|_[1]-* _||(h&&(*_=+ 35),h---2||(_[9]=V));;F(_ =A;*_;_++)10 -*_&&*_-V&&( *_-92)&&(k[q]=isalnum(l[q ]=*_),q++);M =47;*(E=N-6) =64;E[1]=289;E[2]=270336; diff --git a/bugs.md b/bugs.md index 2dc9c97dd..9bf724424 100644 --- a/bugs.md +++ b/bugs.md @@ -1581,24 +1581,24 @@ dimensions. Try `100 100 100` for instance and see what happens! ## [2005/giljade](2005/giljade/giljade.c) ([README.md](2005/giljade/README.md)) ## STATUS: known bug - please help us fix -This is currently for the [alt version](2005/giljade/giljade.alt.c) of the code: -due to clang's defect where it requires args of main() to be of a specific type -the code had to be changed. However when this happens the code no longer works -properly. [Cody Boone Ferguson](/winners.html#Cody_Boone_Ferguson) fixed the -entry to work itself but Landon made the original alt version. This also however -did not work due to some other issues that had to be worked out. +The alternate code will not compile with compilers that do not let you have +alternate types of the args to `main()`. An example compiler with this defect is +`clang`. If you have `gcc` you can use `make alt` and there is no problem. -First the optimisation had to be disabled. Second is that for this to do -anything (except perhaps crash .. I (Cody) cannot recall now exactly) in 64-bit -systems (and also 32-bit compilation via `-m32`) the `long*E` had to be changed -to `int*E`. These changes let it work properly for compilers that do not have -the defect described above but then there is clang. +The reason the clang fixed (but see below) version is [giljade.c](giljade.c) is +that the primary purpose of the entry is a 2D puzzle and this works with the +clang fix, more or less (if not entirely hard to know with the many layouts it +generates). The problem is that with the clang fix the self-test version does +not work for every layout. The author even notes that modifying the code will +cause this but it has to be changed to let clang compile it due to clang's +defect. -At first we had the clang fix be the [giljade.c](2005/giljade/giljade.c) file -but since it does not fully work we for now have swapped the alt and the -original until such a time that it can be fixed for clang too. The below -describes the problem with the alt version, that which will only partially work -with clang. +Now [Cody Boone Ferguson](/winners.html#Cody_Boone_Ferguson) fixed this to work +in both the clang version (which Landon added) and the original version +([giljade.alt.c](giljade.alt.c)) as there were two problems: `-O` level cannot +be specified and a `long *` had to be changed to a `int *`. + +### The actual problem One is supposed to be able to do: @@ -1610,9 +1610,16 @@ One is supposed to be able to do: and see all layouts compile without error. If you wish to see this in action and you have a compiler without the defect of clang you can do: +```sh +make alt +./giljade.alt > out +./giljade.alt out +``` + +But if you try this with `giljade` you will run into compilation errors, +seemingly different across different compilers. In macOS it's clang but in linux +it's probably gcc (the entry uses `cc`). -But if you try this with the alt code we run into some problems depending on -what `cc` is in the system. In macOS it's clang but in linux it's probably gcc. Since macOS is clang the below shows what happens with macOS after some of the generated files are compiled successfully: @@ -1625,7 +1632,7 @@ c.c:76:72: error: expected expression ^ c.c:76:72: error: expected '}' c.c:50:72: note: to match this '{' -N,B+B[h],16));h=B [h]+4);B[h]||(B[h ]=N-B,N=N+6);}main(int Ua,char**wa){ +(N,B+B[h],16));h= B[h]+4);B[h]||(B[ h]=N-B,N=N+6);}main(int Z,char*Y[]){ ^ ``` @@ -1642,12 +1649,12 @@ a look at the comment in the code: ```c /*echo/Line/%d;sed/-n/-e/ %d,%dp/%s/|sed*/ -/*-e/ 's,intUa,int/ Ua,g'>c.c;cc/c.c/-Wno-implicit-function-declaration /-c*/ - +/*-e/ 's,intZ,int/ Z,g'>c.c;cc/c.c/-Wno-implicit-function-declaration /-c*/ ``` That is actually called via `system()`. But if you observe in -[giljade.c](2005/giljade/giljade.c) the comment is quite different being just: +[giljade.alt.c](2005/giljade/giljade.alt.c) the comment is quite different being +just: ```c @@ -1659,8 +1666,8 @@ Why? Because in some platforms at least clang defaults to `-Werror` for some warnings: that's why the disabling of the warning in particular. But the change to make it compile with clang changed the output generated to merge the `int` and the arg in `main()` which is of course a big problem. Thus the additional -`sed` command fixes this problem but somewhere in the process some of the -generated code fails. +`sed` command fixes the problem of `int` and `Z` becoming one word but somewhere +in the process some of the generated code fails. What might the translation of the comment end up being? Here's an example: @@ -1677,23 +1684,25 @@ for the program (compiled as 64-bit) to output anything at all the variable `E` must be an `int *` not a `long *`. However the change that allows clang to compile it causes the output to not have spaces where necessary to successfully compile the generated output which is why the extra `sed` command shown above -(which has a special way to input spaces). But it can show up in other ways too. +(which has a special way to input spaces). We do not know if the change from +`long *` to `int *` also messes up the output but we suspect not because it +works for gcc. Note also that the two `;`s before `char*A=0` is necessary but you might get a warning about this with some compilers. If it's removed you'll see something like: ```sh -sh: -c: line 0: ` echo Line 2;sed -n -e 2,77p out> c.c;cc c.c -Wno-implicit-function-declaration -c ;char A=0, _, R, Q,D[9999], r,l[9999],T=42,M,V=32;int E,k[9999],B[1<<+21], N=B+1234567,q=0,h=3,j=2,O,b,f,u,s,c,a,t,e,d;C(){F(h=N[3];(B[h]&&+memcmp(N,B+B[h],16));h=B[h]+4);B[h]||(B[h]=N-B,N=N+6);}intmain(intUa,char wa){char U=Ua;int w=wa' +sh: -c: line 0: syntax error near unexpected token `{F' +sh: -c: line 0: ` echo Line 2;sed -n -e 2,77p out |sed -e 's,intZ,int Z,g'>c.c;cc c.c -Wno-implicit-function-declaration -c ;char A=0, _, R, Q,D[9999], r,l[9999],T=42,M,V=32;int E,k[9999],B[1<<+21], N=B+1234567,q=0,h=3,j=2,O,b,f,u,s,c,a,t,e,d;C(){F(h=N[3];(B[h]&&+memcmp(N,B+B[h],16));h=B[h]+4);B[h]||(B[h]=N-B,N=N+6);}main(intZ,char Y[]){char U=Z;int w=Y;' ``` or so, depending on the comment, when running the program on its output. Observe too that the `*` part of pointers have been removed! You also see the -merge of `int` and `Ua` as noted earlier. With the two `;`s this is not a +merge of `int` and `Z` as noted earlier. With the two `;`s this is not a problem. - Cody will look at this all later on. ## STATUS: INABIAF - please **DO NOT** fix From 864cc7bffb1ca6432d6156cb7ca2a85448540987 Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Fri, 26 May 2023 11:46:48 -0700 Subject: [PATCH 09/16] Format fixes + add links in 2015/endoh1 There is more to be done here but that's for another time (I thought I could do it relatively quickly but looking at it further I see that's not the case and I have limited time so I'm doing it in multiple commits - I want the changes out of the way). --- 2015/endoh1/README.md | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/2015/endoh1/README.md b/2015/endoh1/README.md index 6a0f88f06..3de62b390 100644 --- a/2015/endoh1/README.md +++ b/2015/endoh1/README.md @@ -20,10 +20,6 @@ make Connect to port http://localhost:10333 with your browser. -The author said he had no recent version of macOS to test to see if this works -but in 2023 [Cody Boone Ferguson](/winners.html#Cody_Boone_Ferguson) did this -and reported that it works well. He also said he really loved it! Thank you -Cody! ## Try: @@ -41,8 +37,12 @@ find any other tributes? ## Author's remarks: -What does "Alan Turing" remind you of? Cryptanalysis of the Enigma? Turing -machine? Turing test? This program is also based on his work. +What does "[Alan Turing](https://en.wikipedia.org/wiki/Alan_Turing)" remind you +of? [Cryptanalysis](https://en.wikipedia.org/wiki/Cryptanalysis) of the [Enigma +machine](https://en.wikipedia.org/wiki/Enigma_machine)? [Turing +machine](https://en.wikipedia.org/wiki/Turing_machine)? [Turing +test](https://en.wikipedia.org/wiki/Turing_test)? This program is also based on +his work. ### Whirlwind tour @@ -58,20 +58,24 @@ cc -O3 -std=c99 \ -DTIMESTEP=1.0 -DSPEED=2 -DRGB=255:128:192 ``` -Then, run it under `tcpserver` command in +Then, run it under `tcpserver` command in the [ucspi-tcp](http://cr.yp.to/ucspi-tcp.html) package, which was created by [Daniel J. Bernstein](/winners.html#Daniel_J._Bernstein), [IOCCC 1991 "Best of Show"](../../1991/brnstnd/brnstnd.c) ([README.md](../../1991/brnstnd/README.md)). - $ tcpserver -v 127.0.0.1 10333 ./prog ioccc.txt +```sh +tcpserver -v 127.0.0.1 10333 ./prog ioccc.txt +``` Finally, open `http://127.0.0.1:10333/` by a modern browser supporting HTML5. -You can use the mouse cursor to place drops into the Petri dish interactively. +You can use the mouse cursor to place drops into the [Petri +dish](https://en.wikipedia.org/wiki/Petri_dish) interactively. ### Description -This is a simulator of *reaction-diffusion systems*. +This is a simulator of [reaction-diffusion +systems](https://en.wikipedia.org/wiki/Reaction-diffusion_system). Reaction-diffusion systems, proposed by Alan Turing in [1], are mathematical models in which two chemical substances are transformed into each other (*local From ac949a735db3694805145820efffb06c7e57469a Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Sat, 27 May 2023 04:30:19 -0700 Subject: [PATCH 10/16] Fix 1988/litmaath/README.md + add alt code There was no 'To build' or 'To run' section. The alt code is that which the judges suggested to try and understand the code a bit more. As it was fun output and it seems instructive I decided to add it as an alt version. Updated .gitignore. --- 1988/litmaath/.gitignore | 1 + 1988/litmaath/Makefile | 4 ++-- 1988/litmaath/README.md | 32 ++++++++++++++++++++++++++++---- 1988/litmaath/litmaath.alt.c | 16 ++++++++++++++++ 4 files changed, 47 insertions(+), 6 deletions(-) create mode 100644 1988/litmaath/litmaath.alt.c diff --git a/1988/litmaath/.gitignore b/1988/litmaath/.gitignore index 5722bebf5..ef2cc4b0f 100644 --- a/1988/litmaath/.gitignore +++ b/1988/litmaath/.gitignore @@ -1 +1,2 @@ litmaath +litmaath.alt diff --git a/1988/litmaath/Makefile b/1988/litmaath/Makefile index 08b070b99..370e7cbc0 100644 --- a/1988/litmaath/Makefile +++ b/1988/litmaath/Makefile @@ -111,8 +111,8 @@ OBJ= ${PROG}.o DATA= TARGET= ${PROG} # -ALT_OBJ= -ALT_TARGET= +ALT_OBJ= ${PROG}.alt.o +ALT_TARGET= ${PROG}.alt ################# diff --git a/1988/litmaath/README.md b/1988/litmaath/README.md index e776052d5..0e801e4ca 100644 --- a/1988/litmaath/README.md +++ b/1988/litmaath/README.md @@ -1,18 +1,42 @@ # Best small program Maarten Litmaath -Free University (VU) Amsterdam -Department of computer science -Uilenstede 72 -1183 AK Amstelveen The Netherlands +## To build: + +```sh +make +``` + +## To run: + +```sh +./litmaath some text +``` + +There is an alternate version provided. See the Alternate code section below. + ## Try: ```sh ./litmaath eschew obfuscation ``` +### Alternate code: + +[Cody Boone Ferguson](/winners.html#Cody_Boone_Ferguson) added the +[litmaath.alt.c](litmaath.alt.c) which we described in our remarks below. To +use: + +```sh +make alt +``` + +Use `litmaath.alt` as you would `litmaath` above. + +Thank you Cody! + ## Judges' remarks: diff --git a/1988/litmaath/litmaath.alt.c b/1988/litmaath/litmaath.alt.c new file mode 100644 index 000000000..a08e45ea2 --- /dev/null +++ b/1988/litmaath/litmaath.alt.c @@ -0,0 +1,16 @@ +#include +main(argc, argv) +int argc; +char **argv; +{ + while (*argv != argv[1] && (*argv = argv[1]) && (argc = 0) || (*++argv + && (**argv && ((++argc)[*argv] && (**argv <= argc[*argv] || + (**argv += argc[*argv] -= **argv = argc[*argv] - **argv)) && + --argv || putchar(**argv) && ++*argv--) || putchar(10)))) + fprintf(stderr, + "argv=%lo *argv=%lo **argv=%c argv[1]=%lo *argv[1]=%c argc=%d\n", + (long) argv, (long) *argv, *argv && **argv ? **argv : '@', + (long) argv[1], argv[1] && *argv[1] ? *argv[1] : '@', argc); + + ; +} From a736acb77572b61d1f54a8b91f30046d5bfa4127 Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Sat, 27 May 2023 04:46:15 -0700 Subject: [PATCH 11/16] More twitter deprecation - 2019/mills In the README.md in the judges' remarks there was a link not to twitter.com but an archive of a certain person's tweet. However this link is dead and I don't think it is worth using the Internet Wayback Machine in this case due to if nothing else major divisiveness for the US and the world full stop. The name is still there but no link. I'm not even sure about that. Perhaps since twitter is entirely deprecated it should be removed entirely but I don't know. --- 2019/mills/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/2019/mills/README.md b/2019/mills/README.md index c64e98f7f..f2a3ce3d7 100644 --- a/2019/mills/README.md +++ b/2019/mills/README.md @@ -42,7 +42,7 @@ Can a machine learn? Some say so. But can a machine learn to write like Shakespeare, -or tweet like [Trump](http://trumptwitterarchive.com)? +or tweet like Trump? Can it write rules and guidelines for the IOCCC? From 6b608807261c595627ac7b8bb7bac3d4dfd0d2b0 Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Sat, 27 May 2023 05:35:13 -0700 Subject: [PATCH 12/16] Finish twitter deprecation of 2019/mills --- 2019/mills/README.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/2019/mills/README.md b/2019/mills/README.md index f2a3ce3d7..2fc73489d 100644 --- a/2019/mills/README.md +++ b/2019/mills/README.md @@ -41,10 +41,8 @@ Can a machine learn? Some say so. -But can a machine learn to write like Shakespeare, -or tweet like Trump? - -Can it write rules and guidelines for the IOCCC? +But can a machine learn to write like Shakespeare? Can it write rules and +guidelines for the IOCCC? You decide. :-) From ad268013808c81ad43543474d02581e47a9e17fb Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Sat, 27 May 2023 05:39:59 -0700 Subject: [PATCH 13/16] Slight format update to 2005/giljade --- 2005/giljade/giljade.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/2005/giljade/giljade.c b/2005/giljade/giljade.c index 465ea89d7..c1ea23491 100644 --- a/2005/giljade/giljade.c +++ b/2005/giljade/giljade.c @@ -11,12 +11,12 @@ )u=(f&p)i(m) ;s=u&E[3];I(t(m),3)s=(u)a &E[l];I(t(m\ ),l)u=u>>5-m &u;s=u&E[3-l];I(t(m),3-l) s=(u)a&*E;I\ (t(m),(0));; /*echo/Line/%d;sed/-n/-e/ %d,%dp/%s/|sed*/ -/*-e/ 's,intZ,int/ Z,g'>c.c;cc/c.c/-Wno-implicit-function-declaration /-c*/ +/*-e/'s,intZ,int/ Z,g'>c.c;cc/c.c/-Wno-implicit-function-declaration /-c*/ ;;char*A=0,*_,*R,*Q, D[9999],*r,l[9999],T=42, M,V=32;int *E,k[9999],B[1 <<+21],*N=B+ 1234567,q=0, h=3,j=2,O,b,f,u,s,c,a,t,e ,d;C(){F(h=N [3];(B[h]&&+ memcmp(N,B+B[h],16));h=B[ h]+4);B[h]|| -(B[h]=N-B,N= N+6);}main(int Z,char*Y[] ){char*U=Z;int**w=Y; -;;F(_=A=D+6666,A[fread(A,1,3333,fopen +(B[h]=N-B,N= N+6);}main(int Z,char**Y ){char*U=Z ; +int**w=Y; ;;F(_=A=D+6666,A[fread(A,1,3333,fopen (__FILE__, "r"))]=0;*++ _;h||(*_=V)) *_-59|_[1]-* _||(h&&(*_=+ 35),h---2||(_[9]=V));;F(_ =A;*_;_++)10 -*_&&*_-V&&( *_-92)&&(k[q]=isalnum(l[q From f757f66b991d6bd81fc803521d8a928c736e1b15 Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Sat, 27 May 2023 06:36:32 -0700 Subject: [PATCH 14/16] Add alt code for 2001/kev - arrow key support Since arrow keys can be more natural than other keys like the program's ',' and '.' for movement I added a version which lets you use arrow keys instead. One player could use the ',' and the other '.' or both can play with the same, whichever they pick. I also slowed down the speed of the ball as it moved very fast considering the slow speed the paddle moves. The README.md shows how to reset it or change the value via make. Updated .gitignore. --- 2001/kev/.gitignore | 1 + 2001/kev/Makefile | 9 ++-- 2001/kev/README.md | 70 +++++++++++++++++-------- 2001/kev/kev.alt.c | 122 ++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 179 insertions(+), 23 deletions(-) create mode 100644 2001/kev/kev.alt.c diff --git a/2001/kev/.gitignore b/2001/kev/.gitignore index 961ec1d0c..1fa9f0a7b 100644 --- a/2001/kev/.gitignore +++ b/2001/kev/.gitignore @@ -1 +1,2 @@ kev +kev.alt diff --git a/2001/kev/Makefile b/2001/kev/Makefile index 9ef43bc04..c1d5aac15 100644 --- a/2001/kev/Makefile +++ b/2001/kev/Makefile @@ -59,7 +59,7 @@ ARCH= # Defines that are needed to compile # -CDEFINE= -DPORT=5455 -DSPEED=50 -Dl_="socket(il.sin_family=AF_INET,SOCK_STREAM,0)" +CDEFINE= -DPORT=5455 -DSPEED=100 -Dl_="socket(il.sin_family=AF_INET,SOCK_STREAM,0)" # Include files that are needed to compile # @@ -115,8 +115,8 @@ OBJ= ${PROG}.o DATA= TARGET= ${PROG} # -ALT_OBJ= -ALT_TARGET= +ALT_OBJ= ${PROG}.alt.o +ALT_TARGET= ${PROG}.alt ################# @@ -138,6 +138,9 @@ ${PROG}: ${PROG}.c alt: data ${ALT_TARGET} @${TRUE} +${PROG}.alt: ${PROG}.alt.c + ${CC} ${CFLAGS} $< -o $@ ${LIBS} + # data files # data: ${DATA} diff --git a/2001/kev/README.md b/2001/kev/README.md index 3e95bab9c..6ebb48f2d 100644 --- a/2001/kev/README.md +++ b/2001/kev/README.md @@ -1,11 +1,8 @@ # Best Curses Game -Kevin Pulo -School of Information Technologies -Madsen Building F09 -University of Sydney, NSW, 2006 -Australia - +Kevin Pulo
+Australia
+
Mastodon: ## To build: @@ -17,15 +14,49 @@ make ## To run: ```sh -./kev hostname +./kev # in one terminal + +./kev hostname # in another terminal ``` +NOTE: each player's paddle is at the bottom and the opponent at the top. + +[Cody Boone Ferguson](/winners.html#Cody_Boone_Ferguson) slowed down the ball +just a tad as it went too fast for the speed at which the paddles move even when +holding down the movement keys. If you need to change the speed you can +reconfigure it like (say for over a network and not the same host): + +```sh +make clobber SPEED=50 all # default value which is very fast +``` + +There is an alternate version which lets you use the arrow keys to control your +paddle. See below Alternate code. + ## Try: ```sh +./kev ./kev localhost ``` +### Alternate code: + +[Cody Boone Ferguson](/winners.html#Cody_Boone_Ferguson) provided an alternate +version which lets you use the arrow keys on your keyboard instead of the more +awkward ',' and '.'. To use: + +```sh +make alt +``` + +Use `kev.alt` as you would `kev`. + +What happens if you use both, one in one terminal and the other in another +terminal? + +Thank you Cody! + ## Judges' remarks: Continuing with this year's "retro game" theme, this is another old game; @@ -45,7 +76,7 @@ box. * TCP sockets * curses -* usleep +* `usleep()` ### DESCRIPTION @@ -117,18 +148,17 @@ terminal size). ### BUILDING -Just run `make`to use the Makefile as above. The `SPEED` variable in the Makefile -controls the speed of the game (defaults to `50`). This speed is -the delay between frames in milliseconds. Thus a value of 0 will -make the game go as fast as your network can handle, and values -less than 50 are useful for larger terminals or more exciting -games. The program needs bandwidth equal to 1/s bytes per second -(where `s` is the speed value). Any latency on the network will -be added to `s` - so you should probably subtract any latency from -the value of `s` you want to have. Given that `loopback` and fast -Ethernet LANs are both much less than 1ms of latency, you should -only need to worry about this if you plan on playing over a slower -link like a cable modem, DSL, or (God-forbid) dial-up. +Just run `make`to use the Makefile as above. The `SPEED` variable in the +Makefile controls the speed of the game (defaults to `50`). This speed is the +delay between frames in milliseconds. Thus a value of 0 will make the game go +as fast as your network can handle, and values less than 50 are useful for +larger terminals or more exciting games. The program needs bandwidth equal to +1/s bytes per second (where `s` is the speed value). Any latency on the network +will be added to `s` - so you should probably subtract any latency from the +value of `s` you want to have. Given that `loopback` and fast Ethernet LANs are +both much less than 1ms of latency, you should only need to worry about this if +you plan on playing over a slower link like a cable modem, DSL, or (God-forbid) +dial-up. The TCP port to use for network communications is specified by the `PORT` variable in the Makefile. If the default of `5455` is diff --git a/2001/kev/kev.alt.c b/2001/kev/kev.alt.c new file mode 100644 index 000000000..fc2ce1300 --- /dev/null +++ b/2001/kev/kev.alt.c @@ -0,0 +1,122 @@ +#include +#include +#include +#include +#include +#include + +#define o0(M,W) mvprintw(W,M?M-1:M,"%s%s ",M?" ":"",_) +#define O0(M,W) M##M=(M+=W##M)-W##M +#define l1(M,W) M.tv_##W##sec +#define L1(m,M,l,L,o,O) for(L=l;L--;)((char*)(m))[o]=((char*)(M))[O] +#define I1 lL,(struct sockaddr*)&il +#define i1 COLS +#define j LINES +#define L_ ((j%2)?j:j-1) + +fd_set I;struct socka\ +ddr_in il;struct host\ +ent*LI; struct timeval +IL,l;char L[9],_[1<<9] + ;void ___(int __ + ){_[__--]=+0;if( + ++__)___(--__);_ + [__]='=';}double + o,oo=+0,Oo=+0.2; + long O,OO=0,oO=1 + ,ii,iI,Ii,Ll,lL, + II=sizeof(il),Il + ,ll,LL=0,i=0,li, + lI;int main(int\ + iL,char *Li[]){\ + initscr();keypad + (stdscr,1);cbreak + ();noecho();nonl + ();___(lI=i1/4); + _[0]='[';_[lI-1] + =']';L1(&il,&_,\ + II,O,+O,+lI);il. + sin_port=htons(( + unsigned long)(\ + PORT&0xffff));lL + =l_;if(iL=!--iL) + {il. sin_addr .\ + s_addr=0;bind(I1 + ,II);listen(lL,5 + );lL=accept(I1,& + II);}else{oO-=2; + LI=gethostbyname + (Li[1]);L1(&(il. + sin_addr),(*LI). + h_addr_list[0],\ + LI->h_length,iI, + iI,iI);(*(&il)). + sin_family=(&(*\ + LI))->h_addrtype + ;connect(I1,II); + }ii=Ii=(o=i1*0.5 + )-lI/2;iI=L_-1;O + =li=L_*0.5;while + (_){mvaddch(+OO, + oo,' ');o0(ii,iI + );o0(Ii,Il-=Il); + mvprintw(li-1,Il + ,"%d\n\n%d",i,LL + );mvhline(li,+0, + '-',i1);mvaddch( + O,o,'*');move(li + ,Il);refresh();\ + timeout(+SPEED); + gettimeofday(&IL + ,+0);Ll=getch(); + timeout(0);while + (getch()!=ERR);\ + if(Ll=='q'&&iL)\ + write(lL,_+1,1); + if(ii>(ll=0)&&Ll + ==KEY_LEFT){write(lL, + _,-(--Il));}else + if(Ll==KEY_RIGHT&&ii+\ + lIi1){o=i1+i1-o + ;Oo*=-1;}if(o>=( + Ii+=ll)&&O<1&&oO + <0&&o= + (ii+=Il)&&O>iI-1 +&&oO>0&&o+iI){O-=O;i++; +}}endwin();return(0);} + From d933868b9ba0cac3fbd76047fa3c590197202c10 Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Sat, 27 May 2023 06:46:47 -0700 Subject: [PATCH 15/16] Reorder SDL info in 2005/jetro/README.md I believe it flows a bit more naturally now. --- 2005/jetro/README.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/2005/jetro/README.md b/2005/jetro/README.md index 085360b1c..b275080e5 100644 --- a/2005/jetro/README.md +++ b/2005/jetro/README.md @@ -8,12 +8,15 @@ Finland This entry requires SDL to be installed. +See the [faq](/faq.md) for information on how to install it if you haven't +already. + +If you have SDL installed: + ```sh make ``` -See the [faq](/faq.md) for information on how to install it if you haven't -already. ## To run: From 7521206b2945ef26ba1eb3d86f7e0d3fc4f92085 Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Sun, 28 May 2023 12:33:53 -0700 Subject: [PATCH 16/16] Change infinite loop bug status in 1990/theorem If one passes to the Fibonacci or theorem_bkp program 0 0 it enters an infinite loop repeatedly printing 0. I think this is better to be just documented and not fixed. Another condition where this occurred was fixed but as I recall that might have affected usability and this one in any event does not. --- 1990/theorem/.gitignore | 1 + 1990/theorem/README.md | 25 +++++++++++++++-------- bugs.md | 45 +++++------------------------------------ 3 files changed, 23 insertions(+), 48 deletions(-) diff --git a/1990/theorem/.gitignore b/1990/theorem/.gitignore index 12683bf7d..a9223bbb1 100644 --- a/1990/theorem/.gitignore +++ b/1990/theorem/.gitignore @@ -1,3 +1,4 @@ +theorem fibonacci fibonacci.c mariano diff --git a/1990/theorem/README.md b/1990/theorem/README.md index 4b6d753dc..ca82b074c 100644 --- a/1990/theorem/README.md +++ b/1990/theorem/README.md @@ -29,7 +29,7 @@ about `gets()` at linking or runtime. Thank you Cody for your assistance! [Yusuke Endoh](/winners.html#Yusuke_Endoh) pointed out that `atof` nowadays needs `#include ` which was used in order to get this to work -initially. Thank you Yusuke! +initially (prior to this the output was incomplete). Thank you Yusuke! ## To run: @@ -54,20 +54,29 @@ y1 - initial value (y(x1) == y1) ./theorem y 0 1 0.1 1 ``` -### Known bug with `fibonacci.c` and `theorem_bkp.c`: +### INABIAF - it's not a bug it's a feature! :-) -If the two args added up equals 0 the program will enter an infinite loop, -printing 0 over and over again. Cody fixed another condition where this happens -but this has not been fixed. See [bugs.md](/bugs.md) for more details. +If the two args passed to `fibonacci` and `theorem_bkp` equals 0 it will +print 0 over and over again in an infinite loop. In this case it should not be +fixed (another condition where this occurred was fixed as it affected usability +of the program). + +BTW: why can't the fix: + +```c +if (a[1]==NULL||a[2]==NULL||a[3]==NULL||a[4]==NULL||a[5]==NULL) return 1; +``` + +be changed to just test the value of `A` when `a` is argv and `A` is argc? ## Judges' remarks: The program's source implements four functions, all from the same source file! -When you compile theorem.c as is and run with 5 args, it numerically -solves the equation `y'=f(x,y)`, with a step size of `h`, over the interval -`x=[x1,x2]`, with the initial condition of `y(x1)=y1`. +When you compile theorem.c as is and run with 5 args, it numerically solves the +equation `y'=f(x,y)`, with a step size of `h` (see above usage), over the +interval `x=[x1,x2]`, with the initial condition of `y(x1)=y1`. The 'expression' `f(x,y)` is any function of `x` and `y` with the operators: diff --git a/bugs.md b/bugs.md index 9bf724424..a84117db6 100644 --- a/bugs.md +++ b/bugs.md @@ -596,48 +596,13 @@ so it should stay with this note. ## [1990/theorem](1990/theorem/theorem.c) ([README.md](1990/theorem/README.md)) -## STATUS: known bug - please help us fix +## STATUS: INABIAF - please **DO NOT** fix [Cody Boone Ferguson](/winners.html#Cody_Boone_Ferguson) fixed many bugs that -prevented this from working properly (including segfaults) but one bug known to -exist remains: if `theorem_bkp` or `fibonacci` is passed two zeros the program -will enter an infinite loop, printing 0 over and over again (another condition -where this occurred was fixed). - -Cody provides some hints here: - -0. The function in `theorem.c` that matters is `w` (see below for definition). -1. However adding checks for the value being > 0 does not work due to the way the -code is generated. See below. - -`w()` looks like this: - -```c -w(g,R,u)float*g,u;char R; -/**/{int b,f;if(A>2){A=atoi(a[1]);b=atoi(a[2]);while((f=A+b)<15000){printf("%d\n",f);A=b;b=f;}}} -``` - -But as far as point 1 above changing it to be: - -```c -/**/{int b,f;if(A>2){A=atoi(a[1]);b=atoi(a[2]);while(f!=0&&(f=A+b)<15000){printf("%d\n",f);A=b;b=f;}}} -``` - -and similar (like checking `>0`, doing a `do..while`, doing an `if` before the -while etc.) cause compilation errors. - -Can you fix this? We welcome your help! - -BTW: one of the important fixes for `fibonacci` to work is: - -```diff --/**/{int b,f;A=atoi(++a);b=atoi(++a);while((f=A+b)<15000){printf("%d\n",f);A=b;b=f;}} -+/**/{int b,f;if(A>2){A=atoi(a[1]);b=atoi(a[2]);while((f=A+b)<15000){printf("%d\n",f);A=b;b=f;}}} -``` - -Observe the check for the number of args and the calls to `atoi()` have been -changed a bit too. - +prevented this from working properly (including segfaults) but one thing to note +is that if you pass two zeroes to `theorem_bkp` or `fibonacci` the program +will enter an infinite loop, printing 0 over and over again; another condition +where this occurred was fixed but this one should not be fixed. Thank you. ## [1990/westley](1990/westley/westley.c) ([README.md](1990/westley/README.md)) ## STATUS: INABIAF - please **DO NOT** fix