diff --git a/1990/baruch/README.md b/1990/baruch/README.md index 8c04e83c6..f4dbd73ed 100644 --- a/1990/baruch/README.md +++ b/1990/baruch/README.md @@ -18,56 +18,56 @@ ### To run - echo 4 | baruch - echo 7 | baruch + echo 4 | ./baruch + echo 7 | ./baruch ## Judges' comments - This program reads an integer between 4 and 99 from the stdin. +This program reads an integer between 4 and 99 from the stdin. - NOTE: The original program did not have a newline at the end of - the file. We added a final newline to the file to make - unpacking easy. +NOTE: The original program did not have a newline at the end of the file. We +added a final newline to the file to make unpacking easy. -## Author's comments +## Authors' comments - The goal of this work was to write a program that solves the - classic n-queen problem, with a board size of up to 99x99, while - keeping the program as short as possible. +The goal of this work was to write a program that solves the +classic n-queen problem, with a board size of up to 99x99, while +keeping the program as short as possible. - The program finds all possibilities to place N chess queens on - a NxN chess board so that no queen is in range of any other queen - (not in the same column row or diagonal). For each solution the - chess board and the place of the queens is printed to stdout. +The program finds all possibilities to place N chess queens on +a NxN chess board so that no queen is in range of any other queen +(not in the same column row or diagonal). For each solution the +chess board and the place of the queens is printed to stdout. - This program is about as simple and as readable as possible. - To make things even more simple we used a very limited subset of C: +This program is about as simple and as readable as possible. +To make things even more simple we used a very limited subset of C: - No pre-processor statements - Only one, harmless, 'for' statement - No ifs - No breaks - No cases - No functions - No gotos - No structures + No pre-processor statements + Only one, harmless, 'for' statement + No ifs + No breaks + No cases + No functions + No gotos + No structures - In short, it contains no C language that might confuse the - innocent reader. :-) +In short, it contains no C language that might confuse the +innocent reader. :-) - This program demonstrates the claim that in C, any program - can be written using a single 'for' statement, as long as it is - long enough.. +This program demonstrates the claim that in C, any program +can be written using a single 'for' statement, as long as it is +long enough.. -The authors further note: +The authors' further note: - For PC users: - In order to compile the program under Turbo-C or MSC, 'int ' - should be inserted at the beginning of the program. - For better looking results it is recommended to replace the " #Q" - string with " \261\2". +For PC users: + +In order to compile the program under Turbo-C or MSC, 'int ' +should be inserted at the beginning of the program. +For better looking results it is recommended to replace the " #Q" +string with " \261\2". Copyright (c) 1990, Landon Curt Noll & Larry Bassel. All Rights Reserved. Permission for personal, educational or non-profit use is diff --git a/1990/cmills/README.md b/1990/cmills/README.md index c9ca158a0..97f2a0201 100644 --- a/1990/cmills/README.md +++ b/1990/cmills/README.md @@ -14,6 +14,17 @@ ./cmills [starting_cash] +NOTE: we used a patch from Yusuke Endoh to get this to work in modern systems +(it resulted in a bus error otherwise). Thank you Yusuke for your assistance! + +### Try: + + ./cmills 5000 + + +NOTE: this program uses `gets()` so you will likely get a warning under modern +systems. + ## Judges' comments Compile notes: @@ -27,20 +38,20 @@ ## Author's comments - This is a blackjack program. It does splits, doubling down, - insurance, etc. +This is a blackjack program. It does splits, doubling down, +insurance, etc. - As best I can figure, it should be ANSI-compliant, as well as - portable to BSD & sysV (as well as the irritating compiler I - was using which assumes x=*p++ means x*=p++!). It is - reasonably robust in its error handling---it won't let you - split, double, etc. unless you actually have the cash, etc. To - terminate the program, hit EOF or type 0 or a negative number - for you wager. +As best I can figure, it should be ANSI-compliant, as well as +portable to BSD & sysV (as well as the irritating compiler I +was using which assumes `x=*p++` means `x*=p++`!). It is +reasonably robust in its error handling---it won't let you +split, double, etc. unless you actually have the cash, etc. To +terminate the program, hit EOF or type 0 or a negative number +for you wager. - The way it deals with splits is particularly cool (IMHO). You - can split many times, and it will show all hands as they are - played. +The way it deals with splits is particularly cool (IMHO). You +can split many times, and it will show all hands as they are +played. Copyright (c) 1990, Landon Curt Noll & Larry Bassel. All Rights Reserved. Permission for personal, educational or non-profit use is diff --git a/1990/cmills/cmills.c b/1990/cmills/cmills.c index 6848175d5..8a9b25641 100644 --- a/1990/cmills/cmills.c +++ b/1990/cmills/cmills.c @@ -6,7 +6,7 @@ #define H(v,g)v=h(v,*g++= *r++),*g=0; #define B(n)b(l,n),(V)printf(l V -exit();char*g,c[M],d[N],q[N],p[N],*e,*r=d+N,l[M],*t="??",*k,*m="DEATHISDSev2oinpohae3ttsluuln4a?uibfe 5l\0rtlfrb6 ?a?el:e7$!n\0?e t8%ccp\0.%s9deelc.s T.@?-t.\t receive - The resulting file, 'receive', unpacks the input files - even if the receiver lacks 'uncompress' and 'atob': +The resulting file, 'receive', unpacks the input files +even if the receiver lacks 'uncompress' and 'btoa': mkdir test cd test @@ -60,71 +66,68 @@ cmp ../jaw.c jaw.c cmp ../jaw.hint jaw.hint -## Author's comments +## Authors' comments: - ABSTRACT + ABSTRACT - Minimal, Universal File Bundling - (or, Functional Obfuscation in a Self-Decoding Unix Shell Archive) + Minimal, Universal File Bundling + (or, Functional Obfuscation in a Self-Decoding Unix Shell Archive) - James A. Woods - Universities Space Research Association - NASA Ames Research Center + James A. Woods + Universities Space Research Association + NASA Ames Research Center - "Use an algorithm, go to jail." + "Use an algorithm, go to jail." [anon., circa 1988, pre-Morris worm era] - Myriad formats have been proposed for network-mailable - data. A major difficulty undermining the popularity of most - file/message bundlers is that the sender assumes prior - installation of the computational dual of such bundling - software by the receiver. Command shell archives alleviate - this problem somewhat, but still require standardization for - the function of data compression and mail-transparency - encoding. On Unix, these coding format quandaries are over- - come by planting a novel Trojan Horse in the archive header - to perform negotiationless decoding. +Myriad formats have been proposed for network-mailable +data. A major difficulty undermining the popularity of most +file/message bundlers is that the sender assumes prior +installation of the computational dual of such bundling +software by the receiver. Command shell archives alleviate +this problem somewhat, but still require standardization for +the function of data compression and mail-transparency +encoding. On Unix, these coding format quandaries are over- +come by planting a novel Trojan Horse in the archive header +to perform negotiation-less decoding. - Specifically, we outline the development of an extraor- - dinarily compact portable (un)bundler to (dis)assemble - data-compressed, binary-to-ASCII-converted, length-split, - and checksummed directory structures using standard Unix - tools. Miniature versions of counterparts to a Lempel-Ziv - coder ('compress' or 'squeeze') and an efficient bit packet- - izer ('btoa') are compiled on-the-fly at mail destination - sites where they may not already exist. These are written - in purposefully obfuscated-C to accompany similarly-shrunk - shell command glue. This resulting shell archiver is dubbed - 'shark'. +Specifically, we outline the development of an extraordinarily compact +portable (un)bundler to (dis)assemble data-compressed, +binary-to-ASCII-converted, length-split, and checksummed directory structures +using standard Unix tools. Miniature versions of counterparts to a Lempel-Ziv +coder ('compress' or 'squeeze') and an efficient bit packet- izer ('btoa') are +compiled on-the-fly at mail destination sites where they may not already +exist. These are written in purposefully obfuscated-C to accompany +similarly-shrunk shell command glue. This resulting shell archiver is dubbed +'shark'. - 'Shark' procedure overhead consumes as few as three - dozen shell lines (or ~1100 bytes), commensurate with the - size of many Internet mail headers; it amortizes favorably - with message size. 'Shark' is portable across Unix vari- - ants, while the underlying technique is inherently general- - izable to other encoding schemes. +'Shark' procedure overhead consumes as few as three dozen shell lines (or +~1100 bytes), commensurate with the size of many Internet mail headers; it +amortizes favorably with message size. 'Shark' is portable across Unix +variants, while the underlying technique is inherently generalizable to other +encoding schemes. - In the function-theoretic sense of minimal - Chaitin/Kolmogorov complexity, and within a modified Shannon - model of communication, the 'shark' effort aims to construct - a "shortest program" for source decoding in the Turing- - universal Unix environment. +In the function-theoretic sense of minimal +Chaitin/Kolmogorov complexity, and within a modified Shannon +model of communication, the 'shark' effort aims to construct +a "shortest program" for source decoding in the Turing- +universal Unix environment. - ---------------------------------------------- +---------------------------------------------- - Oh, the shark has pretty teeth, dear-- - And he shows them pearly white - Just a jackknife has Macheath, dear-- - And he keeps it out of sight. + Oh, the shark has pretty teeth, dear-- + And he shows them pearly white + Just a jackknife has Macheath, dear-- + And he keeps it out of sight. [Bertolt Brecht, Threepenny Opera] - ---------------------------------------------- +---------------------------------------------- - We have ported this program to a wide variety of systems. Among - these are: +We have ported this program to a wide variety of systems. Among +these are: SunOS 4.1 / Sun Sparcstation 1 (using both 'cc' and 'gcc 1.37.1') SunOS 4.0.3 / Sun 3 @@ -137,92 +140,91 @@ Dynix / Sequent Balance ('cc' for Natl. Semi. base + 'gcc 1.36') Unicos / Cray 2 - We (the authors) feel this program is obfuscated for the - following reasons: +We (the authors) feel this program is obfuscated for the +following reasons: - (0) This is one of the few programs you'll see WHOSE VERY UTILITY - DEPENDS ON ITS OBFUSCATION! - (1) The contest entry may be used to send its wonderful self to - anyone in the Unix world! Virus writers need not apply... +0. This is one of the few programs you'll see WHOSE VERY UTILITY DEPENDS ON ITS +OBFUSCATION! - (2) The basic idea is twisted enough to be patentable, but is, - out of the kindness of our hearts (as well as to maintain - eligibility for the large IOCCC prize fund), dedicated to - the public domain. Claude Shannon, meet Alan Turing. +1. The contest entry may be used to send its wonderful self to anyone in the +Unix world! Virus writers need not apply... - (3) Meta-obfuscation is via obfuscated description (see ABSTRACT). +2. The basic idea is twisted enough to be patentable, but is, out of the +kindness of our hearts (as well as to maintain eligibility for the large IOCCC +prize fund), dedicated to the public domain. Claude Shannon, meet Alan Turing. - (4) "Literary" allusion. Production code contains a reference to - self-reference, preserved at amazing cost for sheer perversity. +3. Meta-obfuscation is via obfuscated description (see ABSTRACT). - (5) Many, many micro obfuscations below, honed over three years - time, in shell as well as C. Ask about the 'tar' pit escape, - the argv[0] flip, Paul's &4294967295 portability hack, the - "void where prohibited by flaw" fix, the scanf() spacesaver, - shift shenanigans, signal madness, exit()ing stage left, and - source-to-source transformations galore. +4. "Literary" allusion. Production code contains a reference to self-reference, +preserved at amazing cost for sheer perversity. - For extra credit: +5. Many, many micro obfuscations below, honed over three years time, in shell as +well as C. Ask about the 'tar' pit escape, the argv[0] flip, Paul's &4294967295 +portability hack, the "void where prohibited by flaw" fix, the scanf() +spacesaver, shift shenanigans, signal madness, exit()ing stage left, and +source-to-source transformations galore. - Construct 'sharkmail', to auto-split sharkives into mailable - segments and mail them. Here's a simple one, which could be - extended to enable auto-reassembly with one shell cmd at the - far end. +For extra credit: - ------------------------ cut here for sharkmail ----------------------- - #!/bin/sh - m=$1; shift - shark $* | split -800 - /tmp/shark$$ - n=`ls /tmp/shark$$* | wc -l | sed 's/ *//'` - p=0 - for f in `ls /tmp/shark$$*` - do - p=`expr $p + 1` - mail -s "bundle ($p of $n) from '`whoami`'" $m < $f - done - rm /tmp/shark$$* - ------------------------ end of sharkmail ----------------------------- +Construct 'sharkmail', to auto-split sharkives into mailable +segments and mail them. Here's a simple one, which could be +extended to enable auto-reassembly with one shell cmd at the +far end. + + ------------------------ cut here for sharkmail ----------------------- + #!/bin/sh + m=$1; shift + shark $* | split -800 - /tmp/shark$$ + n=`ls /tmp/shark$$* | wc -l | sed 's/ *//'` + p=0 + for f in `ls /tmp/shark$$*` + do + p=`expr $p + 1` + mail -s "bundle ($p of $n) from '`whoami`'" $m < $f + done + rm /tmp/shark$$* + ------------------------ end of sharkmail ----------------------------- Shark history: - May 1987: Karl Fox introduces 1023-byte zcat.c to USENET. + May 1987: Karl Fox introduces 1023-byte zcat.c to USENET. It's too late for the 4th IOCCC. - May 21, 1987: James A. Woods extends idea to construct self + May 21, 1987: James A. Woods extends idea to construct self decompressing shar Trojan horse, utilizing 'cc', 'shar', - 'zcat', & 'atob'; size: 2303 bytes. + 'zcat', & 'btoa'; size: 2303 bytes. - May 23, 1987: 'jaw' trims 250 bytes without much thought. + May 23, 1987: 'jaw' trims 250 bytes without much thought. - June 2, 1987: 52 lines of shell, 1991 bytes, now made with 'tar', + June 2, 1987: 52 lines of shell, 1991 bytes, now made with 'tar', short-circuit C-compile at far end, dual-use main.c, portability mods. (jaw) - Mar-May 1988: abortive run at 5th IOCCC. - jaw.c - 1529 bytes. compile line: 152 bytes. + Mar-May 1988: abortive run at 5th IOCCC. + jaw.c - 1529 bytes. compile line: 152 bytes. generated funny code with execvp() to invoke shell. - Aug 29, 1988: production version, now at 1830 bytes. + Aug 29, 1988: production version, now at 1830 bytes. - Jan 1990: Paul Eggert does tour-de-force shark re-engineering. + Jan 1990: Paul Eggert does tour-de-force shark re-engineering. - May 24, 1990: collaboration yields 999-byte jaw.c core (see above) + May 24, 1990: collaboration yields 999-byte jaw.c core (see above) and 1530-byte production shell code (w/comments). Eggert comes through with lion's share of improvements. - 7th IOCCC code now faster than the atob/zcat it replaces. + 7th IOCCC code now faster than the btoa/zcat it replaces. - May 1990: 'jaw' develops experimental replacement using + May 1990: 'jaw' develops experimental replacement using Dan Bernstein's high-compression 'squeeze'. To which we add: - June 1990: 'shark' wins the IOCCC, finally! :-) + June 1990: 'shark' wins the IOCCC, finally! :-) Copyright (c) 1990, Landon Curt Noll & Larry Bassel. -All Rights Reserved. Permission for personal, educational or non-profit use is +All Rights Reserved. Permission for personal, educational or non-profit use is granted provided this this copyright and notice are included in its entirety -and remains unaltered. All other uses must receive prior permission in writing +and remains unaltered. All other uses must receive prior permission in writing from both Landon Curt Noll and Larry Bassel. diff --git a/1990/jaw/btoa b/1990/jaw/btoa new file mode 100755 index 000000000..cbc59a7c5 --- /dev/null +++ b/1990/jaw/btoa @@ -0,0 +1,12 @@ +#!/usr/bin/env ruby +puts "xbtoa Begin" +data = $<.read +n, e, s, r = data.bytesize, 0, 0, 0 +(-n % 4).times { data << 0 } +data.bytes do |b| + e, s, r = e ^ b, (s + b + 1) & 0xffffffff, (r * 2 + r[31] + b) & 0xffffffff +end +data.unpack("N*").flat_map do |v| + v == 0 ? [?z.ord] : (0..4).map {|i| v / 85**(4 - i) % 85 + 33 } +end.pack("C*").scan(/.{1,78}/) { puts $& } +puts "xbtoa End N %d %x E %x S %x R %x" % [n, n, e, s, r] diff --git a/1990/jaw/shark.sh b/1990/jaw/shark.sh index 38689a128..5a8a30146 100755 --- a/1990/jaw/shark.sh +++ b/1990/jaw/shark.sh @@ -1,5 +1,5 @@ for i in "${@?${usage?$0 file...}}";do<"$i"||exit;done -(cat&&tar cbf 1 - "$@"|compress|btoa&&echo w)<<\Z +(cat&&tar cbf 1 - "$@"|compress|./btoa&&echo w)<<\Z #!/bin/sh # # GENTLE READER -- write this message to file [no headers!]; run "sh file". @@ -13,7 +13,7 @@ PATH=$PATH:. a=atob m=unshark z=zcat r="rm -f $a $m* $z" v="cc -o $z $m.c" trap "$r;exit 1" 1 2 13 15 echo decoding... -(:|compress|btoa|$a|$z)2>$m>&2||(sed '1,9s/./#define & / +(:|compress|./btoa|$a|$z)2>$m>&2||(sed '1,9s/./#define & / s/@/[w]/g s/C/char /g s/I/;if(/g diff --git a/1990/pjr/README.md b/1990/pjr/README.md index a0f638f7d..8fb4cb4e7 100644 --- a/1990/pjr/README.md +++ b/1990/pjr/README.md @@ -18,19 +18,19 @@ ## Judges' comments - This program prints out a string. Can you figure out how - it is done? +This program prints out a string. Can you figure out how +it is done? - By use of pointers to functions returning a struct of pointers - to functions! +By use of pointers to functions returning a struct of pointers +to functions! - Note that some compilers will be unable to compile the - expression 'X=g()...' in main due to lack of temporary - value space. One might want to try replacing main with: +Note that some compilers will be unable to compile the +expression 'X=g()...' in main due to lack of temporary +stack space. One might want to try replacing main with: main(){X=s().v().o().o().l().S().d().l().i().o().w().N();} - if this is a problem. +if this is a problem. Spoiler: (rot13 to read) diff --git a/1990/scjones/README.md b/1990/scjones/README.md index af1f9504f..5cc270da5 100644 --- a/1990/scjones/README.md +++ b/1990/scjones/README.md @@ -11,7 +11,7 @@ make all - Modern compilers might fail to compile this entry: +Modern compilers might fail to compile this entry: scjones.c:1:7: error: expected ';' after top level declarator char*a??(??)=??< @@ -19,49 +19,50 @@ ; - but we were able to get it to compile with modern compilers by specifying the - `-ansi` flag with a tip from Yusuke Endoh. Thank you Yusuke! +but we were able to get it to compile with modern compilers by specifying the +`-ansi` flag with a tip from Yusuke Endoh. Thank you Yusuke! -### To run +### To run: ./scjones -## Judges' comments +## Judges' comments: - The addition of trigraphs has made it easier to make programs - hard to read. It was a dark and stormy night for C when the - ANSI C committee added trigraphs to the standard. Too bad - that they didn't just simply require a more reasonable ISO - character set. +The addition of trigraphs has made it easier to make programs +hard to read. It was a dark and stormy night for C when the +ANSI C committee added trigraphs to the standard. Too bad +that they didn't just simply require a more reasonable ISO +character set. -## Author's comments +## Author's comments: - Since this year's contest is dedicated to ANSI C, here is a - strictly conforming entry. In accordance with the ANSI - definition of a strictly conforming program it does not produce - output dependent on any unspecified, undefined, or implementation - defined behavior, and it does not exceed any of the minimum - implementation limits. It adheres to all of the syntactic and - semantic constraints of the standard, #includes the relevant - headers for the functions it uses, and uses the EXIT_SUCCESS and - EXIT_FAILURE macros to return a correct success/fail status to - the invoking program. It also uses trigraphs for characters - which are not in the Invariant Code Set of ISO 646:1983, so it - will be portable to machines with deficient (from C's standpoint) - character sets. In short, it should be very widely portable. As - an extra added attraction, all of the lines are under 72 - characters long, which would allow for sequence numbers to be - punched in columns 73-80 :-). +Since this year's contest is dedicated to ANSI C, here is a +strictly conforming entry. In accordance with the ANSI +definition of a strictly conforming program it does not produce +output dependent on any unspecified, undefined, or implementation +defined behavior, and it does not exceed any of the minimum +implementation limits. It adheres to all of the syntactic and +semantic constraints of the standard, #includes the relevant +headers for the functions it uses, and uses the EXIT_SUCCESS and +EXIT_FAILURE macros to return a correct success/fail status to +the invoking program. It also uses trigraphs for characters +which are not in the Invariant Code Set of ISO 646:1983, so it +will be portable to machines with deficient (from C's standpoint) +character sets. In short, it should be very widely portable. As +an extra added attraction, all of the lines are under 72 +characters long, which would allow for sequence numbers to be +punched in columns 73-80 :-). - [[ The Author sent us this note after he was informed that he won ]] +[[ The Author sent us this note after he was informed that he won ]] - Although I am quite grateful for the "ANSI Committee's Worst Abuse - of C" title (were you aware that I am a member of the committee or - is the double meaning unintentional?), I was really hoping for - something more along the lines of "Closest Resemblance to Line Noise." :-) +> Although I am quite grateful for the "ANSI Committee's Worst Abuse of C" title +(were you aware that I am a member of the committee or is the double meaning +unintentional?), I was really hoping for something more along the lines of +"Closest Resemblance to Line Noise." :-) + +[[ ... it was unintentional ]] - [[ ... it was unintentional ]] Copyright (c) 1990, Landon Curt Noll & Larry Bassel. All Rights Reserved. Permission for personal, educational or non-profit use is diff --git a/1990/stig/README.md b/1990/stig/README.md index 3d68ee7f2..2bdc4e482 100644 --- a/1990/stig/README.md +++ b/1990/stig/README.md @@ -13,39 +13,43 @@ make all +NOTE: that's not a typo but one can also do: + + ./o + ## Judges' comments - We changed the alias that the author's suggested alias from a - C-shell alias to a zsh alias. +We changed the alias that the author's suggested alias from a +C-shell alias to a zsh alias. - Note that shst.c is renamed to stig.c in the distribution. +Note that shst.c is renamed to stig.c in the distribution. WARNING: This program's 'how to compile' is too specific to a particular - shell. The obfuscation of this program to more related to - shell obfuscation than C obfuscation. This type of entry will - not be permitted in future contests. +shell. The obfuscation of this program to more related to +shell obfuscation than C obfuscation. This type of entry will +not be permitted in future contests. ## Author's comments - If you like shell programming you may also admire my - creative quoting. (I use echo to create an alias - which when run calls cc with the -D option to create a - C macro with double quotes in it. ARRRRRGGGHHH!) +If you like shell programming you may also admire my +creative quoting. (I use echo to create an alias +which when run calls cc with the -D option to create a +C macro with double quotes in it. ARRRRRGGGHHH!) - The program is totally portable, but the compile - commands are very shell specific so don't be TOO mad - at me if they don't work for you. +The program is totally portable, but the compile +commands are very shell specific so don't be TOO mad +at me if they don't work for you. - If you want to put these commands in a Makefile you - must add 4 - four - backslashes at the end on first - line. (At least that's what works here.) +If you want to put these commands in a Makefile you +must add 4 - four - backslashes at the end on first +line. (At least that's what works here.) - If everything works correctly it create an executable - named c which checks whether your compiler supports - nested comments. I've stolen the "/*/*/0*/**/1" from - somewhere so don't give me any points for it. Of - course neither ANSI nor K&R support nested comments - when properly implemented, but what the heck. +If everything works correctly it create an executable +named c which checks whether your compiler supports +nested comments. I've stolen the `"/*/*/0*/**/1"` from +somewhere so don't give me any points for it. Of +course neither ANSI nor K&R support nested comments +when properly implemented, but what the heck. Copyright (c) 1990, Landon Curt Noll & Larry Bassel. All Rights Reserved. Permission for personal, educational or non-profit use is diff --git a/1990/tbr/README.md b/1990/tbr/README.md index 80e7adc83..ee2c98ee3 100644 --- a/1990/tbr/README.md +++ b/1990/tbr/README.md @@ -1,10 +1,17 @@ # Best Utility - Byron Rakitzis Sean Dorward - Princeton University Princeton University - 5707 Old Lodge Dr. 10274 Burleigh Cottage Lane - Houston, TX 77066 Ellicott City, MD 21043 - USA USA + Byron Rakitzis + Princeton University + 5707 Old Lodge Dr. + Houston, TX 77066 + USA + + Sean Dorward + Princeton University + 10274 Burleigh Cottage Lane + Ellicott City, MD 21043 + USA + ## To build: @@ -16,13 +23,16 @@ ## Judges' comments - This program implements a subject a well known Un*x utility whose - original source was considered to be extremely obfuscated by many - people, excluding its author. In fact, this utility was a major - inspiration for the formation of this contest. - The author supplied us with a slightly smaller unformatted version - of the program which we include below: +This program touches on a well known Unix utility, the 6th edition Bourne Shell +(`/bin/sh`), whose original source was considered to be extremely obfuscated by +many people (although Steve Bourne might disagree). Did you know that the Bourne +Shell source was a major inspiration for the formation of the IOCCC back in +1984? + + +The author supplied us with a slightly smaller unformatted version +of the program which we include below: #define D ,close( char*c,q[512],m[256],*v[99],**u,*i[3];int f[2],p;main(){for(m[m[60]=m[62]= @@ -36,9 +46,10 @@ e(x){x<0?write(2,"?\n$ "-x/4,2),x+1||(exit(1),0):5;} - Modern compilers had a problem with this entry because the exit(3) function - returns void but we were able to get it to compile by using the comma - operator which we also did in the smaller version. +Modern compilers had a problem with this entry because the exit(3) function +returns void but we were able to get it to compile by using the comma +operator which we also did in the smaller version. + ## Author's comments diff --git a/1990/theorem/README.md b/1990/theorem/README.md index 35d08d8d3..9d8d83dee 100644 --- a/1990/theorem/README.md +++ b/1990/theorem/README.md @@ -11,91 +11,103 @@ make all -### To run +NOTE: thanks to Yusuke Endoh for the pointing out that `atof()` nowadays needs +`#include ` in order to get this to work. Thanks also to Cody Boone +Ferguson for fixing some segfaults under modern (and in some cases earlier) +systems with this entry. + + +## To run: + + ./theorem expression x1 x2 h y1 + +where: + + expression - function f(x,y) (see below) + x1 - start of interval + x2 - end of interval + h - step size + y1 - initial value (y(x1) == y1) + + +## Try: ./theorem y 0 1 0.1 1 -## Judges' comments - The program's source implements four functions, all from the - same source file! - Usage: +## Judges' comments: - theorem expression x1 x2 h y1 +The program's source implements four functions, all from the +same source file! - where: - expression - function f(x,y) (see below) - x1 - start of interval - x2 - end of interval - h - step size - y1 - initial value (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, 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, 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: - The 'expression' f(x,y), is any function of 'x' and 'y' with the - operators: - - + - * / ^ + + - * / ^ - The symbol '^' is the power operator. Note that it only supports - integer powers. Also note that all expressions are evaluated strictly - left to right. (i.e., parenthesis aren't supported). +The symbol '^' is the power operator. Note that it only supports +integer powers. Also note that all expressions are evaluated strictly +left to right. (i.e., parenthesis aren't supported). - Try running the program with the following args: +Try running the program with the following args: ./theorem y 0 1 0.1 1 ./theorem 1/x 1 2 0.1 0 ./theorem 'x^2/y+x' 0 1 0.1 6 - - But wait, there is more! You also get, free of charge, a - reversing filter! Try: + +But wait, there is more! You also get, free of charge, a +reversing filter! Try: ./theorem -r 0 0 0 0 < theorem.c > sorter.c - - Still not impressed? The author throws in for free, a - sort program! Try: + +Still not impressed? The author throws in for free, a +sort program! Try: cc sorter.c -o sorter ls | ./sorter - - This program is safe for home use as well. The author has - included a safety feature in case you misplace the original - program source: - ./sorter -r 0 0 0 0 < sorter.c > theorem_bkp.c - - And finally, as a special offer to users of this entry, - the author provides a Fibonacci sequence generator! Try: +This program is safe for home use as well. The author has +included a safety feature in case you misplace the original +program source: - ./sorter 0 0 0 0 < theorem.c > fibonacci.c - cc fibonacci.c -o fibonacci - ./fibonacci 1 1 - ./fibonacci 2 1 + ./sorter -r 0 0 0 0 < sorter.c > theorem_bkp.c - Program available 9 track and cartridge cassette. Gensu knife - not included! :-) +And finally, as a special offer to users of this entry, +the author provides a Fibonacci sequence generator! Try: - When this program was first shown at the 1990 Summer Usenix - conference, it received a standing ovation; a first for - a contest entry. + ./sorter 0 0 0 0 < theorem.c > fibonacci.c + cc fibonacci.c -o fibonacci + ./fibonacci 1 1 + ./fibonacci 2 1 - It should be noted that the 4 trailing args '0 0 0 0', are - required on systems that dump core when NULL is dereferenced. +Program available 9 track and cartridge cassette. Gensu knife +not included! :-) + +When this program was first shown at the 1990 Summer Usenix +conference, it received a standing ovation; a first for +a contest entry. + +Originally we noted that the 4 trailing args '0 0 0 0' were required on systems +that dump core when NULL is dereferenced but this problem showed itself in +modern systems even with the 4 '0 0 0 0'. To make this easier for users Cody +Boone Ferguson kindly fixed this problem. ## Author's comments - Differential equations are solved via the Runge-Kutta method, - which guarantees local error proportional to h^5, and total - error across a finite interval is at most a constant times h^4. - - Sorting is accomplished with a standard shell sort. +Differential equations are solved via the Runge-Kutta method, +which guarantees local error proportional to h^5, and total +error across a finite interval is at most a constant times h^4. - Note that the sorting and reversing is limited to files with - fewer than 500 lines, each less than 99 characters long. +Sorting is accomplished with a standard shell sort. + +Note that the sorting and reversing is limited to files with +fewer than 500 lines, each less than 99 characters long. Copyright (c) 1990, Landon Curt Noll & Larry Bassel. All Rights Reserved. Permission for personal, educational or non-profit use is diff --git a/1990/theorem/theorem.c b/1990/theorem/theorem.c index ba93f7b1e..857646e48 100644 --- a/1990/theorem/theorem.c +++ b/1990/theorem/theorem.c @@ -1,12 +1,14 @@ #include +#include +#include #include #define X #define Y {} #define C } #define o { #undef main -char m[500][99],v[99],R; -int*a,b,n,i,j,W,A; +char m[500][99],v[99],R,*a; +int b,n,i,j,W,A; float Q,G,D,M,T,B,O,U,V,N,y,e(); P(g,R,u)float*g,R,u;{int c;for(*g=1,c=u;c--;*g*=R);} X @@ -77,7 +79,7 @@ for(j=0;j +#include +#include #include diff --git a/1990/westley/README.md b/1990/westley/README.md index 3a0b9866b..99539285f 100644 --- a/1990/westley/README.md +++ b/1990/westley/README.md @@ -10,12 +10,16 @@ make all - NOTE: This entry might not compile when using modern compilers. +NOTE: This entry might not compile when using modern compilers. ### To run ./westley 1 +NOTE: this entry will segfault without an arg and will enter an infinite loop if +input is not a number (or is a negative number). + + ## Judges' comments usage: westley diff --git a/years.html b/years.html index a4e8c1386..ea0b35d67 100644 --- a/years.html +++ b/years.html @@ -912,7 +912,7 @@ Contest
  • A minor bug that shows up in some cases was found by Cody Boone Ferguson when working on his 2020 Enigma machine. See his -README.md file for details (search for vik). +README.md file for details (search for vik).
  • wiedijk - Y combinator

    @@ -2938,6 +2938,9 @@ README.md file for details (search for vik).

    westley - poetic exchange between lovers, prints "luvs me, luvs not"