home *** CD-ROM | disk | FTP | other *** search
- Xref: wupost comp.lang.c:26412 comp.sources.d:3891 comp.unix.wizards:3349 alt.sources:3922 misc.misc:8112
- Path: wupost!uunet!hoptoad!chongo
- From: chongo@hoptoad.uucp (Landon C. Noll)
- Newsgroups: comp.lang.c,comp.sources.d,comp.unix.wizards,alt.sources,misc.misc
- Subject: 1991 International Obfuscated C Code Contest winners, 1 of 2
- Message-ID: <20428@hoptoad.uucp>
- Date: 28 Aug 91 01:37:53 GMT
- Expires: 28 Nov 91 00:00:00 GMT
- Reply-To: chongo@hoptoad.UUCP (Landon C. Noll)
- Distribution: world
- Organization: Nebula Consultants in San Francisco
- Lines: 1632
- Keywords: ioccc
-
- Enclosed is 1 of a 2 part shar file containing the winners of the 1991
- International Obfuscated C Code Contest.
-
- First, we congratulate the winners for doing a fine job. Their efforts
- and feedback have resulted in a number of suggested changes for the
- 1992 contest.
-
- Second, we will be posting, sometime in early October 1991, a proposed
- set of rules for the 1992 contest. At that time, we will be requesting
- feedback on the proposed 1992 rules. Sometime later, perhaps in early
- November 1991, the official 1992 IOCCC rules will be posted.
-
- Last, we would like to make an apology to the 1991 winners and to the
- net for the delay in posting of these results. The poster of this
- article (chongo) went on vacation (Eclipse watching in Hawaii), held
- extended discussions with several of the contest winners, attempted to
- formulate the 1992 rules, and just plain ran out of time. We hope to
- avoid such delays in the future.
-
- If you find problems with some of the contest entries, or find typos
- in our notes, please send PATCH FILES containing the corrections to:
-
- judges@toad.com -or- ...!{sun,uunet,utzoo,pyramid}!hoptoad!judges
-
- chongo <Landon Curt Noll> /\cc/\ hoptoad!chongo
- Larry Bassel {uunet,ucbvax,cbosgd}|sun!lab
-
- p.s. previous winners are available on uunet.uu.net via anonymous ftp
- under the directory ~/pub/ioccc. The updated and corrected 1991
- set will be deposited there when the 1992 rules are posted.
-
- Submitted-by: chongo@toad.com (Landon Curt Noll)
- #
- # Send comments, questions, bugs to:
- #
- # judges@toad.com -or- ...!{sun,uunet,utzoo,pyramid}!hoptoad!judges
- #
- # You are strongly encouraged to read the new contest rules before
- # sending any entries. The rules, and sometimes the contest Email
- # address itself, change over time. A valid entry one year may
- # be rejected in a later year due to changes in the rules. The typical
- # deadline date for the contest is late May. Check with the current year's
- # rules for details.
- #
- # The contest rules are posted to comp.unix.wizards, comp.lang.c,
- # misc.misc, alt.sources and comp.sources.d. If you do not have access
- # to these groups, you may request a copy from the judges, via Email,
- # from the address above.
- #
- # The 1992 contest rules will differ from the 1991 contest in several
- # important ways. Due to these changes, there will be a delay in
- # the posting of the 1992 rules. We expect the 1992 rules to be ready
- # by early October 1991.
- #
- Archive-name: ioccc.1991/part01
-
- ---- Cut Here and unpack ----
- #!/bin/sh
- # This is ioccc.1991, a shell archive (shar 3.32)
- # made 08/24/1991 03:05 UTC by chongo@toad.com (Landon Curt Noll)
- #
- # Send comments, questions, bugs to:
- #
- # judges@toad.com -or- ...!{sun,uunet,utzoo,pyramid}!hoptoad!judges
- #
- # You are strongly encouraged to read the new contest rules before
- # sending any entries. The rules, and sometimes the contest Email
- # address itself, change over time. A valid entry one year may
- # be rejected in a later year due to changes in the rules. The typical
- # start date for a contest is early March. The typical end date for a
- # contest is late May.
- #
- # The contest rules are posted to comp.unix.wizards, comp.lang.c,
- # misc.misc, alt.sources and comp.sources.d. If you do not have access
- # to these groups, or if you missed the early March posting, you may
- # request a copy from the judges, via Email, at the address above.
- #
- # Source directory /u4/chongo/bench/ioccc
- #
- # existing files WILL be overwritten
- #
- # This shar contains:
- # length mode name
- # ------ ---------- ------------------------------------------
- # 3632 -r--r--r-- 1991/README
- # 9780 -r--r--r-- 1991/rules
- # 3298 -r--r--r-- 1991/Makefile
- # 4069 -r--r--r-- 1991/ansi.mk
- # 3842 -r--r--r-- 1991/common.mk
- # 1478 -r--r--r-- 1991/ant.c
- # 1872 -r--r--r-- 1991/rince_ansi.c
- # 1534 -r--r--r-- 1991/rince.orig.c
- # 5503 -r--r--r-- 1991/sorta.README
- # 54 -r--r--r-- 1991/sorta.i2+2
- # 39 -r--r--r-- 1991/sorta.iarg0
- # 1133 -r--r--r-- 1991/dds.c
- # 1536 -r--r--r-- 1991/westley.c
- # 1872 -r--r--r-- 1991/rince.c
- # 81 -r--r--r-- 1991/fine.c
- # 1472 -r--r--r-- 1991/buzzard.c
- # 1001 -r--r--r-- 1991/cdupont.c
- # 1691 -r--r--r-- 1991/davidguy.c
- # 1137 -r--r--r-- 1991/dds.ansi.c
- # 1534 -r--r--r-- 1991/davidguy.orig.c
- # 1183 -r--r--r-- 1991/sorta.icalc
- # 33 -r--r--r-- 1991/sorta.idup
- # 181 -r--r--r-- 1991/sorta.iecho
- # 1669 -r--r--r-- 1991/brnstnd_ansi.c
- # 1009 -r--r--r-- 1991/cdupont_ansi.c
- # 3704 -r--r--r-- 1991/ttt.sh
- # 5435 -r--r--r-- 1991/westley.hint
- # 2619 -r--r--r-- 1991/dds.hint
- # 1708 -r--r--r-- 1991/LANDER.BAS
- # 61 -r--r--r-- 1991/sorta.ifact1
- # 125 -r--r--r-- 1991/sorta.iio
- # 4255 -r--r--r-- 1991/ant.hint
- # 61 -r--r--r-- 1991/sorta.ifact2
- # 2968 -r--r--r-- 1991/buzzard.hint
- # 1428 -r--r--r-- 1991/cdupont.hint
- # 2987 -r--r--r-- 1991/fine.hint
- # 2798 -r--r--r-- 1991/rince.hint
- # 146 -r--r--r-- 1991/sorta.ifact3
- # 318 -r--r--r-- 1991/sorta.irot13
- # 140 -r--r--r-- 1991/sorta.isleep
- # 22 -r--r--r-- 1991/sorta.itailrec
- # 92 -r--r--r-- 1991/sorta.iwhosort
- # 1542 -r--r--r-- 1991/brnstnd.c
- # 5061 -r--r--r-- 1991/davidguy.hint
- # 8418 -r--r--r-- 1991/brnstnd.hint
- #
- if touch 2>&1 | fgrep 'amc' > /dev/null
- then TOUCH=touch
- else TOUCH=true
- fi
- # ============= 1991/README ==============
- if test ! -d '1991'; then
- echo "x - creating directory 1991"
- mkdir '1991'
- fi
- echo "x - extracting 1991/README (Text)"
- sed 's/^X//' << 'SHAR_EOF' > 1991/README &&
- X1991 marked the "The Eighth International Obfuscated C Code Contest"
- X
- X
- XInstructions for use: Run make to compile entries. It is possible that
- Xon BSD or non-unix systems the makefile needs to be changed.
- X
- XLook at the source and try to figure out what the programs do, and run
- Xthem with various inputs. If you want to, look at the hints files for
- X(minor) spoilers.
- X
- XThis year, we did not single out an entry that was better than all of
- Xthe rest. We selected 3 entries that were, in our opinion, went beyond
- Xall of the other entries this year:
- X
- X Grand Prize by Brian Westley
- X Most Well Rounded by Diomidis Spinellis
- X Best Of Show by Daniel J. Bernstein
- X
- XName and address information are separated from the actual program
- Xprior to judging. This eliminates any chance that we would bias our
- Xjudging for/against any person or group. In the end, we are surprised
- Xas you are to see who as won. Even so, it is worth noting that
- XBrian Westley has submitted a winning entry for the past 5 years!
- X
- X
- XA few notes regarding possible changes to the contest:
- X
- XWe did not give awards to some traditional contest categories such as
- X"Best Layout" or "Worst Abuse of the Rules". We felt that to do so
- Xwould deny awards to more deserving entries. These categories have not
- Xbeen eliminated, and will likely be considered in future years.
- X
- XA number of entries made use of the following C pre-processor feature:
- X
- X #define X define
- X #X foo bar
- X
- XThis is not permitted under ANSI C. Some ANSI C compilers do allow
- Xthis. In the future, we do not want programs to use this feature.
- XBecause this request was not stated in the 1991 rules, we did not
- Xreject entries of this type. However we provided more portable
- Xversions so that more people could compile these programs.
- X
- XThis year we received entries that made use of the X Window System.
- XThis functionality is now available on many systems, we feel that
- Xprograms that use these are now portable enough to be valid entries.
- X
- XWe may allow programs to make use of the X Window System libs and include
- Xfiles, provided that they can operate with a system running at the level
- Xof at least X11r4. Requiring the use of imake, a specific window manager,
- Xspecific display hardware, or a specific user interface (Openl**k,
- XM*tif, ...) is likely not to be allowed. We will provide a more detailed
- Xexplanation of our viewpoint in next year's rules.
- X
- XIn order to encourage more 'normal' looking C programs, we are considering
- Xthe following change to the maximum size rule:
- X
- X Your source, not counting any <space>, <tab>, and a <newline> character,
- X and not counting any ';', '{' and '}' character followed by a <newline>
- X character, must be 1536 bytes or less. The entire source, counting all
- X characters, be 4096 bytes or less.
- X
- XSome thought has been given to adding some c++ categories, however this
- Xis not likely to happen soon. We are waiting until c++ compilers become
- Xcommon place on a wide number of systems. We also need time to brace
- Xourselves for what obfuscation c++ could wield!
- X
- XBe sure to wait until the 1992 rules are posted before submitting entries.
- XWe may fine tune the rules to reflect the some ideas above.
- X
- XPlease send us comments and suggestions what we have expressed above.
- XAlso include anything else that you would like to see in future contests.
- XSend such email to:
- X
- X ...!{sun,pacbell,uunet,pyramid}!hoptoad!judges
- X judges@toad.com
- X
- X
- XCredits:
- X
- XWe would like to thank Barbara Frezza for her role as official chef
- Xof the contest. Landon Noll appreciated the opportunity to serve
- Xas assistant pizza chef. Larry Bassel was official taste tester. Yummo!
- SHAR_EOF
- $TOUCH -am 0813225091 1991/README &&
- chmod 0444 1991/README ||
- echo "restore of 1991/README failed"
- set `wc -c 1991/README`;Wc_c=$1
- if test "$Wc_c" != "3632"; then
- echo original size 3632, current size $Wc_c
- fi
- # ============= 1991/rules ==============
- echo "x - extracting 1991/rules (Text)"
- sed 's/^X//' << 'SHAR_EOF' > 1991/rules &&
- X8th International Obfuscated C Code Contest Rules
- X
- X Obfuscate: tr.v. -cated, -cating, -cates. 1. a. To render obscure.
- X b. To darken. 2. To confuse: his emotions obfuscated his
- X judgment. [LLat. obfuscare, to darken : ob(intensive) +
- X Lat. fuscare, to darken < fuscus, dark.] -obfuscation n.
- X obfuscatory adj.
- X
- X
- XGOALS OF THE CONTEST:
- X
- X * To write the most Obscure/Obfuscated C program under the rules below.
- X * To show what should NOT be done in C programs.
- X * To provide a safe forum for poor C code. :-)
- X
- X
- XDEDICATION:
- X
- X The 1991 IOCCC is dedicated to the ANSI C pre-processor.
- X
- X
- XRULES:
- X
- X To help us handle the vast volume of entries, we ask that you follow the
- X rules below. SORRY FOR THE LENGTH, BUT WE NEED ALL THE HELP WE CAN GET!
- X
- X 1) Your source MUST be 1536 bytes or less. It must be a complete program.
- X
- X 2) To help us process your entries, we ask that you submit entries
- X in the following format. Please be sure to include ALL --- lines,
- X otherwise our extraction program may skip your entry!
- X
- X---header items---
- Xname: Your name, of course!
- X
- Xorg: School/Company/Organization
- X
- Xemail address: Email address from a well known site, or in a registered domain
- X
- Xpostal address: Postal address
- X include your country as well
- X
- Xenvironment: Indicate the Hardware
- X and OS under which your program was tested
- X
- Xentry: 5 <i.e., entry number from 0 to 7 inclusive>
- X
- Xremark: Remarks about the program. See rule #3 below for details.
- X---how to ANSI compile---
- XGive the command(s) needed to compile your program using an ANSI C
- Xcompiler. If your program should not be compiled under an ANSI C compiler,
- Xleave this section blank. The command size must be 160 characters or less.
- X---how to common compile---
- XGive the command(s) needed to compile your program using an K&R/traditional
- XC compiler. If your program should not be compiled under a K&R style C,
- Xleave this section blank. The command size must be 160 characters or less.
- X---program---
- XNot everyone has a program such as uuencode, and we don't want to blindly
- Xprocess a shar file, so we ask that you format your source as follows:
- X
- XAdd a leading X to EACH line, unless it is a split line. (see below)
- X
- XSome mailers don't like long lines. To be safe, split lines longer than 80
- X characters. To split a line, place an E at the point of a split and
- X place a C (instead of an X) at the beginning of the next line.
- X
- XIf the program does not end in a newline, end the last line with an E.
- X
- XLeading X's, trailing E's followed by the two characters "\nC", and an E
- X at the last character of the last line are not considered to part of the
- X source and thus don't contribute toward the source character count.
- X Be careful with lines ending in "E\n", see the example below.
- X
- XNewlines and tabs each count as 1 character. Assume 8 character tab stops.
- X
- XThe newlines here were placed for reasons of readability. In your entry,
- X every line in this section must begin with either an X or a C.
- X
- XExample:
- X
- XXThis is a single line containing 79 E
- XCcharacters including the E
- XCfinal newline.
- XXThe next line contains only a single newline.
- XX
- XXThis line is terminated by a newline preceded by an EE
- XC
- XXThis last line is not terminated by a newline and ends in an EE
- X---end---
- X
- X 3) Regarding the header items:
- X
- X * Any text outside of the above format will be kept confidential.
- X
- X * All header lines are required, but you may use 'anonymous'
- X for any header line other than 'remarks' or 'entry'.
- X
- X * Only the '---program---' section uses the 'X', 'C', 'E' notation.
- X
- X * In the 'remark' item, please include:
- X - what this program does
- X - why you think the program is obfuscated
- X - any other remarks (humorous or otherwise)
- X - By default, we will select your program source and/or binary
- X filename. If your entry REQUIRES a specific source and/or
- X binary filename, please say so in the remark section.
- X - If this entry is a re-submission of a previous entry.
- X
- X 4) Your entry should be written in common C (K&R + common extensions)
- X or ANSI C. If your program will NOT compile under an ANSI C or
- X K&R C compiler, leave the particular 'how to' section blank.
- X If you leave a 'how to' section blank, include the '---' line.
- X
- X You do not have to fill in both 'how to' sections, though you must
- X fill in at least one 'how to' section. If you leave a 'how to'
- X section blank, include the '---' line anyway.
- X
- X 5) The program must be of original work. All programs must be
- X in the public domain. All copyrighted programs will be rejected.
- X
- X 6) Entries must be received between 06-Mar-91 0:00 UTC and
- X 16-May-91 0:00 UTC. Email your entries the address found below.
- X (UTC is essentially equivalent to Greenwich Mean Time)
- X
- X We will attempt to Email a confirmation of receipt of contest
- X entries, however since Email is not reliable you may not receive it.
- X We regret that we can no longer accept entries via postal mail.
- X
- X 7) Each person may submit up to 8 entries. Only 1 entry per Email
- X letter. If you submit multiple entries, be sure that each has a
- X unique entry number.
- X
- X We will discard all but the latest email in the case of multiple
- X entries with the same entry number. Thus, if you wish to correct
- X a previously sent entry, re-send it with the same entry number.
- X Just to be sure email does not arrive out or sequence, note that
- X fact in the 'remark' item.
- X
- X 8) Entries requiring human interaction to be built are not allowed.
- X (for example, don't use #include "/dev/tty")
- X
- X 9) Compiling an entry must result a regular file which may be executed.
- X (for example, don't use -o /dev/tty)
- X
- X
- XANNOUNCEMENT OF WINNERS:
- X
- X * First announcement will likely be at the Summer 91 Usenix conference.
- X
- X * Winning entries will be posted in mid June 1991 to
- X comp.sources.unix as well as news groups where these rules
- X were posted. (depending on the judges work load)
- X
- X * Winning entries will be deposited into the uunet archives.
- X
- X * An article containing the winning entries will be published
- X in a future issue of the "Micro/Systems Journal".
- X
- X * Winners receive international fame and flames! :-)
- X
- X
- XJUDGING:
- X
- X Awards will be given to the best entry in a number of categories.
- X The actual category list will vary depending on the types of entries
- X we receive. As a guide, consider using the following:
- X
- X * The best small one line program
- X * The strangest source layout
- X * The most useful obfuscated program
- X * The most creatively obfuscated program
- X * Best obfuscated entry smaller than 256 bytes
- X * Best obfuscated entry smaller than 1024 bytes
- X * Best abuse of ANSI C
- X * Worse abuse of the rules (no abuse of entry format please!)
- X * <anything else so strange that it deserves an award>
- X
- X
- XPOINTS TO PONDER:
- X
- X People are encouraged to examine winners of the previous contests.
- X A copy of these entries has been posted to comp.sources.unix.
- X Contact the comp.sources.unix moderator, or some archive site (such
- X as uunet). Keep in mind that rules change from year to year, so some
- X winning entries may not be valid entries this year. What was unique
- X and novel one year might be 'old' the next year.
- X
- X We examine each entry on several levels of confusion. For example
- X each entry is judged when we:
- X
- X * look at the original source
- X * If it is ANSI, convert tri-graphs to ASCII
- X * C pre-process the source ignoring '#include' '#define' lines
- X * C pre-process the source ignoring '#define' and '#include' lines
- X * run it through a C beautifier
- X * examine the algorithm
- X * lint it
- X * compile it
- X * execute it
- X
- X One line programs are best when they are short, obscure and concise.
- X
- X We tend to dislike programs that:
- X
- X * are very hardware specific
- X * are very OS or Un*x version specific
- X (index/strchr differences are ok, but socket/streams specific
- X code is likely not to be)
- X * dump core or have compiler warnings
- X (it is ok only if you warn us in the 'remark' header item)
- X * won't compile under both BSD or SYS V Un*x
- X * use an excessively long compile line to get around the size limit
- X * obfuscate by excessive use of ANSI tri-graphs
- X * are longer than they need to be
- X * are similar to previous winners
- X * are similar to previous losers :-)
- X
- X Simply abusing #defines or -Dfoo=bar won't go as far as a program
- X that is more well rounded in confusion.
- X
- X Unless you are cramped for space, or unless you are entering the
- X 'best one liner' category, we suggest that you format your program
- X in a more creative way than simply forming excessively long lines.
- X
- X We like programs that:
- X
- X * are as concise and small as they need to be
- X * do something at least quasi-interesting
- X * pass lint without complaint (not a requirement, but it is nice)
- X * are portable
- X * are unique or novel in their obfuscation style
- X * MAKE USE OF A NUMBER OF DIFFERENT TYPES OF OBFUSCATION
- X * make us laugh and/or throw up :-)
- X
- X Some types of programs can't excel in some areas. Of course, your
- X program doesn't have to excel in all areas, but doing well in several
- X areas really does help. A humorous note in the remark section helps.
- X
- X Be creative!
- X
- X
- XEMAIL ADDRESSES
- X
- X Send contest entries to:
- X
- X ...!{sun,pacbell,uunet,pyramid}!hoptoad!obfuscate
- X obfuscate@toad.com
- X
- X The Judging will be done by Landon Noll and Larry Bassel. If you have
- X questions or comments (no entries), please feel free to email them to:
- X
- X ...!{sun,pacbell,uunet,pyramid}!hoptoad!judges
- X judges@toad.com
- X
- X
- Xchongo <Landon Curt Noll> /\cc/\ hoptoad!chongo
- XLarry Bassel {uunet,ucbvax,cbosgd}|sun!lab
- SHAR_EOF
- $TOUCH -am 0622144891 1991/rules &&
- chmod 0444 1991/rules ||
- echo "restore of 1991/rules failed"
- set `wc -c 1991/rules`;Wc_c=$1
- if test "$Wc_c" != "9780"; then
- echo original size 9780, current size $Wc_c
- fi
- # ============= 1991/Makefile ==============
- echo "x - extracting 1991/Makefile (Text)"
- sed 's/^X//' << 'SHAR_EOF' > 1991/Makefile &&
- X# %W% %G% %U%
- X#
- X# 1991 makefile
- X
- XSHELL=/bin/sh
- XMAKE=make
- XMAKEFLAGS=e
- X
- X# uncomment the line to select the preferred type of compile
- X#
- X# You should also check the ansi.mk or common.mk for the
- X# proper compiler name and flags.
- X#
- X# NOTE ==> USE=ansi compile with an ANSI compiler by default
- X#USE=ansi
- X# NOTE ==> USE=common compile with a common K&R compiler by default
- X#USE=common
- X
- XWINNERS= ant brnstnd buzzard cdupont davidguy dds fine rince westley
- X
- Xall:
- X -@if [ "${USE}" = "common" ]; then \
- X echo ${MAKE} -k -f common.mk all; \
- X ${MAKE} -k -f common.mk all; \
- X elif [ "${USE}" = "ansi" ]; then \
- X echo ${MAKE} -k -f ansi.mk all; \
- X ${MAKE} -k -f ansi.mk all; \
- X else \
- X echo "set USE= in Makefile to be ansi or common as desired"; \
- X echo "or type: make -f ansi.mk for ansi makes"; \
- X echo "or type: make -f common.mk for common K&R makes"; \
- X exit 1; \
- X fi
- X
- Xansi:
- X ${MAKE} -f ansi.mk all
- X
- Xcommon:
- X ${MAKE} -f common.mk all
- X
- X${WINNERS} merlyn.c nextmove.c ttt_game.c:
- X -@if [ "${USE}" = "common" ]; then \
- X echo ${MAKE} -f common.mk $@; \
- X ${MAKE} -f common.mk $@; \
- X elif [ "${USE}" = "ansi" ]; then \
- X echo ${MAKE} -f ansi.mk $@; \
- X ${MAKE} -f ansi.mk $@; \
- X else \
- X echo "set USE= in Makefile to be ansi or common as desired"; \
- X echo "or type: make -f ansi.mk for ansi makes"; \
- X echo "or type: make -f common.mk for common K&R makes"; \
- X exit 1;\
- X fi
- X
- Xttt: ttt.sh
- X -@if [ "${USE}" = "common" ]; then \
- X echo ${MAKE} -f common.mk $@; \
- X ${MAKE} -f common.mk $@; \
- X elif [ "${USE}" = "ansi" ]; then \
- X echo ${MAKE} -f ansi.mk $@; \
- X ${MAKE} -f ansi.mk $@; \
- X else \
- X echo "set USE= in Makefile to be ansi or common as desired"; \
- X echo "or type: make -f ansi.mk for ansi makes"; \
- X echo "or type: make -f common.mk for common K&R makes"; \
- X exit 1;\
- X fi
- X
- Xmerlyn: merlyn.c
- X -@if [ "${USE}" = "common" ]; then \
- X echo ${MAKE} -f common.mk $@; \
- X ${MAKE} -f common.mk $@; \
- X elif [ "${USE}" = "ansi" ]; then \
- X echo ${MAKE} -f ansi.mk $@; \
- X ${MAKE} -f ansi.mk $@ \
- X else \
- X echo "set USE= in Makefile to be ansi or common as desired"; \
- X echo "or type: make -f ansi.mk for ansi makes"; \
- X echo "or type: make -f common.mk for common K&R makes"; \
- X exit 1;\
- X fi
- X
- Xttt_game: ttt_game.c
- X -@if [ "${USE}" = "common" ]; then \
- X echo ${MAKE} -f common.mk $@; \
- X ${MAKE} -f common.mk $@; \
- X elif [ "${USE}" = "ansi" ]; then \
- X echo ${MAKE} -f ansi.mk $@; \
- X ${MAKE} -f ansi.mk $@; \
- X else \
- X echo "set USE= in Makefile to be ansi or common as desired"; \
- X echo "or type: make -f ansi.mk for ansi makes"; \
- X echo "or type: make -f common.mk for common K&R makes"; \
- X exit 1;\
- X fi
- X
- Xnextmove: nextmove.c
- X -@if [ "${USE}" = "common" ]; then \
- X echo ${MAKE} -f common.mk $@; \
- X ${MAKE} -f common.mk $@; \
- X elif [ "${USE}" = "ansi" ]; then \
- X echo ${MAKE} -f ansi.mk $@; \
- X ${MAKE} -f ansi.mk $@; \
- X else \
- X echo "set USE= in Makefile to be ansi or common as desired"; \
- X echo "or type: make -f ansi.mk for ansi makes"; \
- X echo "or type: make -f common.mk for common K&R makes"; \
- X exit 1;\
- X fi
- X
- Xclean:
- X ${MAKE} -f ansi.mk clean
- X ${MAKE} -f common.mk clean
- Xclobber:
- X ${MAKE} -f ansi.mk clobber
- X ${MAKE} -f common.mk clobber
- Xnuke: clobber
- X ${MAKE} -f ansi.mk nuke
- X ${MAKE} -f common.mk nuke
- Xinstall:
- X ${MAKE} -f ansi.mk install
- X ${MAKE} -f common.mk install
- SHAR_EOF
- $TOUCH -am 0814015291 1991/Makefile &&
- chmod 0444 1991/Makefile ||
- echo "restore of 1991/Makefile failed"
- set `wc -c 1991/Makefile`;Wc_c=$1
- if test "$Wc_c" != "3298"; then
- echo original size 3298, current size $Wc_c
- fi
- # ============= 1991/ansi.mk ==============
- echo "x - extracting 1991/ansi.mk (Text)"
- sed 's/^X//' << 'SHAR_EOF' > 1991/ansi.mk &&
- X# %W% %G% %U%
- X#
- X# 1991 makefile
- X
- XSHELL=/bin/sh
- XCHMOD=chmod
- XCP=cp
- XRM=rm
- XSED=sed
- XLN=ln
- X
- X# flags for ansi compiles
- X#
- X# NOTE: Some ANSI compilers make use of -Xa to turn on ANSI mode,
- X# others such as gcc may want -ansi, others may want nothing
- X# at all. Adjust the CFLAGS line as needed.
- X#
- XCFLAGS=-O -Xa
- XCC=cc
- X
- X# winners that may be ok to compile with common K&R
- X#
- XWINNERS= ant brnstnd buzzard cdupont davidguy dds fine westley rince
- X
- Xall: ${WINNERS}
- X
- Xcommon:
- X @echo "wrong makefile, use ansi.mk"
- X exit 1
- X
- Xansi: all
- X
- X# NOTE: some systems may need:
- X#
- X# old SYS V:
- X# cc ${CFLAGS} -DMODE=0600 -DBUF=32767 -o ant ant.c -lcurses
- X# ATARI ST:
- X# cc -DMODE=0 -DBUF=32767 -o ant.ttp ant.c curses.a
- X# PC class:
- X# wcl -mc -DMODE=0 -DBUF=32767 ant.c curses.lib
- X#
- Xant: ant.c
- X ${CC} ${CFLAGS} -DMODE=0600 -DBUF=32767 ant.c -o ant -lcurses -ltermcap
- X
- Xbrnstnd: brnstnd_ansi.c
- X ${CC} ${CFLAGS} -DM=malloc -DX=free -Do=250 brnstnd_ansi.c -o brnstnd
- X
- Xbuzzard: buzzard.c
- X ${CC} ${CFLAGS} buzzard.c -o buzzard
- X
- Xcdupont: cdupont_ansi.c
- X ${CC} ${CFLAGS} -Ds=\"cdupont.c\" -Dt=\"r\" cdupont_ansi.c -o cdupont
- X
- X# NOTE: some systems may need:
- X#
- X# ${CC} ${CFLAGS} davidguy.c -o davidguy
- X# or:
- X# ${CC} ${CFLAGS} davidguy.c -o davidguy -linet
- X#
- Xdavidguy: davidguy.c
- X ${CC} ${CFLAGS} davidguy.c -o davidguy -lsocket -lnsl
- X
- X# NOTE: this is the original program that won the contest
- X#
- X# BSD:
- X# ${CC} ${CFLAGS} davidguy.orig.c -o davidguy.orig
- X#
- Xdavidguy.orig: davidguy.orig.c
- X ${CC} ${CFLAGS} davidguy.orig.c -o davidguy.orig -lsocket -lnsl
- X
- Xdds: dds.ansi.c LANDER.BAS
- X ${CC} ${CFLAGS} dds.ansi.c -o dds
- X
- Xfine: fine.c
- X ${CC} ${CFLAGS} fine.c -o fine
- X
- Xwestley: westley.c ttt
- X ${CC} ${CFLAGS} -DP=putchar -DN="P(10)" -DQ="P(34)" -DF="S(&X)" \
- X -DJ=z[4] -DK=J[14] \
- X -DH="w[]={146,7,292,73,448,56,84,273,325,297,108,324,22,40,48,40,17,325}" \
- X westley.c -o westley
- X
- X# the hint file gives nextmove.c as an example, provide a build rule for it
- X#
- Xnextmove: nextmove.c ttt
- X ${CC} ${CFLAGS} -DP=putchar -DN="P(10)" -DQ="P(34)" -DF="S(&X)" \
- X -DJ=z[4] -DK=J[14] \
- X -DH="w[]={146,7,292,73,448,56,84,273,325,297,108,324,22,40,48,40,17,325}" \
- X nextmove.c -o nextmove
- X
- X# the ttt script has been added by the judges to make playing westley easy
- X#
- Xttt: ttt.sh
- X rm -f ttt
- X cp ttt.sh ttt
- X chmod +x ttt
- X
- X# used by the ttt shell script when playing westley
- X#
- X# The ttt script controls what goes into merlyn.c, and how it is used.
- X# The merlyn program and source represent the best (hopefully) state that
- X# the program has evolved into thus far. The ttt_game program and source
- X# represent the current state of the game.
- X#
- Xmerlyn: merlyn.c ttt
- X @${CC} ${CFLAGS} -DP=putchar -DN="P(10)" -DQ="P(34)" -DF="S(&X)" \
- X -DJ=z[4] -DK=J[14] \
- X -DH="w[]={146,7,292,73,448,56,84,273,325,297,108,324,22,40,48,40,17,325}" \
- X merlyn.c -o merlyn
- Xttt_game: ttt_game.c ttt
- X @${CC} ${CFLAGS} -DP=putchar -DN="P(10)" -DQ="P(34)" -DF="S(&X)" \
- X -DJ=z[4] -DK=J[14] \
- X -DH="w[]={146,7,292,73,448,56,84,273,325,297,108,324,22,40,48,40,17,325}" \
- X ttt_game.c -o ttt_game
- X
- X# The upper level makefile wants to make these source files if they don't
- X# already exist.
- X#
- Xmerlyn.c: westley.c
- X rm -f merlyn.c
- X cp westley.c merlyn.c
- X chmod +w merlyn.c
- Xnextmove.c: westley.c
- X rm -f nextmove.c
- X cp westley.c nextmove.c
- X chmod +w nextmove.c
- Xttt_game.c: westley.c
- X rm -f ttt_game.c
- X cp westley.c ttt_game.c
- X chmod +w ttt_game.c
- X
- X# NOTE: some systems may need:
- X#
- X# old SYS V:
- X# cc ${CFLAGS} -o rince rince.c -lcurses
- X#
- X# The original source is found in rince.orig.c. Many ANSI compilers have
- X# problems with it, so by default we use rince_ansi.c.
- X#
- X# GNU CC users can compile this with:
- X#
- X# gcc -ansi rince.orig.c -o rince -lcurses -ltermcap
- X#
- Xrince: rince.c
- X ${CC} ${CFLAGS} rince_ansi.c -o rince -lcurses -ltermcap
- X
- Xclean:
- X ${RM} -f *.o a.out core merlyn new_merlyn.c
- Xclobber: clean
- X ${RM} -f ${WINNERS} a.c a.out davidguy.orig ttt
- X ${RM} -f merlyn merlyn.c nextmove.c nextmove.c
- X ${RM} -f ttt_game ttt_game.c ttt_old.c ttt_new.c nextmove
- Xnuke: clobber
- X @true
- Xinstall: all
- X cat ${WINNERS} > /dev/null
- SHAR_EOF
- $TOUCH -am 0814014491 1991/ansi.mk &&
- chmod 0444 1991/ansi.mk ||
- echo "restore of 1991/ansi.mk failed"
- set `wc -c 1991/ansi.mk`;Wc_c=$1
- if test "$Wc_c" != "4069"; then
- echo original size 4069, current size $Wc_c
- fi
- # ============= 1991/common.mk ==============
- echo "x - extracting 1991/common.mk (Text)"
- sed 's/^X//' << 'SHAR_EOF' > 1991/common.mk &&
- X# %W% %G% %U%
- X#
- X# 1991 makefile
- X
- XSHELL=/bin/sh
- XCHMOD=chmod
- XCP=cp
- XRM=rm
- XSED=sed
- XLN=ln
- X
- X# flags for common K&R compiles
- X#
- XCFLAGS=-O
- XCC=cc
- X
- X# winners that may be ok to compile with common K&R
- X#
- XWINNERS= ant brnstnd buzzard cdupont davidguy dds fine westley rince
- X
- Xall: ${WINNERS}
- X
- Xansi:
- X @echo "wrong makefile, use ansi.mk"
- X exit 1
- X
- Xcommon: all
- X
- X# NOTE: some systems may need:
- X#
- X# old SYS V:
- X# cc ${CFLAGS} -DMODE=0600 -DBUF=32767 -o ant ant.c -lcurses
- X# ATARI ST:
- X# cc -DMODE=0 -DBUF=32767 -o ant.ttp ant.c curses.a
- X# PC class:
- X# wcl -mc -DMODE=0 -DBUF=32767 ant.c curses.lib
- X#
- Xant: ant.c
- X ${CC} ${CFLAGS} -DMODE=0600 -DBUF=32767 ant.c -o ant -lcurses -ltermcap
- X
- Xbrnstnd: brnstnd.c
- X ${CC} ${CFLAGS} -DM=malloc -DX=free -Do=250 brnstnd.c -o brnstnd
- X
- Xbuzzard: buzzard.c
- X ${CC} ${CFLAGS} buzzard.c -o buzzard
- X
- Xcdupont: cdupont.c
- X ${CC} ${CFLAGS} -Ds=\"cdupont.c\" -Dt=\"r\" cdupont.c -o cdupont
- X
- X# NOTE: some systems may need:
- X#
- X# ${CC} ${CFLAGS} davidguy.c -o davidguy
- X# or:
- X# ${CC} ${CFLAGS} davidguy.c -o davidguy -linet
- X#
- Xdavidguy: davidguy.c
- X ${CC} ${CFLAGS} davidguy.c -o davidguy -lsocket -lnsl
- X
- X# NOTE: this is the original program that won the contest
- X#
- X# BSD:
- X# ${CC} ${CFLAGS} davidguy.orig.c -o davidguy.orig
- X#
- Xdavidguy.orig: davidguy.orig.c
- X ${CC} ${CFLAGS} davidguy.orig.c -o davidguy.orig -lsocket -lnsl
- X
- Xdds: dds.c LANDER.BAS
- X ${CC} ${CFLAGS} dds.c -o dds
- X
- Xfine: fine.c
- X ${CC} ${CFLAGS} fine.c -o fine
- X
- Xwestley: westley.c ttt
- X ${CC} ${CFLAGS} -DP=putchar -DN="P(10)" -DQ="P(34)" -DF="S(&X)" \
- X -DJ=z[4] -DK=J[14] \
- X -DH="w[]={146,7,292,73,448,56,84,273,325,297,108,324,22,40,48,40,17,325}" \
- X westley.c -o westley
- X
- X# the hint file gives nextmove.c as an example, provide a build rule for it
- X#
- Xnextmove: nextmove.c ttt
- X ${CC} ${CFLAGS} -DP=putchar -DN="P(10)" -DQ="P(34)" -DF="S(&X)" \
- X -DJ=z[4] -DK=J[14] \
- X -DH="w[]={146,7,292,73,448,56,84,273,325,297,108,324,22,40,48,40,17,325}" \
- X nextmove.c -o nextmove
- X
- X# the ttt script has been added by the judges to make playing westley easy
- X#
- Xttt: ttt.sh
- X rm -f ttt
- X cp ttt.sh ttt
- X chmod +x ttt
- X
- X# used by the ttt shell script when playing westley
- X#
- X# The ttt script controls what goes into merlyn.c, and how it is used.
- X# The merlyn program and source represent the best (hopefully) state that
- X# the program has evolved into thus far. The ttt_game program and source
- X# represent the current state of the game.
- X#
- Xmerlyn: merlyn.c ttt
- X @${CC} ${CFLAGS} -DP=putchar -DN="P(10)" -DQ="P(34)" -DF="S(&X)" \
- X -DJ=z[4] -DK=J[14] \
- X -DH="w[]={146,7,292,73,448,56,84,273,325,297,108,324,22,40,48,40,17,325}" \
- X merlyn.c -o merlyn
- Xttt_game: ttt_game.c ttt
- X @${CC} ${CFLAGS} -DP=putchar -DN="P(10)" -DQ="P(34)" -DF="S(&X)" \
- X -DJ=z[4] -DK=J[14] \
- X -DH="w[]={146,7,292,73,448,56,84,273,325,297,108,324,22,40,48,40,17,325}" \
- X ttt_game.c -o ttt_game
- X
- X# The upper level makefile wants to make these source files if they don't
- X# already exist.
- X#
- Xmerlyn.c: westley.c
- X rm -f merlyn.c
- X cp westley.c merlyn.c
- X chmod +w merlyn.c
- Xnextmove.c: westley.c
- X rm -f nextmove.c
- X cp westley.c nextmove.c
- X chmod +w nextmove.c
- Xttt_game.c: westley.c
- X rm -f ttt_game.c
- X cp westley.c ttt_game.c
- X chmod +w ttt_game.c
- X
- X# NOTE: some systems may need:
- X#
- X# old SYS V:
- X# cc ${CFLAGS} -o rince rince.c -lcurses
- X#
- X# The original source is found in rince.orig.c. Many ANSI compilers have
- X# problems with it, so by default we use rince_ansi.c.
- X#
- X# GNU CC users can compile this with:
- X#
- X# gcc -ansi rince.orig.c -o rince -lcurses -ltermcap
- X#
- Xrince: rince.c
- X ${CC} ${CFLAGS} rince.c -o rince -lcurses -ltermcap
- X
- Xclean:
- X ${RM} -f *.o a.out core
- Xclobber: clean
- X ${RM} -f ${WINNERS} a.c a.out davidguy.orig ttt
- X ${RM} -f merlyn merlyn.c nextmove.c nextmove.c
- X ${RM} -f ttt_game ttt_game.c ttt_old.c ttt_new.c nextmove
- Xnuke: clobber
- X @true
- Xinstall: all
- X cat ${WINNERS} > /dev/null
- SHAR_EOF
- $TOUCH -am 0814014491 1991/common.mk &&
- chmod 0444 1991/common.mk ||
- echo "restore of 1991/common.mk failed"
- set `wc -c 1991/common.mk`;Wc_c=$1
- if test "$Wc_c" != "3842"; then
- echo original size 3842, current size $Wc_c
- fi
- # ============= 1991/ant.c ==============
- echo "x - extracting 1991/ant.c (Text)"
- sed 's/^X//' << 'SHAR_EOF' > 1991/ant.c &&
- X#include <ctype.h>
- X#include <curses.h>
- X#define T isspace(*(t=Z(p)))&&
- X#define V return
- X#define _ while
- Xint d,i,j,m,n,p,q,x,y;char*c,b[BUF],*f,*g=b,*h,k[]="hjklHJKL[]tbixWRQ",*t;
- Xchar*Z(a){if(a<0)V b;V b+a+(b+a<g?0:h-g);}P(a)char*a;{V
- Xa-b-(a<h?0:h-g);}S(){p=0;}bf(){n=p=P(c);}Q(){q=1;}C(){clear();Y();}
- XG(){t=Z(p);_(t<g)*--h= *--g;_(h<t)*g++= *h++;p=P(h);}B(){_(!T b<t)--p;_(T
- Xb<t)--p;}M(a){_(b<(t=Z(--a))&&*t-'\n');V
- Xb<t?++a:0;}N(a){_((t=Z(a++))<c&&*t-'\n');V
- Xt<c?a:P(c);}A(a,j){i=0;_((t=Z(a))<c&&*t-'\n'&&i<j){i+= *t-'\t'?1:8-(i&7);++a;}V
- Xa;}L(){0<p&&--p;}R(){p<P(c)&&++p;}U(){p=A(M(M(p)-1),x);}
- XD(){p=A(N(p),x);}H(){p=M(p);}E(){p=N(p);L();}
- XJ(){m=p=M(n-1);_(0<y--)D();n=P(c);}K(){j=d;_(0<--j)m=M(m-1),U();}
- XI(){G();_((j=getch())-'\f'){if(j-'\b')g-h&&(*g++=j-'\r'?j:'\n');else
- Xb<g&&--g;p=P(h);Y();}}X(){G();p=h<c?P(++h):p;}
- XF(){j=p;p=0;G();write(i=creat(f,MODE),h,(int)(c-h));close(i);p=j;}W(){_(!T
- Xt<c)++p;_(T
- Xt<c)++p;}int(*z[])()={L,D,U,R,B,J,K,W,H,E,S,bf,I,X,F,C,Q,G};
- XY(){m=p<m?M(p):m;if(n<=p){m=N(p);i=m-P(c)?d:d-2;_(0<i--)m=M(m-1);}
- Xmove(0,0);i=j=0;n=m;_(1){p-n||(y=i,x=j);t=Z(n);if(d<=i||c<=t)break;
- Xif(*t-'\r')addch(*t),j+= *t-'\t'?1:8-(j&7);if(*t=='\n'||COLS<=j)
- X++i,j=0;++n;}clrtobot();++i<d&&mvaddstr(i,0,"<< EOF >>");move(y,x);
- Xrefresh();}main(u,v)char**v;{h=c=b+BUF;if(u<2)V
- X2;initscr();d=LINES;raw();noecho();idlok(stdscr,1);if(0<(i=open(f= *++v,0))){
- Xg+=read(i,b,BUF);g=g<b?b:g;close(i);}S();_(!q){Y();i=0;j=getch();
- X_(k[i]&&j-k[i])++i;(*z[i])();}endwin();V 0;}
- SHAR_EOF
- $TOUCH -am 0807142291 1991/ant.c &&
- chmod 0444 1991/ant.c ||
- echo "restore of 1991/ant.c failed"
- set `wc -c 1991/ant.c`;Wc_c=$1
- if test "$Wc_c" != "1478"; then
- echo original size 1478, current size $Wc_c
- fi
- # ============= 1991/rince_ansi.c ==============
- echo "x - extracting 1991/rince_ansi.c (Text)"
- sed 's/^X//' << 'SHAR_EOF' > 1991/rince_ansi.c &&
- X#include <curses.h>
- Xint u=484,X[]={-1,0,0,1},Y[]={0,1,-1,0},x,y,D,i,j,a;
- Xchar o,m,*t,*O="MNOH",*k="hjkl",*s="######\0######\0######\0 \0 \0 \0 ___ \0 / \\\0 \\___/\0 ___ \0 /@@@\\\0 \\@@@/\0| | /\\\0----||\0 \\/\0 /--\\\0 \\/ \0 ==| \0 ==| \0 /\\ \0 \\--/\0 /O__o\0 \\___/\0 /_\\_ \0 << \0 << \0 << \0 \0vvvvvv\0 \0 \0^^^^^^\0 \0 /\\ \0 < > \0 \\/ \0o__O\\ \0\\___/ \0 _/_\\ \0 O__O \0/----\\\0_/ \\_\0 ^__^ \0/----\\\0_/ \\_" ,
- XM[12][22]={"AAAAAAAAAAAAAAAAAAAAAA" ,"ALCABBBBBBBABBCBBCABBA", "ACCABAKAAABAFBABABAEBA", "ABBBBABBIBBBBBEEABACLA", "ACCBNIBBAAAAGALBBBABCA", "AAAAAAAJACBABBCABAABCA", "ALLAACCBACBAAALLCABBBA", "ABDLAAABABCAAAALCABBLA", "ABCBIBBBBBBBBAAAAACBBA", "ABCCAABBADBBBBDBDBDBCA", "ALBBACCCCDBCABBBDBBBBA", "AAAAAAAAAAAAAAAAAAAAAA" };main(){initscr();clear();
- Xnoecho();cbreak();x=y=4;D=39,o='M';m=M[y][x] ;while(D&&u){for(i=j=a=0;j<7;!(mvaddstr(
- Xj*3+a,i*6,s+(((M[((y-1)/5)*5+j][((x-1)/10)*10+i]-'A')*3+a++)*7)),a^3)&&(a=0,!
- X(++i^12))&&(a=i=0,j++));refresh();M[y][x] ='B';if(t=(char*)strchr(k,getch())){int e=
- Xx,g=y,f=x,h=y,d=t-k;o=O[d];f=(e=x+X[d])+X[d];h=(g=y+Y[d])+Y[d];switch(M[g][e] ){case
- X'B':x=e;y=g,u--;break ;case 'C':if(M[h][f] =='B')M[h][f] =M[g][e] ,x=e,y=g,u--; else if(M[h][f] =='C')M[h][f] =M[g][e] ='L';break ;case 'D':if(M[h][f] =='B')M[h][f] =M[g][e] ,x=e,y=g,u--; break ;case'L':x=e;y=g,u--;D
- X--;break ;case 'E':if(M[h][f] =='B')M[h][f] =M[g][e] ,x=e,y=g,u--; else if(M[h][f] =='I'&&d==0)M[h][f] =M[g][e] ='B';break ; case 'F':if(M[h][f] =='B')M[h][f] =M[g][e] ,x=e,y=g,u--; else if(M[h][f] =='J'&&d==1)M[h][f] =M[g][e] ='B';break ; case 'G':if(M[h][f] =='B')M[h][f] =M[g][e] ,x=e,y=g,u--; else if(M[h][f] =='K'&&d==2)M[h][f] =M[g][e] ='B';break ; }}m=M[y][x] ;M[y][x] =o;}clear();mvaddstr(12
- X,31,u?"Well done!":"Too many moves");move(23,0);refresh();endwin();return 0;}
- X
- SHAR_EOF
- $TOUCH -am 0528170091 1991/rince_ansi.c &&
- chmod 0444 1991/rince_ansi.c ||
- echo "restore of 1991/rince_ansi.c failed"
- set `wc -c 1991/rince_ansi.c`;Wc_c=$1
- if test "$Wc_c" != "1872"; then
- echo original size 1872, current size $Wc_c
- fi
- # ============= 1991/rince.orig.c ==============
- echo "x - extracting 1991/rince.orig.c (Text)"
- sed 's/^X//' << 'SHAR_EOF' > 1991/rince.orig.c &&
- X#include <curses.h>
- X#define R break
- X#define U M[h][f]
- X#define W M[g][e]
- X#define T M[y][x]
- X#define B(a) "A"#a"A",
- X#define A "AAAAAAAAAAAAAAAAAAAAAA"
- X#define z(a) case a:if(U=='B')U=W,x=e,y=g,u--;
- X#define Z(a,b) else if(U==a&&d==b)U=W='B';R;
- X#define K(a) a##a##a
- X#define k(a) #a#a#a#a#a#a"\0"
- X#define V " \0"
- X#define S " \0/----\\\0_/ \\_"
- Xint u=484,X[]={-1,0,0,1},Y[]={0,1,-1,0},x,y,D,i,j,a;char o,m,*t,*O="MNOH"
- X,*k="hjkl",*s=K(k(#))V V V" ___ \0 / \\\0 \\___/\0 ___ \0 /@@@\\\0 "
- X"\\@@@/\0| | /\\\0----||\0 \\/\0 /--\\\0 \\/ \0 ==| \0 ==| \0 "
- X" /\\ \0 \\--/\0 /O__o\0 \\___/\0 /_\\_ \0"K(" << \0")V k(v)V V k(^)V
- X" /\\ \0 < > \0 \\/ \0o__O\\ \0\\___/ \0 _/_\\ \0 O__O"S"\0 ^__^"S,
- XM[12][22]={A,B(LCABBBBBBBABBCBBCABB)B(CCABAKAAABAFBABABAEB
- X)B(BBBBABBIBBBBBEEABACL)B(CCBNIBBAAAAGALBBBABC)B(AAAAAAJACBABBCABAABC
- X)B(LLAACCBACBAAALLCABBB)B(BDLAAABABCAAAALCABBL)B(BCBIBBBBBBBBAAAAACBB
- X)B(BCCAABBADBBBBDBDBDBC)B(LBBACCCCDBCABBBDBBBB)A};main(){initscr();clear();
- Xnoecho();cbreak();x=y=4;D=39,o='M';m=T;while(D&&u){for(i=j=a=0;j<7;!(mvaddstr(
- Xj*3+a,i*6,s+(((M[((y-1)/5)*5+j][((x-1)/10)*10+i]-'A')*3+a++)*7)),a^3)&&(a=0,!
- X(++i^12))&&(a=i=0,j++));refresh();T='B';if(t=(char*)strchr(k,getch())){int e=
- Xx,g=y,f=x,h=y,d=t-k;o=O[d];f=(e=x+X[d])+d[X];h=(g=y+Y[d])+d[Y];switch(W){case
- X'B':x=e;y=g,u--;R;z('C')else if(U=='C')U=W='L';R;z('D')R;case'L':x=e;y=g,u--;D
- X--;R;z('E')Z('I',0)z('F')Z('J',1)z('G')Z('K',2)}}m=T;T=o;}clear();mvaddstr(12
- X,31,u?"Well done!":"Too many moves");move(23,0);refresh();endwin();return 0;}
- X
- SHAR_EOF
- $TOUCH -am 0527202891 1991/rince.orig.c &&
- chmod 0444 1991/rince.orig.c ||
- echo "restore of 1991/rince.orig.c failed"
- set `wc -c 1991/rince.orig.c`;Wc_c=$1
- if test "$Wc_c" != "1534"; then
- echo original size 1534, current size $Wc_c
- fi
- # ============= 1991/sorta.README ==============
- echo "x - extracting 1991/sorta.README (Text)"
- sed 's/^X//' << 'SHAR_EOF' > 1991/sorta.README &&
- XThe 'sorta' scripts described below can sorta be found in this directory.
- X
- Xsorta.i2+2
- X----------
- X
- X 2 2+#` [ about as basic as you can get ]ld
- X
- XThis script takes 2, adds 2 to it, and prints the result (with a
- Xnewline). I get 5 on the hand-held Sinclair under ZYNIX. Let me know if
- Xyour machine produces a different result so that I can send you patches.
- X
- X
- Xsorta.iarg0
- X-----------
- X
- X 0A` [ take arg 0, print it ]
- X
- XThis is self-explanatory.
- X
- X
- Xsorta.icalc
- X-----------
- X
- X
- X [D2sD3s]:Dld [ input m n, output m n m n ]ld
- X
- X [2*1=d]:cld [ aux routine for :d recursion ]ld
- X [1=D1s>1Ds_+=c]:dld [ input m n, as long as n <= m double it, output m n ]ld
- X
- X [D2s1s_+1s]:-ld [ input m n, output m-n n ]ld
- X [1=D1s>1Ds_+#T=-2/D=1]:1ld [ aux routine for :@ ]ld
- X [1D=d2/1=1ddd1 ]:!ld
- X ["0"Td]:0ld
- X [DD=!1_+=0]:@ld [ input m, m assumed nonnegative, append
- X binary representation of m to top of s stack ]ld
- X
- X ["-"T_]:+ld
- X [D0 1s>=+1=@]:2ld [ input m, append - to top of s stack if m is negative,
- X then append binary representation of abs(m) to
- X top of s stack ]ld
- X
- X [d1A:A2=A]:A 27182 a1>=A
- X [d2A:A1=A]:A 3145 a2>=A
- X
- X D # " in binary is "T 1=2 `ld
- X 1=Dd # " in binary is "T 1=2 `ld
- X
- X 1=D 1s# " + "T 1s#T " is "T + #Td `ld
- X 1=D 1s# " - "T 1s#T " is "T _+ #Td `ld
- X 1=D 1s# " * "T 1s#T " is "T * #Td `ld
- X 1=D 1s# " / "T 1s#T " is "T / #Td `ld
- X 1=D 1s# " % "T 1s#T " is "T 1=D/*_+ #Td `ld
- X
- X 1=D d "~ " #T " is "T D& #T$ld " (" 1=2 ")"T `ld
- X 1=D 1s# " & "T 1s#T " is "T &D& #T$ld " (" 1=2 ")"T `ld
- X 1=D 1s# " | "T 1s#T " is "T D&1sD&& #T$ld " (" 1=2 ")"T `ld
- X 1=D 1s# " ^ "T 1s#T " is "T 1=D&2sD&1sD&&&D& #T$ld " (" 1=2 ")"T `ld
- X
- Xicalc shows off SORTA's understanding of integer arithmetic. You can run
- Xit with up to two arguments; the arguments have default values of 27182
- Xand 3145. Notice that sorta doesn't have a language primitive for
- Xconverting a string to a number, yet icalc is performing arithmetic on
- Xits arguments. Can you see how? (Hint: Try sorta "2 2+" 3 < sorta.icalc.
- XLook at program A.) icalc also provides a useful binary output routine,
- Xand if you can't remember offhand that D2sD3s&2sD&1sD&&&D& means xor,
- Xyou can just look it up here.
- X
- X
- Xsorta.idup
- X-----------
- X
- X [ld#1_+1=y]:x
- X [uD1+=x]:y
- X 0""1=y`
- X
- XThis script prints out the maximum file descriptor available from
- Xrepeated dup()s---usually NOFILE - 1. Can you see how it works?
- X
- X
- Xsorta.iecho
- X-----------
- X
- X [" "$ld]:sld [ print a space ]ld
- X [1s1+DA$ld1s1_+D=sD=x]:xld [ given n (argc-n), print args ]ld
- X 0a1_+D=x""` [ simulation of /bin/echo ]ld
- X
- XThis is a clone of /bin/echo, minus any argument processing and escape
- Xinterpretation. (Note that, unlike some shells' echo, /bin/echo prints a
- Xnewline even with no arguments.) Try sorta foo bar < iecho.
- X
- X
- Xsorta.ifact1
- X------------
- X
- X 1#`ld2*#`ld3*#`ld4*#`ld5*#`ld6*#`ld7*#`ld8*#`ld9*#`ld10*#`ld
- X
- XThis is a very straightforward factorial program: Take 1, print it,
- Xmultiply by 2, print it, multiply by 3, print it, etc.
- X
- X
- Xsorta.ifact2
- X------------
- X
- X [1+D2s*#`ld1s]:f
- X 1 0
- X 1=f 1=f 1=f 1=f 1=f 1=f 1=f 1=f 1=f 1=f
- X
- Xifact1 does a lot of repeated work. ifact2 takes advantage of this by
- Xkeeping the current n! n on the stack. Each call to routine f (1=f)
- Xincrements n by 1 and prints out the factorial.
- X
- X
- Xsorta.ifact3
- X------------
- X
- X [1+D2s*#`ld1s]:f [ given (n-1)! (n-1), print n!, put n! n ]
- X [2s1=f2s1_+D0>=x]:x [ given n n! x, print (n+1)! through (n+x)! ]
- X 0 1 10 1=x
- X
- XFinally, ifact3 removes all the redundancy from ifact2, and exhibits
- Xproper documentation of stack routines. You can replace the 10 by
- Xanything in this version.
- X
- X
- Xsorta.iio
- X---------
- X
- X [ a simple example of interpreting code on the fly ]ld
- X
- X ["] "2 2+":xT ["]T " produces "T 1=x#T " which should be 4."T`
- X
- XNotice that "2 2+" is a literal string inside the program.
- X
- X
- Xsorta.irot13
- X------------
- X
- X "[] [.tr] "
- X ["]".[a-m][n-z][A-M][N-Z]"[" ]TTT ["]".[n-z][a-m][N-Z][A-M]"[" ]TTT
- X "[tr] !q"T:xld
- X ["rot13: fatal: need exactly one argument"`q]:gld
- X ["rot13: fatal: cannot open "1ST`q]:hld
- X a2_+=g
- X 1A 0 [ that 0 is for RDONLY ]ld
- X 0 'o D0 1s>=hld
- X 0Ou1=x [ in a more complex spawner, this would be done under a fork ]ld
- X
- XDespite its name, irot13 is meant to show how to exec a program with
- Xredirection from within sorta. You run it as sorta blah < irot13; it
- Xopens blah and runs a (BSD-style) tr command to rotate all letters by 13
- Xspots. 1A 0 0 o opens argv[1]; the ' keeps the filename around for
- Xsubroutine h to print a nice error message if necessary. 0Ou closes
- Xstdout and replaces it with the new descriptor. Finally, subroutine x
- Xexecutes the tr.
- X
- X
- Xsorta.isleep
- X------------
- X
- X ["" "+sleep" "+5" "sleep" !q]:S [F0>1_+=S]:s
- X "forking sleep 5..."`ld
- X 1=s
- X "waiting for sleep to finish..."`ld
- X w
- X "done, sleep exit code " #T`
- X
- XThis script illustrates the classic fork-exec-wait.
- X
- X
- Xsorta.itailrec
- X--------------
- X
- X [3*#" "T$ldD=f]:f
- X 1=f
- X
- XThe sole purpose of this script is to prove that sorta can do infinite
- Xtail recursion (in this case, in program f). Do sorta < itailrec | more
- Xand watch the powers of 3 (mod your computer's word size) flow by.
- X
- X
- Xsorta.iwhosort
- X--------------
- X
- X [0Ou "" "+-u" "sort" !q]:S [F0>1_+=S]:s
- X [1Ou "" "+-u" "who" !q]:W [F0>1_+=W]:w
- X P1=wO1=sOww
- X
- XThis final example is a simple pipeline, who | sort.
- SHAR_EOF
- $TOUCH -am 0807143691 1991/sorta.README &&
- chmod 0444 1991/sorta.README ||
- echo "restore of 1991/sorta.README failed"
- set `wc -c 1991/sorta.README`;Wc_c=$1
- if test "$Wc_c" != "5503"; then
- echo original size 5503, current size $Wc_c
- fi
- # ============= 1991/sorta.i2+2 ==============
- echo "x - extracting 1991/sorta.i2+2 (Text)"
- sed 's/^X//' << 'SHAR_EOF' > 1991/sorta.i2+2 &&
- X2 2+#` [ about as basic as you can get ]ld
- SHAR_EOF
- $TOUCH -am 0622130991 1991/sorta.i2+2 &&
- chmod 0444 1991/sorta.i2+2 ||
- echo "restore of 1991/sorta.i2+2 failed"
- set `wc -c 1991/sorta.i2+2`;Wc_c=$1
- if test "$Wc_c" != "54"; then
- echo original size 54, current size $Wc_c
- fi
- # ============= 1991/sorta.iarg0 ==============
- echo "x - extracting 1991/sorta.iarg0 (Text)"
- sed 's/^X//' << 'SHAR_EOF' > 1991/sorta.iarg0 &&
- X0A` [ take arg 0, print it ]
- SHAR_EOF
- $TOUCH -am 0622130991 1991/sorta.iarg0 &&
- chmod 0444 1991/sorta.iarg0 ||
- echo "restore of 1991/sorta.iarg0 failed"
- set `wc -c 1991/sorta.iarg0`;Wc_c=$1
- if test "$Wc_c" != "39"; then
- echo original size 39, current size $Wc_c
- fi
- # ============= 1991/dds.c ==============
- echo "x - extracting 1991/dds.c (Text)"
- sed 's/^X//' << 'SHAR_EOF' > 1991/dds.c &&
- X#include <stdio.h>
- X#define Q r=R[*p++-'0'];while(
- X#define B ;break;case
- Xchar*s="Qjou!s\\311^-g\\311^-n\\311^-c\\::^-q-ma%mO1JBHm%BQ-aP1J[O1HB%[Q<nbj\
- Xo)*|gps)<<*txjudi)m*|aQdbtf!::::;sfuvso<aQefgbvmu;aQ<m,,a%CQ<csfbla%bQ<aN2!Q\
- X\ndbtf!aP2Q;m>aP2Q<a%!D12J!JGJHJOJQJFJSJJJMHS%HD12D12N3!N4\nJUJT%UQm>aP4HC%T\
- XQs\\q,,^>m,2<m>aP4HC%SD12N1\nJNQm>s\\..q^aHC%NHb%GN1!D32P3%RN1UP1D12JPQUaP1H\
- XR%PN4\nQ<g\\(aP3Q(^>aP2Q,2<n\\(aP3Q(^>aP4Hb%OD12D12N2!N3\nJVP3Q,,<jg)aP3Q=>n\
- X\\(aP3Q(^*m>g\\(aP3Q(^<fmtf!m,,aHC%QN1!N1\nJ#Qqsjoug)#&e]o#-aP1Q*aHb%#Qqvut)\
- XaP1Q*aHb%FN1\nQm>::::aHC%VP3Q>bupj)hfut)c**aHb%JD12JON1!Qjg)a%LN1UP1D12JIQUa\
- XP1HL%IQ*m>aN2!N2\nP2Q<fmtf!m,,aHC%MN1!N2>P2Q>aN2\nP2Hbdd!b/d";k;char R[4][99]
- X;main(c,v)char**v;{char*p,*r,*q;for(q=s;*q;q++)*q>' '&&(*q)--;{FILE*i=fopen(v
- X[1],"r"),*o=fopen(q-3,"w");for(p=s;;p++)switch(*p++){B'M':Q(k=fgetc(i))!=EOF
- X&&k!=*p)*r++=k;if(k==EOF){fputs("}}\n",o);fclose(o);return system(q-6);}*r=0
- XB'P':while(*p!='`')fputc(*p++,o)B'O':Q*r)fputc(*r++,o);p--B'C':k=0;Q k<*p-'0'
- X)(*r++=fgetc(i),k++);*r=0 B'I':k= *p;if(**R==k)goto G B'G':k= *p;G:p=s;while(
- X*p!='$'||p[1]!= k)p++;p++B'N':R[*p-'0'][0]++;}}}
- SHAR_EOF
- $TOUCH -am 0807155091 1991/dds.c &&
- chmod 0444 1991/dds.c ||
- echo "restore of 1991/dds.c failed"
- set `wc -c 1991/dds.c`;Wc_c=$1
- if test "$Wc_c" != "1133"; then
- echo original size 1133, current size $Wc_c
- fi
- # ============= 1991/westley.c ==============
- echo "x - extracting 1991/westley.c (Text)"
- sed 's/^X//' << 'SHAR_EOF' > 1991/westley.c &&
- X a(X){/*/X=- a(X){/*/X=-
- X -1;F;X=- -1;F;X=-
- X -1;F;}/*/ -1;F;}/*/
- Xchar*z[]={"char*z[]={","a(X){/*/X=-","-1;F;X=-","-1;F;}/*/","9999999999 :-| ",
- X"int q,i,j,k,X,O=0,H;S(x)int*x;{X+=X;O+=O;*x+1?*x+2||X++:O++;*x=1;}L(n){for(*",
- X"z[i=1]=n+97;i<4;i++)M(256),s(i),M(128),s(i),M(64),N;X*=8;O*=8;}s(R){char*r=z",
- X"[R];for(q&&Q;*r;)P(*r++);q&&(Q,P(44));}M(m){P(9);i-2||P(X&m?88:O&m?48:32);P(",
- X"9);}y(A){for(j=8;j;)~A&w[--j]||(q=0);}e(W,Z){for(i-=i*q;i<9&&q;)y(W|(1<<i++&",
- X"~Z));}R(){for(k=J[*J-48]-40;k;)e(w[k--],X|O);}main(u,v)char**v;{a(q=1);b(1);",
- X"c(1);*J=--u?O?*J:*v[1]:53;X|=u<<57-*v[u];y(X);K=40+q;q?e(O,X),q&&(K='|'),e(X",
- X",O),R(),O|=1<<--i:J[*J-48+(X=O=0)]--;L(q=0);for(s(i=0);q=i<12;)s(i++),i>4&&N",
- X";s(q=12);P(48);P('}');P(59);N;q=0;L(1);for(i=5;i<13;)s(i++),N;L(2);}",0};
- X b(X){/*/X=- b(X){/*/X=-
- X -1;F;X=- -1;F;X=-
- X -1;F;}/*/ -1;F;}/*/
- Xint q,i,j,k,X,O=0,H;S(x)int*x;{X+=X;O+=O;*x+1?*x+2||X++:O++;*x=1;}L(n){for(*
- Xz[i=1]=n+97;i<4;i++)M(256),s(i),M(128),s(i),M(64),N;X*=8;O*=8;}s(R){char*r=z
- X[R];for(q&&Q;*r;)P(*r++);q&&(Q,P(44));}M(m){P(9);i-2||P(X&m?88:O&m?48:32);P(
- X9);}y(A){for(j=8;j;)~A&w[--j]||(q=0);}e(W,Z){for(i-=i*q;i<9&&q;)y(W|(1<<i++&
- X~Z));}R(){for(k=J[*J-48]-40;k;)e(w[k--],X|O);}main(u,v)char**v;{a(q=1);b(1);
- Xc(1);*J=--u?O?*J:*v[1]:53;X|=u<<57-*v[u];y(X);K=40+q;q?e(O,X),q&&(K='|'),e(X
- X,O),R(),O|=1<<--i:J[*J-48+(X=O=0)]--;L(q=0);for(s(i=0);q=i<12;)s(i++),i>4&&N
- X;s(q=12);P(48);P('}');P(59);N;q=0;L(1);for(i=5;i<13;)s(i++),N;L(2);}
- X c(X){/*/X=- c(X){/*/X=-
- X -1;F;X=- -1;F;X=-
- X -1;F;}/*/ -1;F;}/*/
- SHAR_EOF
- $TOUCH -am 0807160491 1991/westley.c &&
- chmod 0444 1991/westley.c ||
- echo "restore of 1991/westley.c failed"
- set `wc -c 1991/westley.c`;Wc_c=$1
- if test "$Wc_c" != "1536"; then
- echo original size 1536, current size $Wc_c
- fi
- # ============= 1991/rince.c ==============
- echo "x - extracting 1991/rince.c (Text)"
- sed 's/^X//' << 'SHAR_EOF' > 1991/rince.c &&
- X#include <curses.h>
- Xint u=484,X[]={-1,0,0,1},Y[]={0,1,-1,0},x,y,D,i,j,a;
- Xchar o,m,*t,*O="MNOH",*k="hjkl",*s="######\0######\0######\0 \0 \0 \0 ___ \0 / \\\0 \\___/\0 ___ \0 /@@@\\\0 \\@@@/\0| | /\\\0----||\0 \\/\0 /--\\\0 \\/ \0 ==| \0 ==| \0 /\\ \0 \\--/\0 /O__o\0 \\___/\0 /_\\_ \0 << \0 << \0 << \0 \0vvvvvv\0 \0 \0^^^^^^\0 \0 /\\ \0 < > \0 \\/ \0o__O\\ \0\\___/ \0 _/_\\ \0 O__O \0/----\\\0_/ \\_\0 ^__^ \0/----\\\0_/ \\_" ,
- XM[12][22]={"AAAAAAAAAAAAAAAAAAAAAA" ,"ALCABBBBBBBABBCBBCABBA", "ACCABAKAAABAFBABABAEBA", "ABBBBABBIBBBBBEEABACLA", "ACCBNIBBAAAAGALBBBABCA", "AAAAAAAJACBABBCABAABCA", "ALLAACCBACBAAALLCABBBA", "ABDLAAABABCAAAALCABBLA", "ABCBIBBBBBBBBAAAAACBBA", "ABCCAABBADBBBBDBDBDBCA", "ALBBACCCCDBCABBBDBBBBA", "AAAAAAAAAAAAAAAAAAAAAA" };main(){initscr();clear();
- Xnoecho();cbreak();x=y=4;D=39,o='M';m=M[y][x] ;while(D&&u){for(i=j=a=0;j<7;!(mvaddstr(
- Xj*3+a,i*6,s+(((M[((y-1)/5)*5+j][((x-1)/10)*10+i]-'A')*3+a++)*7)),a^3)&&(a=0,!
- X(++i^12))&&(a=i=0,j++));refresh();M[y][x] ='B';if(t=(char*)strchr(k,getch())){int e=
- Xx,g=y,f=x,h=y,d=t-k;o=O[d];f=(e=x+X[d])+X[d];h=(g=y+Y[d])+Y[d];switch(M[g][e] ){case
- X'B':x=e;y=g,u--;break ;case 'C':if(M[h][f] =='B')M[h][f] =M[g][e] ,x=e,y=g,u--; else if(M[h][f] =='C')M[h][f] =M[g][e] ='L';break ;case 'D':if(M[h][f] =='B')M[h][f] =M[g][e] ,x=e,y=g,u--; break ;case'L':x=e;y=g,u--;D
- X--;break ;case 'E':if(M[h][f] =='B')M[h][f] =M[g][e] ,x=e,y=g,u--; else if(M[h][f] =='I'&&d==0)M[h][f] =M[g][e] ='B';break ; case 'F':if(M[h][f] =='B')M[h][f] =M[g][e] ,x=e,y=g,u--; else if(M[h][f] =='J'&&d==1)M[h][f] =M[g][e] ='B';break ; case 'G':if(M[h][f] =='B')M[h][f] =M[g][e] ,x=e,y=g,u--; else if(M[h][f] =='K'&&d==2)M[h][f] =M[g][e] ='B';break ; }}m=M[y][x] ;M[y][x] =o;}clear();mvaddstr(12
- X,31,u?"Well done!":"Too many moves");move(23,0);refresh();endwin();return 0;}
- X
- SHAR_EOF
- $TOUCH -am 0528165791 1991/rince.c &&
- chmod 0444 1991/rince.c ||
- echo "restore of 1991/rince.c failed"
- set `wc -c 1991/rince.c`;Wc_c=$1
- if test "$Wc_c" != "1872"; then
- echo original size 1872, current size $Wc_c
- fi
- # ============= 1991/fine.c ==============
- echo "x - extracting 1991/fine.c (Text)"
- sed 's/^X//' << 'SHAR_EOF' > 1991/fine.c &&
- Xmain(a,b){while((a=getchar())+1)putchar((b=64^a&223)&&b<27?a&96|(b+12)%26+1:a);}
- SHAR_EOF
- $TOUCH -am 0527155391 1991/fine.c &&
- chmod 0444 1991/fine.c ||
- echo "restore of 1991/fine.c failed"
- set `wc -c 1991/fine.c`;Wc_c=$1
- if test "$Wc_c" != "81"; then
- echo original size 81, current size $Wc_c
- fi
- # ============= 1991/buzzard.c ==============
- echo "x - extracting 1991/buzzard.c (Text)"
- sed 's/^X//' << 'SHAR_EOF' > 1991/buzzard.c &&
- X#include <stdio.h>
- X#define X(s) (!(s&3)-((s&3)==2))
- X#define W while
- Xchar Z[82][82],A,B,f,g=26;z(q){return atoi(q);}m(d,l){return
- XZ[ B + X ( f +
- X3) * d+l *X(f+ 2 )][ A+X ( f ) * d +
- Xl* X ( f + 3 ) ] ;}int
- Xh= 0;D(p,s)char*s; {W(h>>3<p>> 3 ) {putchar('\t'
- X); h = ( h +8
- X)&~7 ;}W(h < p ){putchar(' ');++h; }(void)printf(
- X"%s" , s ) ;h+=strlen(s);}main(x,a)char **a; {
- X# define P(x) (x?(5-(x))*(6-(x ))/2:11)
- Xint b; { char b[256],i, j=0; FILE*F;F=fopen(x-1?a[1]:"buzzard.c","r");W(
- Xfgets( b ,256 ,F)){for(i=0;b[ i];++ i)
- XZ[j][i ] =( b [ i ] ==' '?1:2*(b[i]==(x>2?*a[2]:'\\')));++j;}fclose
- X(F);}A =4 ; B = 3 ; f = 1;x >3? A=z(a[3]),B=z(a[4]):0;b='\n';do{if(b=='\n'
- X){int y , s , d , p , q ,i;for
- X(y=-11; y<= 11;++ y){ for(s = 1 ,d=0;s+3;s-=2){for
- X(;d!=2 + 3 * s ; d+=s){
- Xif(m(d,0) !=1 ){p=P (d) ;if (abs( y )
- X <p&& ! m ( d , 0 )||abs(y)>p)break;for
- X(i =-p;i<p;++i)D(g+i*2,"--");D(0,"\-");break;}if(d==5)continue;
- Xp=P(d+1);q=P(d);if
- X(abs(y) >q)continue;if
- X(abs(y) <p)D(g-s*(2*p+1),"|");else if(m(d,s)){if
- X(abs(y) <=p)for(i=(s==1?-q:p);i!=(s==1?-p:q);
- X(abs(y) ),++i)D(g+2*i+(s==-1),"--");}else if
- X(abs(y) ==p)D(g-s*(2*p+1),"|");else D(g-
- X(abs(y) *s*2),(s==1)^(y>0)?"\\":"/");}d-=s;}puts(
- X"");h=0;}}f+=(b=='r')-(b=='l');f&=3;if(b=='f'){if(!m(1,0))continue;
- XA+=X(f);B+=X(f-1);}}W((b=getchar())!=-1&&m(0,0)==1);return 0;}
- SHAR_EOF
- $TOUCH -am 0807151891 1991/buzzard.c &&
- chmod 0444 1991/buzzard.c ||
- echo "restore of 1991/buzzard.c failed"
- set `wc -c 1991/buzzard.c`;Wc_c=$1
- if test "$Wc_c" != "1472"; then
- echo original size 1472, current size $Wc_c
- fi
- # ============= 1991/cdupont.c ==============
- echo "x - extracting 1991/cdupont.c (Text)"
- sed 's/^X//' << 'SHAR_EOF' > 1991/cdupont.c &&
- X /* common sense to nohonest programmer */
- X#include <stdio.h>
- Xmain(){int x ,gi=4,i,f,ri=1,httxkbl=1,m=012;long cd=0x5765248d,n;
- X char u[0x50][032];FILE *ind;
- X ind=fopen(s,t); for(i=0; i<0x1a; i++){goto daswjhkls;vhjsgfdy1l1gjhd:;}
- X/*borntorun.*/goto c0g0;cOgO:i=0;fclose(ind);c0gO:
- Xx= u [gi][m]; sorryfor_this_unused_but_very_needed_label:
- X if( m==gi){x=0x70;f=0x68;}else goto cOg0 ; b:putchar(x); if(
- X!(n-httxkbl++))
- X#define yank putchar('
- X {httxkbl=1; yank ');goto
- X hxi;}goto bl;
- X /* hardlyundrstandable, but
- Xlikely to be missed if removed */
- X daswjhkls: fgets(u[i], 0120, ind);
- X /*obfuscated, eh? */goto
- X vhjsgfdy1l1gjhd;
- X c0g0 : n=cd&0x40000000L>>0x1e;
- X goto cOgO; g6w:
- X if(x!=0x2e){i++;goto c0gO;}else /*
- Xinjail*/yank\n');goto vhjsgfdyl1lgjhd;
- XcOg0 :
- Xf=u[m][gi];goto b;bl:m=(i+1)*(4*
- Xx+3*f)%032;gi=(i+1)*(x+2*f)%0x1a; goto g6w;
- X hxi:cd^= n= cd&(7<<3*(014-++ri));
- Xn >>=3*(12-ri); goto bl;vhjsgfdyl1lgjhd:;}
- SHAR_EOF
- $TOUCH -am 0608020091 1991/cdupont.c &&
- chmod 0444 1991/cdupont.c ||
- echo "restore of 1991/cdupont.c failed"
- set `wc -c 1991/cdupont.c`;Wc_c=$1
- if test "$Wc_c" != "1001"; then
- echo original size 1001, current size $Wc_c
- fi
- # ============= 1991/davidguy.c ==============
- echo "x - extracting 1991/davidguy.c (Text)"
- sed 's/^X//' << 'SHAR_EOF' > 1991/davidguy.c &&
- X#define u unsigned
- X#define w char*
- X#define j(x)(*(*(x*)&T)++)
- X#define H j(short*)
- X#define K j(w)
- X#define e j(u*)
- X#define r register u
- X#define R(b)write(A,T=h,4*b);
- X#define S (u*)sbrk(Q*4+U*8)+U
- X#define E(a,b,c)a=c&1<<31|b/2;c=c*2|b&1;
- X#define V q=h^*L;L+=F;E(d,q,x)E(f,d,s)g=f&q;f^=q
- X#define W while(
- X#define Z q=I&f;M|=q&c;c^=q;I^=f;M|=g&c;c^=g
- X#define Y W(F= *s++-'0')<=9)*T=10**T+F;K
- X#define D(q,s)c);W q>s)G= *--q,*q= *s,*s++=G;
- X#define P if(i^z){x=Q+(n=D(x,n)
- X#define C if(i){q=Q*4+(s=(w)D(q,s)
- Xu A,U,Q,J,X[9999],B;main(a,b)w*b;{r*c,*d,y=0,f,g,F,I,M,N,z,*x,*n,i,G;w q,*h=(w
- X)X,*T,*s=".slo.-W00,tmhw.W/";T=h;if(a>1){e;s=b[1];Y;Y;Y;Y;T=h;H;K=23;Y+=112;T=
- Xh;Y;y= *--T;H=2;}else{H=1;W*s)K=1+*s++;}connect(A=socket(a,1,0),T=h,24-a*4);H=
- X17004;H=11;e=0;e=0;i=66==*h;R(3)read(A,h,8);e;H;read(A,h,4*H);T=h;e;F=e;e;e;I=
- X11+H;f=H-6;K;U=K;i^=K;z=!K;T+=I/4*4+8*U;W y--){T+=39;I=K;W I--)H,T+=4+24*H;}I=
- Xe;e;B=(!e^**b&1)-1;e;e;U=H/32;J=H/30*30;T+=14;M=K;f/=U;T=h;K=55;K;H=4;e=F;e=I;
- Xe=0;R(4)N=F+8192;K=53;K=M;H=4;e=N;e=I;H=U*32;H=J;R(4)K=2;K;H=4;e=I;e=1;e=N;R(4
- X)Q=J*U;c=S;d=S;L(c);W 1){P}C}y=0;W y<J){K=72;K=0;g=J-y;H=6+U*(g>f?g=f:g);e=N;e
- X=F;H=U*32;H=g;H=0;H=y;K=0;K=1;R(6)write(A,c+y*U,g*U*4);y+=g;}K=61;K=0;H=4;e=I;
- Xe=0;e=0;R(4)C}P}v(c,d);}}L(A)r*A;{r*T=A+Q,X=getpid();W A<T)*A++=X=3*X^X/2;}v(n
- X,O)u*n,*O;{r*A,F=U,*L=n-F,*G=L+Q,I,c,d,M,f,g,N,q,i=0,X,T,v,s,x,*y,*z,h=B;W L<n
- X){*L= *G;G++[F]=L++[F];}W i<J){z=O+i*F;y=n+i*F-F;i+=30;L=y-1;A=L+U*32;W L<A){L
- X+=F;E(X,(*L^h),x)E(q,X,s)}X=0;W X++<F){L=y++;G=z++;V;c=g|f&d;I=f^d;V;W L<=A){M
- X=0;Z;N=d;T=f;v=g;V;Z;c^=I&d;*G=h^c&~M&(I^d|N);G+=F;c=v|T&N;I=T^N;}}}z=O;y=n;I=
- XJ;W--I!=-1){f= *z>>31;G=z+F;L=y+F;W G>z){M= *--G;*--L=(M*2)+f;f=M>>31;}z+=F;y+
- X=F;}}
- SHAR_EOF
- $TOUCH -am 0807152691 1991/davidguy.c &&
- chmod 0444 1991/davidguy.c ||
- echo "restore of 1991/davidguy.c failed"
- set `wc -c 1991/davidguy.c`;Wc_c=$1
- if test "$Wc_c" != "1691"; then
- echo original size 1691, current size $Wc_c
- fi
- # ============= 1991/dds.ansi.c ==============
- echo "x - extracting 1991/dds.ansi.c (Text)"
- sed 's/^X//' << 'SHAR_EOF' > 1991/dds.ansi.c &&
- X#include <stdio.h>
- X#define Q r=R[*p++-'0'];while(
- X#define B ;break;case
- Xchar*s="Qjou!s\\311^-g\\311^-n\\311^-c\\::^-q-ma%mO1JBHm%BQ-aP1J[O1HB%[Q<nbj\
- Xo)*|gps)<<*txjudi)m*|aQdbtf!::::;sfuvso<aQefgbvmu;aQ<m,,a%CQ<csfbla%bQ<aN2!Q\
- X\ndbtf!aP2Q;m>aP2Q<a%!D12J!JGJHJOJQJFJSJJJMHS%HD12D12N3!N4\nJUJT%UQm>aP4HC%T\
- XQs\\q,,^>m,2<m>aP4HC%SD12N1\nJNQm>s\\..q^aHC%NHb%GN1!D32P3%RN1UP1D12JPQUaP1H\
- XR%PN4\nQ<g\\(aP3Q(^>aP2Q,2<n\\(aP3Q(^>aP4Hb%OD12D12N2!N3\nJVP3Q,,<jg)aP3Q=>n\
- X\\(aP3Q(^*m>g\\(aP3Q(^<fmtf!m,,aHC%QN1!N1\nJ#Qqsjoug)#&e]o#-aP1Q*aHb%#Qqvut)\
- XaP1Q*aHb%FN1\nQm>::::aHC%VP3Q>bupj)hfut)c**aHb%JD12JON1!Qjg)a%LN1UP1D12JIQUa\
- XP1HL%IQ*m>aN2!N2\nP2Q<fmtf!m,,aHC%MN1!N2>P2Q>aN2\nP2Hbdd!b/d";int k;char R[4][99]
- X;main(c,v)char**v;{char*p,*r,*q;for(q=s;*q;q++)*q>' '&&(*q)--;{FILE*i=fopen(v
- X[1],"r"),*o=fopen(q-3,"w");for(p=s;;p++)switch(*p++){B'M':Q(k=fgetc(i))!=EOF
- X&&k!=*p)*r++=k;if(k==EOF){fputs("}}\n",o);fclose(o);return system(q-6);}*r=0
- XB'P':while(*p!='`')fputc(*p++,o)B'O':Q*r)fputc(*r++,o);p--B'C':k=0;Q k<*p-'0'
- X)(*r++=fgetc(i),k++);*r=0 B'I':k= *p;if(**R==k)goto G B'G':k= *p;G:p=s;while(
- X*p!='$'||p[1]!= k)p++;p++B'N':R[*p-'0'][0]++;}}}
- SHAR_EOF
- $TOUCH -am 0807162791 1991/dds.ansi.c &&
- chmod 0444 1991/dds.ansi.c ||
- echo "restore of 1991/dds.ansi.c failed"
- set `wc -c 1991/dds.ansi.c`;Wc_c=$1
- if test "$Wc_c" != "1137"; then
- echo original size 1137, current size $Wc_c
- fi
- # ============= 1991/davidguy.orig.c ==============
- echo "x - extracting 1991/davidguy.orig.c (Text)"
- sed 's/^X//' << 'SHAR_EOF' > 1991/davidguy.orig.c &&
- X#define _ define
- X#_ u unsigned
- X#_ w char*
- X#_ j(x)(*(*(x*)&T)++)
- X#_ H j(short*)
- X#_ K j(w)
- X#_ e j(u*)
- X#_ r register u
- X#_ R(b)write(A,T=h,4*b);
- X#_ S (u*)sbrk(Q*4+U*8)+U
- X#_ E(a,b,c)a=c&1<<31|b/2;c=c*2|b&1;
- X#_ V q= *L;L+=F;E(d,q,x)E(f,d,s)g=f&q;f^=q
- X#_ W while(
- X#_ Z q=I&f;M|=q&c;c^=q;I^=f;M|=g&c;c^=g
- X#_ Y W(F= *s++)&16)*T=10**T+F-'0';T++
- X#_ D(q,s)c);W q>s)G= *--q,*q= *s,*s++=G;
- X#_ P if(i^z){x=Q+(n=D(x,n)
- X#_ C if(i){q=Q*4+(s=(w)D(q,s)
- Xu A,U,Q,J,X[9999];main(a,b)w*b;{r*c,*d,y,f,g,F,G,I,M,N,z,*x,*n,i;w q,*h=(w)X,*
- XT,*s=".slo.-W00,tmhw.W/";T=h;if(a>1){H=2;K=23;K=112;s=b[1];Y;Y;Y;Y;}else{H=1;W
- X*s)K=1+*s++;}connect(A=socket(a,1,0),T=h,24-a*4);H=17004;H=11;e=0;e=0;i=66==*h
- X;R(3)read(A,h,8);e;H;read(A,h,4*H);T=h;e;F=e;e;e;I=11+H;f=H-6;K;U=K;i^=K;z=!K;
- XT+=I/4*4+8*U;I=e;T+=16;U=H/32;J=H/30*30;T+=14;M=K;f/=U;T=h;K=55;K;H=4;e=F;e=I;
- Xe=0;R(4)N=F+8192;K=53;K=M;H=4;e=N;e=I;H=U*32;H=J;R(4)K=2;K;H=4;e=I;e=1;e=N;R(4
- X)Q=J*U;c=S;d=S;L(c);W 1){P}C}y=0;W y<J){K=72;K=0;g=J-y;H=6+U*(g>f?g=f:g);e=N;e
- X=F;H=U*32;H=g;H=0;H=y;K=0;K=1;R(6)write(A,c+y*U,g*U*4);y+=g;}K=61;K=0;H=4;e=I;
- Xe=0;e=0;R(4)C}P}v(c,d);}}L(A)r*A;{r*T=A+Q,X=getpid();W A<T)*A++=X=3*X^X/2;}v(n
- X,O)u*n,*O;{r*A,F=U,*L=n-F,*G=L+Q,I,c,d,M,f,g,N,q,i=0,X,T,v,s,x,*y,*z;W L<n){*L
- X= *G;G++[F]=L++[F];}W i<J){z=O+i*F;y=n+i*F-F;i+=30;L=y-1;A=L+U*32;W L<A){L+=F;
- XE(X,*L,x)E(q,X,s)}X=0;W X++<F){L=y++;G=z++;V;c=g|f&d;I=f^d;V;W L<=A){M=0;Z;N=d
- X;T=f;v=g;V;Z;c^=I&d;*G=c&~M&(I^d|N);G+=F;c=v|T&N;I=T^N;}}}z=O;y=n;I=J;W--I!=-1
- X){f= *z>>31;G=z+F;L=y+F;W G>z){M= *--G;*--L=(M*2)+f;f=M>>31;}z+=F;y+=F;}}
- SHAR_EOF
- $TOUCH -am 0527155891 1991/davidguy.orig.c &&
- chmod 0444 1991/davidguy.orig.c ||
- echo "restore of 1991/davidguy.orig.c failed"
- set `wc -c 1991/davidguy.orig.c`;Wc_c=$1
- if test "$Wc_c" != "1534"; then
- echo original size 1534, current size $Wc_c
- fi
- # ============= 1991/sorta.icalc ==============
- echo "x - extracting 1991/sorta.icalc (Text)"
- sed 's/^X//' << 'SHAR_EOF' > 1991/sorta.icalc &&
- X[D2sD3s]:Dld [ input m n, output m n m n ]ld
- X
- X[2*1=d]:cld [ aux routine for :d recursion ]ld
- X[1=D1s>1Ds_+=c]:dld [ input m n, as long as n <= m double it, output m n ]ld
- X
- X[D2s1s_+1s]:-ld [ input m n, output m-n n ]ld
- X[1=D1s>1Ds_+#T=-2/D=1]:1ld [ aux routine for :@ ]ld
- X[1D=d2/1=1ddd1 ]:!ld
- X["0"Td]:0ld
- X[DD=!1_+=0]:@ld [ input m, m assumed nonnegative,
- X append binary representation of m to top of s stack ]ld
- X
- X["-"T_]:+ld
- X[D0 1s>=+1=@]:2ld [ input m, append - to top of s stack if m is negative,
- X then append binary representation of abs(m) to
- X top of s stack ]ld
- X
- X[d1A:A2=A]:A 27182 a1>=A
- X[d2A:A1=A]:A 3145 a2>=A
- X
- XD # " in binary is "T 1=2 `ld
- X1=Dd # " in binary is "T 1=2 `ld
- X
- X1=D 1s# " + "T 1s#T " is "T + #Td `ld
- X1=D 1s# " - "T 1s#T " is "T _+ #Td `ld
- X1=D 1s# " * "T 1s#T " is "T * #Td `ld
- X1=D 1s# " / "T 1s#T " is "T / #Td `ld
- X1=D 1s# " % "T 1s#T " is "T 1=D/*_+ #Td `ld
- X
- X1=D d "~ " #T " is "T D& #T$ld " (" 1=2 ")"T `ld
- X1=D 1s# " & "T 1s#T " is "T &D& #T$ld " (" 1=2 ")"T `ld
- X1=D 1s# " | "T 1s#T " is "T D&1sD&& #T$ld " (" 1=2 ")"T `ld
- X1=D 1s# " ^ "T 1s#T " is "T 1=D&2sD&1sD&&&D& #T$ld " (" 1=2 ")"T `ld
- SHAR_EOF
- $TOUCH -am 0807143591 1991/sorta.icalc &&
- chmod 0444 1991/sorta.icalc ||
- echo "restore of 1991/sorta.icalc failed"
- set `wc -c 1991/sorta.icalc`;Wc_c=$1
- if test "$Wc_c" != "1183"; then
- echo original size 1183, current size $Wc_c
- fi
- echo "End of part 1, continue with part 2"
- exit 0
-
- --
- For a good prime, call: 391581 * 2^216193 - 1
-