diff --git a/2015/endoh3/.gitignore b/2015/endoh3/.gitignore index 485608bc9..08806b903 100644 --- a/2015/endoh3/.gitignore +++ b/2015/endoh3/.gitignore @@ -4,3 +4,6 @@ koch pi quine prog.orig +fun +fun.tar.gz +bf2pdp11 diff --git a/2015/endoh3/Makefile b/2015/endoh3/Makefile index adece3b25..79bf059a2 100644 --- a/2015/endoh3/Makefile +++ b/2015/endoh3/Makefile @@ -111,7 +111,7 @@ PROG= prog # OBJ= ${PROG}.o DATA= -TARGET= ${PROG} +TARGET= ${PROG} fun bf2pdp11 # ALT_OBJ= ALT_TARGET= @@ -133,6 +133,12 @@ all: data ${TARGET} ${PROG}: ${PROG}.c ${CC} ${CFLAGS} $< -o $@ ${LDFLAGS} ${BACK_TO} +fun: fun.c + ${CC} ${CFLAGS} $< -o $@ ${LDFLAGS} ${PROG}.c + +bf2pdp11: bf2pdp11.c + ${CC} ${CFLAGS} $< -o $@ ${LDFLAGS} ${PROG}.c + # alternative executable # alt: data ${ALT_TARGET} diff --git a/2015/endoh3/README.md b/2015/endoh3/README.md index 944548ed2..aeddc585e 100644 --- a/2015/endoh3/README.md +++ b/2015/endoh3/README.md @@ -49,7 +49,6 @@ q Observe what happens when you hit enter or another character! Send EOF to end the program. - ## Judges' remarks: Like Marty and Doc, something nostalgic from 1984 appears live in October of @@ -61,6 +60,16 @@ A question for inquisitive readers: is the implemented subset of PDP-11 instructions Turing-complete? (For a clue, see the end of the author's remarks.) If in doubt, use [APOUT](https://github.com/DoctorWkt/Apout). +The author provided under the section 'One more thing' a program that when +compiled with this entry will generate a gzipped tarball which we have added as +[fun.c](fun.c), built by default through `make all`. To use try: + +```sh +./fun > fun.tar.gz +``` + +for some fun :-) but we also added the tarball [fun.tar.gz](fun.tar.gz). + ## Author's remarks: @@ -123,7 +132,7 @@ register). ### One more thing -Note: the program writes a binary to stdout. +Note: the program writes a gzipped tarball to stdout. short main[]={5568,1,-30460,12,2782,0,-29921,2056,-4864,6873,770,30054,11886, 24948,114,21716,-28851,14043,-8944,32691,-16187,-12247,22692,-9781,-20403, diff --git a/2015/endoh3/bf2pdp11.c b/2015/endoh3/bf2pdp11.c new file mode 100644 index 000000000..bc39f7957 --- /dev/null +++ b/2015/endoh3/bf2pdp11.c @@ -0,0 +1,76 @@ +#include + +int main() { + unsigned short n, mem[32768], *p; + unsigned short *stack[256], **sp = stack, **sp2; + char c; + + sp = stack; + p = mem; + *p++ = 0000401; p++; /* BR 1; DAT */ + *p++ = 0012700; *p++ = 1; /* MOV #1,R0 */ + *p++ = 0012701; *p++ = 0177777; /* MOV #-1,R1 */ + + for(; (c = getchar()) >= 0; ) { + switch (c) { + case '>': + *p++ = 0005741; /* TST -(R1) */ + break; + + case '<': + *p++ = 0005721; /* TST (R1)+ */ + break; + + case '+': + *p++ = 0011102; /* MOV (R1),R2 */ + *p++ = 0005722; /* TST (R2)+ */ + *p++ = 0077200; /* SOB R2,0 */ + *p++ = 0010211; /* MOV R2,(R1) */ + break; + + case '-': + *p++ = 0011102; /* MOV (R1),R2 */ + *p++ = 0077200; /* SOB R2,0 */ + *p++ = 0010211; /* MOV R2,(R1) */ + break; + + case '[': + *sp++ = p; + *p++ = 0011102; /* MOV (R1),R2 */ + *p++ = 0005722; /* TST (R2)+ */ + *p++ = 0077200; /* SOB R2,0 */ + *p++ = 0000401; /* BR 1 */ + *p++ = 0000403; /* BR 3 */ + *p++ = 0077202; /* SOB R2,-2 */ + *p++ = 0011707; /* MOV ???,R7 (need backpatch) */ + *sp++ = p++; + break; + + case ']': + sp -= 2; + *p++ = 0011707; /* MOV ???,R7 */ + *p++ = (*sp - mem) * 2; + *sp[1] = (p - mem) * 2; + break; + + case '.': + n = (p - mem) * 2 + 8; + *p++ = 0012702; *p++= 2; /* MOV #2,R2 */ + *p++ = 0011112; /* MOV (R1),(R2) */ + *p++ = 0104404; *p++ = 2; *p++ = 1; /* call write() */ + break; + + case ',': + fputs("instruction , (getchar) is not supported\n", stderr); + return 1; + } + } + + printf("short main[32768] = { "); + for (n = 0; mem + n < p - 1; n++) { + printf("%d, ", mem[n]); + } + printf("%d };\n", mem[n]); + + return 0; +} diff --git a/2015/endoh3/fib.b b/2015/endoh3/fib.b new file mode 100644 index 000000000..85bdace18 --- /dev/null +++ b/2015/endoh3/fib.b @@ -0,0 +1,9 @@ +>++++++++++>+>+[ + [+++++[>++++++++<-]>.<++++++[>--------<-]+<<<]>.>>[ + [-]<[>+<-]>>[<<+>+>-]<[>+<-[>+<-[>+<-[>+<-[>+<-[>+<- + [>+<-[>+<-[>+<-[>[-]>+>+<<<-[>+<-]]]]]]]]]]]+>>> + ]<<< +] +This program doesn't terminate; you will have to kill it. +Daniel B Cristofani (cristofdathevanetdotcom) +http://www.hevanet.com/cristofd/brainfuck/ diff --git a/2015/endoh3/fizzbuzz.b b/2015/endoh3/fizzbuzz.b new file mode 100644 index 000000000..1de7e7413 --- /dev/null +++ b/2015/endoh3/fizzbuzz.b @@ -0,0 +1,11 @@ +++++++++++[>++++++++++<-]>>++++++++++>->>>>>>>>>>>>>>>>-->+++++++[->++ +++++++++<]>[->+>+>+>+<<<<]+++>>+++>>>++++++++[-<++++<++++<++++>>>]++++ ++[-<++++<++++>>]>>-->++++++[->+++++++++++<]>[->+>+>+>+<<<<]+++++>>+>++ +++++>++++++>++++++++[-<++++<++++<++++>>>]++++++[-<+++<+++<+++>>>]>>--> +---+[-<+]-<[+[->+]-<<->>>+>[-]++[-->++]-->+++[---++[--<++]---->>-<+>[+ ++++[----<++++]--[>]++[-->++]--<]>++[--+[-<+]->>[-]+++++[---->++++]-->[ +->+<]>>[.>]++[-->++]]-->+++]---+[-<+]->>-[+>>>+[-<+]->>>++++++++++<<[- +>+>-[>+>>]>[+[-<+>]>+>>]<<<<<<]>>[-]>>>++++++++++<[->-[>+>>]>[+[-<+>]> ++>>]<<<<<]>[-]>>[>++++++[-<++++++++>]<.<<+>+>[-]]<[<[->-<]++++++[->+++ ++++++<]>.[-]]<<++++++[-<++++++++>]<.[-]<<[-<+>]+[-<+]->>]+[-]<<<.>>>+[ +-<+]-<<] diff --git a/2015/endoh3/fun.c b/2015/endoh3/fun.c new file mode 100644 index 000000000..f3d5ee6e2 --- /dev/null +++ b/2015/endoh3/fun.c @@ -0,0 +1,116 @@ + + short main[]={5568,1,-30460,12,2782,0,-29921,2056,-4864,6873,770,30054,11886, + 24948,114,21716,-28851,14043,-8944,32691,-16187,-12247,22692,-9781,-20403, + -11771,16546,18710,17873,9233,31304,-32215,-24382,-28247,-25916,10466,24988, + -3404,-4177,-28528,-531,-3016,17300,-28552,-7708,-26180,-4297,-367,-2312, + -25611,28535,-8533,24004,25421,-1224,-5354,-20807,-21589,-6761,-5203,-1055, + -6715,-26673,-1433,-17732,-24198,14681,-3714,-6660,-14891,-25575,20349,-7701, + -8336,31433,16695,-14773,26819,3096,-12584,-28808,17825,-21200,-32399,15877, + -28890,-3728,-27126,21375,-32630,-7615,32004,-29230,-6611,-5508,-28921,12418, + 27204,-5725,9643,3520,26836,-29347,2101,-29311,9320,29287,-29990,-6593,29825, + -29114,16232,25641,20672,-23501,-32127,-6546,-956,10474,-29647,1070,5516,13760, + -27814,-32488,-28006,-17968,-3146,10963,19234,22132,23988,7142,5523,9639,-6888, + -11428,7964,23099,-16822,16518,31109,-12958,10351,2434,3091,3625,2244,27512, + -28559,-10724,-19377,23625,30056,11478,-21176,27660,26517,-29037,-9390,12297, + -11903,5980,-21927,-7483,6671,11249,29638,-23827,-26358,-6856,-1063,-5303, + 26636,25797,31818,26798,-4243,-18772,-13266,27472,-12005,-10642,-22524,24373, + -13111,-9062,6274,-20002,24150,22189,-14965,-31249,-13934,-6341,-18384,-32054, + -29246,10622,-9260,19428,-15485,2724,23810,16447,11627,18604,2739,27812,30295, + -21538,-31786,11355,-11308,-9006,-4987,25363,-18927,-21130,-31213,-27411,17231, + -19608,20232,27754,16476,11213,-19803,-24048,30918,-25329,21233,-10160,13519, + 11828,26653,-6703,10893,6871,-12417,24471,20310,-12137,-19677,4457,-19530, + 10147,17724,533,-10055,27076,10264,11274,-10511,4809,25208,16065,-5105,-19953, + 3772,-12124,13475,-27559,-9955,26446,15133,15207,-23640,6425,-11010,28688, + -20064,26353,-889,-25008,10380,-14449,-6894,18920,-23900,16902,-31018,16093, + 20875,-19576,4585,13126,18589,24789,19424,31274,-5059,-14538,-3125,-16527, + -25070,-9013,26628,15756,-7652,30841,-1283,17707,25717,-18315,-6342,6880, + -19176,6995,5672,2853,-9044,-3409,-14421,-7522,13108,20582,-25317,1376,-5648, + 13821,17300,1220,-29437,-25832,-8332,-15575,-9744,28297,31995,-1217,23852, + 14382,31059,9160,-3296,20287,-28357,24449,-10323,-21992,-4655,-32548,13237, + -15083,-25226,-21121,2015,-8996,-20247,-27551,-14771,-16089,-6920,-9645,21578, + 7142,-5613,14029,24730,-29253,13931,-3862,-16634,-7388,16951,15771,31302, + -22186,-6716,18416,1698,-26200,-16231,9821,-10886,-4994,-30527,-9448,-16923, + 29549,-11207,-14909,-3643,-27548,17865,28859,29753,17616,16874,-17733,9424, + 21435,-31715,24544,8666,30844,25075,-18267,12027,-5346,2717,19615,-4548,-21763, + 28514,11691,22268,-2338,1406,-27379,-23568,-24525,13633,11295,-14715,7877, + -27669,3475,20345,7779,-17849,2184,7132,4079,-24937,11585,22740,5810,-10855, + 16203,-6371,23235,-7,-24828,-11205,-11006,-10,-17812,-14274,11504,-27517,463, + 4498,-32180,-9775,-3190,-22435,-18662,-30146,-31834,-26449,-19374,-12616, + -10596,14341,-10089,-18449,-16535,21439,21191,-1651,7695,-30009,-23339,-8675, + -20774,21588,-2793,8218,-14337,-10866,14060,-15343,31712,25247,-8539,18074, + -28683,-7363,-7663,-3563,-30718,17771,28687,-30495,30584,14022,-28053,5292, + -31576,-32486,-15470,-1330,23551,-2185,-10829,-13216,-4825,-2964,-14668,24559, + -4930,23731,-1152,-11493,-2321,15987,-27073,-20305,-24065,-25048,32750,-27440, + -1169,-25633,-4356,-24993,30439,-17165,-4580,8662,22655,-4588,-6162,-3122, + 31986,-2569,20371,-12320,-25613,-16133,-25644,23677,12254,5855,26325,-13425, + -15903,-1930,-28488,31222,31153,17607,-2758,7594,-8868,30434,-2518,27956, + -19424,7370,6199,-17602,17347,-14358,25588,11611,-25209,-23701,-27444,-29788, + 2680,-27406,9318,22483,-28356,28482,4577,-14891,17323,-30152,2507,2977,5004, + -11696,-31623,-15149,13357,28938,-14048,19490,-19860,-26050,10842,-24922, + -20986,8847,-31184,28519,-29168,32195,10516,25713,-3493,670,31283,-12769, + -17461,11357,13180,26133,15944,18051,-32167,-27990,16813,17676,21787,-17578, + 11173,19093,2836,656,-15239,4632,23937,4106,-21655,-7494,-21575,-17647,-18465, + -14654,-29990,-10707,-12440,21465,5822,26164,-1404,-14303,-26635,-6900,-23611, + 11998,-18551,971,27579,13325,4579,23059,29281,22291,29880,-17546,25664,-14990, + -526,-35,28218,-3214,11965,11263,6633,30719,32400,-29,-3733,24383,32678,-27542, + -4444,6196,5975,-19722,11902,16840,-11680,11146,-26391,-8980,21573,-9043,2349, + -12887,5916,-2996,10410,-23374,26338,11867,-14518,18281,14450,-5815,13842,359, + 25450,27043,3355,13423,-20880,-26311,-30720,-2503,-6046,-18156,-18558,-14774, + -15664,-29001,3365,-12689,10233,23608,24692,12039,15445,18411,-27469,3764, + -10841,22672,23844,2282,-12443,2851,-27163,13651,13738,17201,-29819,27414, + -29764,-5308,-16171,-32427,-26312,-7460,-27376,-6004,25717,29254,-15015,8754, + 15493,22232,-28513,-23355,23676,7736,10571,-8120,-16677,7696,32549,-2646,25538, + 3498,30960,-28459,24716,12655,-10496,402,26209,482,-16661,-20350,-3403,14015, + 32299,11262,-25886,4092,-7843,-100,-1975,-58,-3729,-19269,-23583,-6929,20000, + -6089,17780,-3250,29830,19954,-29277,27896,10330,9277,-25358,31279,-14454, + 24203,-30170,12872,-21973,-25773,-10502,-6647,-26143,6394,-13479,-24559,23007, + -21844,1505,24702,-23187,-24364,-20470,20765,-7107,15674,9404,17408,17964, + 19820,18952,2154,-26052,30056,-3227,17770,-8557,-31018,-27700,-25974,9003, + 18218,22730,-19981,6737,3532,1562,-23626,14990,28472,-5270,17358,-32204,-29197, + -3647,4296,8588,25302,-23906,30328,-29119,-24392,8992,-16557,31530,-31216, + 14107,13041,-6976,7529,-8296,17865,-1462,8181,-21588,-131,-10177,-25931,-14627, + 8301,3708,-32097,20808,13892,-21179,1192,20853,3249,-8774,20843,3520,24954, + -14215,-25170,-16170,2390,25964,-23923,-17464,-7177,-27568,-9880,-4647,-7323, + 15388,2113,-12338,-7737,26255,26818,-22156,-19610,-911,-17057,-556,29935,27647, + 31806,23676,-18132,-19234,-10869,-3715,24983,-10900,-29564,19856,-16392,-31860, + -25826,24077,12080,15383,-29852,-2266,-27217,31931,-3183,17385,-14211,19050, + -2449,-468,-2871,-11466,973,2866,649,1367,-8688,-24069,20992,25139,-25850,1184, + 15851,785,16951,12160,22337,-21851,1849,-18801,14247,-429,-12682,30881,-11273, + -24819,-9794,8389,-27287,7525,16633,1328,-26650,32607,-8217,31912,7774,-16188, + -3546,-6550,-16279,-32696,1940,2577,-23723,-6484,2009,-424,27833,-21763,-13902, + 7044,27360,-18450,27889,23987,3137,-7669,-5784,-7490,24946,32302,26464,-15513, + 28898,2493,-17645,-4615,-13434,-20884,-4058,-29951,-22281,24784,21083,-8536, + 22147,-11261,-15069,20659,2993,19029,21909,6748,-3263,1401,30960,11000,-16871, + -30566,-14959,-26356,-2885,21526,-26531,31063,12857,4992,-5067,3130,-17602, + -1732,-6593,30200,24679,3267,310,20733,24863,-15669,7875,-4577,-13821,-22325, + 15548,29744,3733,-14547,21459,22122,3854,-2572,30197,-24770,-21263,8793,-8316, + 1571,28191,-16143,-6446,31524,-26496,-17349,-29097,2806,11281,-7041,-683,14149, + 19689,-22094,-1657,-30904,183,-15226,-6358,25461,461,1495,28345,-10554,-4004, + 27119,13484,-21600,-12272,-7272,-14064,-299,10697,11280,19066,-9841,-7265, + -18002,19906,-17247,21482,-10939,-5897,-22300,-13978,27575,-8684,-6222,-19041, + 5788,-30863,-10134,15142,2895,14705,-17713,12940,-21535,-11619,29416,18417, + -24973,24867,-26462,-24910,-32556,-26705,-7187,-7750,-758,-14809,20289,9260, + 13778,-1422,30301,-1922,30646,27662,-15465,-912,29340,13846,-1263,28887,-20019, + 32421,-29411,-27632,-7495,-8368,29230,-6386,-19536,-5235,2054,1854,23563,12348, + -15165,-2936,-28063,-15760,20126,-25531,4963,-5739,23182,16895,-17258,-10470, + -3969,-7742,-140,4475,-24014,-31961,19231,27153,-18551,20157,26443,11530, + -22214,2284,-24238,-31051,-26422,9088,29868,18458,8488,-9515,6799,-12507,54, + -19441,-32665,12561,23560,4725,-28617,-14800,-10224,-13503,-17636,-16823, + -24072,18735,-29798,-23658,-670,-21769,7489,-6468,-8961,-14785,22255,11582, + -29831,16303,-19652,2922,-4362,22966,16173,-18446,-6148,27381,-8493,-32289, + 24005,-3027,-18665,-16472,-17793,-27027,-7443,17854,31365,-17726,-2510,-17546, + 14893,21773,-23634,21117,32533,6637,-1106,-8152,-3672,-113,-2149,-34,-22700, + -4102,-28533,-14104,-10086,4378,13695,-15320,-28258,2246,7595,30021,13281, + -11968,-29983,14274,27152,26713,19434,17058,1142,-3043,-16496,18630,-11976, + 29168,-3634,32746,27287,-268,16711,-8712,-471,12895,17406,-22548,-3969,-10733, + 13128,10530,-31667,7929,-32277,30926,-1983,8401,-7705,6790,4532,1442,26728, + 29600,-15358,21622,9744,11406,15989,-30741,-15044,29913,24534,6774,-3755,17623, + 19647,18762,10042,9653,-5889,2408,-32579,-6285,-28559,-30655,6294,-21175,4390, + 1668,25437,2821,21066,-13680,5274,-27253,-5248,-26307,29744,-26428,25358,17196, + 15199,-29784,-4604,25653,-8048,-23131,-28995,31340,-9558,26186,11268,27916, + 9646,-7389,-11384,-29116,-4100,160,18394,7856,738,-25920,12148,24713,-31664, + 8203,-25556,13494,30352,29161,30898,1432,-5991,25411,1344,-4019,22299,15685, + -16401,-23136,-28110,11874,-18945,1879,2,0,-32256,-20996,-18169,29220,12,0,0,0, + 335,-27277,-30776,20480,0}; + + diff --git a/2015/endoh3/hello.b b/2015/endoh3/hello.b new file mode 100644 index 000000000..8fa0f72a3 --- /dev/null +++ b/2015/endoh3/hello.b @@ -0,0 +1 @@ +++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++. diff --git a/bugs.md b/bugs.md index ab5759bbd..df1b10b4c 100644 --- a/bugs.md +++ b/bugs.md @@ -367,7 +367,7 @@ something was noted by the author, the judges, a consequence of earlier requirements for winning entries or the purpose was to do something that might appear to be buggy. An example of system specific entries: -[1984/mullender](1984/mullender/mullender.c) (see below and the [faq](/faq.md) +[1984/mullender](1984/mullender/mullender.c) (see below and the [FAQ](/faq.md) for a version that works in modern systems) is very system specific and was before system specific winning entries were discouraged. This is an all time personal favourite of Landon Curt Noll. Run the alternate code to understand why @@ -1858,19 +1858,6 @@ is not. Again see his README.md for details! # 2015 -## [2015/endoh3](2015/endoh3/prog.c) ([README.md](2015/endoh3/README.md)) -## STATUS: missing files - please provide them - -With Yusuke's analysis of his entry which can be found -[here](https://mame-github-io.translate.goog/ioccc-ja-spoilers/2015/endoh3.html?_x_tr_sl=auto&_x_tr_tl=en&_x_tr_hl=en-US&_x_tr_pto=wapp) -he shows a tarball with source files that work with his entry, a mock emulator -for [1984/mullender](1984/mullender/mullender.c). Unfortunately he does not have -the tarball available for download and only showed a few (which -[Cody Boone Ferguson](/winners.html#Cody_Boone_Ferguson) added to the repo). - -Cody has his email and WILL be contacting him in time but we note it here anyway -for now. - # 2018 diff --git a/faq.md b/faq.md index 13a5223ff..3a9d2e318 100644 --- a/faq.md +++ b/faq.md @@ -66,9 +66,8 @@ PDP-11/40 emulator. Others are not so easy though we're working on this and over time have added alternative code. Most entries do now work and the others we are working on. In some cases we replaced the original code with code that works for modern systems -but one can view the archive for the original code (sometimes the original code -is in the directory usually as a `winner.alt.c` or `prog.alt.c` but note that -sometimes authors have that already as well). +but one can view the original code in the `.orig.c` files (sometimes the +original code is also in the directory as a `winner.alt.c` or `prog.alt.c`). ## Q: After running a program my terminal is all messed up! How do I restore my terminal? @@ -150,7 +149,7 @@ packages: one for compiling and one for linking / running. ### macOS If you're using macOS there are at least three ways to obtain it. You can -download it from the SDL website and install the package. The latter will not +download it from the SDL website and install the package. That will not work well for the IOCCC but these will: #### MacPorts @@ -216,6 +215,11 @@ For the original version see the [/archive](/archive) directory where you can find all the original winning entries. In some cases the `winner.alt.c` is the original source code. +## Q: Since some entries have been modified over time, how can I view the original entry? + +See either the `winner.orig.c` or `prog.orig.c`, depending on the year (earlier +years we did not rename the code to `prog.c` but had it as the winner handle), +in the winning directories. ## Q: I found a bug in a previous winner, what should I do? diff --git a/thanks-for-fixes.md b/thanks-for-fixes.md index 42c76b2ac..d80163182 100644 --- a/thanks-for-fixes.md +++ b/thanks-for-fixes.md @@ -1417,8 +1417,11 @@ The author, Yusuke, supplied the additional source files, which Cody added to the repo for us. Yusuke wrote in his [analysis of the entry](https://mame-github-io.translate.goog/ioccc-ja-spoilers/2015/endoh3.html?_x_tr_sl=auto&_x_tr_tl=en&_x_tr_hl=en-US&_x_tr_pto=wapp) that there are others as well but we don't seem to have them and he didn't -provide them on his page. We've not yet contacted him for a copy but we will in -time. +provide them on his page. Cody contacted him and he sent the tarball but it was +also hinted that in the README.md there is a program that generates the tarball +which Cody added as [fun.c](2015/endoh3/fun.c). He also added the tarball itself +and the files within it less the README file. + ## [2015/hou](2015/hou/prog.c) ([README.md](2015/hou/README.md))