Initial revision

git-svn-id: file:///srv/svn/joey/bsdgames-trunk@5099 a4a2c43b-8ac3-0310-8836-e0e880c912e2
This commit is contained in:
joey
1999-09-26 21:23:21 +00:00
parent b0928da4f8
commit 5d36ad0e9e
59 changed files with 8401 additions and 0 deletions

302
COPYING Normal file
View File

@@ -0,0 +1,302 @@
I believe that the following copyrights and licence terms apply to the
games distributed in bsd-games and bsd-games-non-free. (The copyright
years given below are those that appear on any of the files so
licensed.)
Most games are under the standard BSD terms:
Copyright (c) 1980, 1982, 1983, 1985-1994
The Regents of the University of California. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. All advertising materials mentioning features or use of this software
must display the following acknowledgement:
This product includes software developed by the University of
California, Berkeley and its contributors.
4. Neither the name of the University nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
The files `backgammon/backgammon/backlocal.h', `countmail/countmail'
and `robots/auto.c' have a similar licence, but copyright is held by
the NetBSD Foundation:
Copyright (c) 1997, 1998, 1999 The NetBSD Foundation, Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. All advertising materials mentioning features or use of this software
must display the following acknowledgement:
This product includes software developed by the NetBSD
Foundation, Inc. and its contributors.
4. Neither the name of The NetBSD Foundation nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
In the case of `adventure/extern.h' the copyright is held by Christos
Zoulas:
Copyright (c) 1997 Christos Zoulas. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. All advertising materials mentioning features or use of this software
must display the following acknowledgement:
This product includes software developed by Christos Zoulas.
4. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
In the case of `countmail/countmail.6' the copyright is held by
Matthew R. Green:
Copyright (c) 1997 Matthew R. Green
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
In the case of `wargames/wargames.6', the copyright is held by Joey
Hess:
Copyright (c) 1998 Joey Hess
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
The game `atc' bears additional notices in the name of Ed James:
Copyright (c) 1987 by Ed James, UC Berkeley. All rights reserved.
Copy permission is hereby granted provided that this notice is
retained on all partial or complete copies.
For more info on this and all of my stuff, mail edjames@berkeley.edu.
The game `boggle' used to bear a copyright notice in the name of Barry
Brachman, but he confirmed that he had assigned his copyright to the
University of California and the continued inclusion of the old
copyright notice was an omission on their part.
The game `hunt' appears to be copyrighted by its authors and the
University of California:
Copyright (c) 1985 Conrad C. Huang, Gregory S. Couch, Kenneth C.R.C. Arnold
San Francisco, California
Copyright (c) 1983, 1985 Regents of the University of California.
All rights reserved. The Berkeley software License Agreement
specifies the terms and conditions for redistribution.
Hunt is part of the user-contributed software distributed by
Berkeley in 4BSD. The sources are copyrighted by the authors
and the University of California. You may redistribute freely
as long as the copyright notices are retained.
These terms also apply to `hunt/Makeconfig', which is derived from the
hunt `Makefile.inc' distributed by NetBSD.
The game `phantasia' is not copyright (except for
`phantasia/pathnames.h.in' to which the BSD copyright and licence
apply); the notice in `phantasia/COPYRIGHT' applies to it.
The game `rogue' (in bsd-games-non-free) bears the standard BSD
notices, and then the following:
This source herein may be modified and/or distributed by anybody who
so desires, with the following restrictions:
1.) No portion of this notice shall be removed.
2.) Credit shall not be taken for the creation of this source.
3.) This code is not to be traded, sold, or used for personal
gain or profit.
The game `wtf' is also not copyright, and bears the notice
Public domain
Auxilliary and data files, distributed with the games in NetBSD, but
not bearing copyright notices, probably fall under the terms of the
UCB or NetBSD copyrights and licences. The file `fortune/Notes'
contains a warning in regard to the fortune databases.
Some files, beyond those present in NetBSD, have been added to the
Linux bsd-games collection. The following terms apply to the files in
the `include' and `lib' directories (relevant to binary distributions
insofar as they get compiled into the games; note that the include
files are probably irrelevant for this purpose as it is unlikely they
are significant enough to make any binary a derived work).
Copyright (c) 1997, 1998, 1999 Joseph Samuel Myers.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
The above terms also apply to the scripts, makefile fragments and
documentation added to the Linux bsd-games collection which are not
significantly derived from bsd-games 1.3 by Curt Olson and Andy Tefft;
this is all of them except for the files mentioned below to which the
similar terms given below are expected to apply. This includes the
testsuite scripts; the testsuite input and output for caesar
(`tests/caesar.constin' and `tests/caesar.constout') are from the US
Constitution, so not copyright; I believe the other testsuite expected
outputs are too trivial, or translations of inputs too trivial, to
qualify for copyright; but if not, then the terms given above apply
(and, of course, running the test command gives an identical output
file to which you could apply your own copyright).
The files `bsd-games.lsm', `ChangeLog.0', `THANKS', `INSTALL',
`README', `TODO', `boggle/README.linux', `fortune/README.linux', and
`hunt/README.linux' are still significantly derived from files in the
original bsd-games package for Linux by Curt Olson and Andy Tefft. It
is expected that the following terms will apply to these files, and to
the compilation copyright on the package as a whole; ***this has yet
to be confirmed with Andy Tefft***:
Copyright (c) 1993 Curt Olson, Andy Tefft.
Copyright (c) 1997, 1998, 1999 Joseph Samuel Myers.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the authors may not be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
Local Variables:
mode: text
End:

489
atc/atc.6.in Normal file
View File

@@ -0,0 +1,489 @@
.\" $NetBSD: atc.6,v 1.6 1999/07/17 19:48:40 hubertf Exp $
.\"
.\" Copyright (c) 1990, 1993
.\" The Regents of the University of California. All rights reserved.
.\"
.\" This code is derived from software contributed to Berkeley by
.\" Ed James.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. All advertising materials mentioning features or use of this software
.\" must display the following acknowledgement:
.\" This product includes software developed by the University of
.\" California, Berkeley and its contributors.
.\" 4. Neither the name of the University nor the names of its contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" @(#)atc.6 8.1 (Berkeley) 5/31/93
.\"
.\" Copyright (c) 1986 Ed James. All rights reserved.
.\"
.Dd May 31, 1993
.Dt ATC 6
.Os BSD 4.3
.Sh NAME
.Nm atc
.Nd air traffic controller game
.Sh SYNOPSIS
.Nm atc
.Op Fl u?lstp
.Op Fl gf Ar "game name"
.Op Fl r Ar "random seed"
.Sh DESCRIPTION
.Nm Atc
lets you try your hand at the nerve wracking duties of the air traffic
controller without endangering the lives of millions of
travelers each year.
Your responsibilities require you to direct the flight of jets
and prop planes into and out of the flight arena and airports.
The speed (update time) and frequency of the planes depend on the
difficulty of the chosen arena.
.Sh OPTIONS
.Bl -tag -width flag
.It Fl u
Print the usage line and exit.
.It Fl ?
Same as
.Fl u.
.It Fl l
Print a list of available games and exit.
The first game name printed is the default game.
.It Fl s
Print the score list (formerly the Top Ten list).
.It Fl t
Same as
.Fl s.
.It Fl p
Print the path to the special directory where
.Nm atc
expects to find its private files. This is used during the
installation of the program.
.It Fl g Ar game
Play the named game. If the game listed is not one of the
ones printed from the
.Fl l
option, the default game is played.
.It Fl f Ar game
Same as
.Fl g.
.It Fl r Ar seed
Set the random seed. The purpose of this flag is questionable.
.El
.Sh GOALS
Your goal in
.Nm atc
is to keep the game going as long as possible.
There is no winning state, except to beat the times of other players.
You will need to: launch planes at airports (by instructing them to
increase their altitude); land planes at airports (by instructing them to
go to altitude zero when exactly over the airport); and maneuver planes
out of exit points.
.Pp
Several things will cause the end of the game.
Each plane has a destination (see information area), and
sending a plane to the wrong destination is an error.
Planes can run out of fuel, or can collide. Collision is defined as
adjacency in all three dimensions. A plane leaving the arena
in any other way than through its destination exit is an error as well.
.Pp
Scores are sorted in order of the number of planes safe. The other
statistics are provided merely for fun. There is no penalty for
taking longer than another player (except in the case of ties).
.Pp
Suspending a game is not permitted. If you get a talk message, tough.
When was the last time an Air Traffic Controller got called away to
the phone?
.Sh "THE DISPLAY"
.Pp
Depending on the terminal you run
.Nm atc
on, the screen will be divided into 4 areas.
It should be stressed that the terminal driver portion of the
game was designed to be reconfigurable, so the display format can vary
depending the version you are playing. The descriptions here are based
on the ascii version
of the game. The game rules and input format, however,
should remain consistent.
Control-L redraws the screen, should it become muddled.
.Ss RADAR
The first screen area is the radar display, showing the relative locations
of the planes, airports, standard entry/exit points, radar
beacons, and ``lines'' which simply serve to aid you in guiding
the planes.
.Pp
Planes are shown as a single letter with an altitude. If
the numerical altitude is a single digit, then it represents
thousands of feet.
Some distinction is made between the prop
planes and the jets. On ascii terminals, prop planes are
represented by a upper case letter, jets by a lower case letter.
.Pp
Airports are shown as a number and some indication of the direction
planes must be going to land at the airport.
On ascii terminals, this is one of `^', `>', `<', and `v', to indicate
north (0 degrees), east (90), west (270) and south (180), respectively.
The planes will also
take off in this direction.
.Pp
Beacons are represented as circles or asterisks and a number.
Their purpose is to offer a place of easy reference to the plane pilots.
See ``the delay command'' under the input section of this manual.
.Pp
Entry/exit points are displayed as numbers along the border of the
radar screen. Planes will enter the arena from these points without
warning. These points have a direction associated with them, and
planes will always enter the arena from this direction. On the
ascii version of
.Nm atc,
this direction is not displayed. It will become apparent
what this direction is as the game progresses.
.Pp
Incoming planes will always enter at the same altitude: 7000 feet.
For a plane to successfully depart through an entry/exit point,
it must be flying at 9000 feet.
It is not necessary for the planes to be flying in any particular
direction when they leave the arena (yet).
.Ss "INFORMATION AREA"
The second area of the display is the information area, which lists
the time (number of updates since start), and the number of planes you
have directed safely out of the arena.
Below this is a list of planes currently in the air, followed by a
blank line, and then a list of planes on the ground (at airports).
Each line lists the plane name and its current altitude,
an optional asterisk indicating low fuel, the plane's destination,
and the plane's current command. Changing altitude is not considered
to be a command and is therefore not displayed. The following are
some possible information lines:
.Pp
.Bd -literal -unfilled -offset indent
B4*A0: Circle @ b1
g7 E4: 225
.Ed
.Pp
The first example shows a prop plane named `B' that is flying at 4000
feet. It is low on fuel (note the `*'). Its destination is
Airport #0.
The next command it expects
to do is circle when it reaches Beacon #1.
The second example shows a jet named `g' at 7000 feet, destined for
Exit #4. It is just now executing a turn to 225 degrees (South-West).
.Ss "INPUT AREA"
The third area of the display is the input area. It is here that
your input is reflected. See the INPUT heading of this manual
for more details.
.Ss "AUTHOR AREA"
This area is used simply to give credit where credit is due. :-)
.Sh INPUT
A command completion interface is built into
the game. At any time, typing `?' will list possible input characters.
Typing a backspace (your erase character) backs up, erasing the last part
of the command. When a command is complete, a return enters it, and
any semantic checking is done at that time. If no errors are detected,
the command is sent to the appropriate plane. If an error is discovered
during the check, the offending statement will be underscored and a
(hopefully) descriptive message will be printed under it.
.Pp
The command syntax is broken into two parts:
.Em "Immediate Only"
and
.Em Delayable
commands.
.Em "Immediate Only"
commands happen on the next
update.
.Em Delayable
commands also happen on the next update unless they
are followed by an optional predicate called the
.Em Delay
command.
.Pp
In the following tables, the syntax
.Em [0\-9]
means any single digit, and
.Em <dir>
refers to a direction, given by the keys around the `s' key: ``wedcxzaq''.
In absolute references, `q' refers to North-West or 315 degrees, and `w'
refers to North, or 0 degrees.
In relative references, `q' refers to -45 degrees or 45 degrees left, and `w'
refers to 0 degrees, or no change in direction.
.Pp
All commands start with a plane letter. This indicates the recipient
of the command. Case is ignored.
.Ss "IMMEDIATE ONLY COMMANDS"
.Bl -tag -width "aaaa"
.It "a [ cd+- ]" Em number
Altitude: Change a plane's altitude, possibly requesting takeoff.
`+' and `-' are the same as `c' and `d'.
.Bl -tag -width "aaaaaaaaaa" -compact
.It a Em number
Climb or descend to the given altitude (in thousands of feet).
.It ac Em number
Climb: relative altitude change.
.It ad Em number
Descend: relative altitude change.
.El
.It m
Mark: Display in highlighted mode. Plane and command information
is displayed normally.
.It i
Ignore: Do not display highlighted. Command is displayed as a
line of dashes if there is no command.
.It u
Unmark: Same as ignore, but if a delayed command is processed,
the plane will become marked. This is useful if you want
to forget about a plane during part, but not all, of its
journey.
.El
.Ss "DELAYABLE COMMANDS"
.Bl -tag -width "aaaa"
.It "c [ lr ]"
Circle: Have the plane circle.
.Bl -tag -width "aaaaaaaaaa" -compact
.It cl
Left: Circle counterclockwise.
.It cr
Right: Circle clockwise (default).
.El
.It "t [ l-r+LR ] [ dir ] or tt [ abe* ]" Em number
Turn: Change direction.
.Bl -tag -width "aaaaaaaaaa" -compact
.It "t<dir>"
Turn to direction: Turn to the absolute compass heading given.
The shortest turn will be taken.
.It "tl [ dir ]"
Left: Turn counterclockwise: 45 degrees by default, or the amount
specified in <dir> (not
.Em to
<dir>.) `w' (0 degrees) is no turn. `e' is 45 degrees; `q' gives -45
degrees counterclockwise, that is, 45 degrees clockwise.
.It "t- [ dir ]"
Same as left.
.It "tr [ dir ]"
Right: Turn clockwise, 45 degrees by default, or the amount specified
in <dir>.
.It "t+ [ dir ]"
Same as right.
.It tL
Hard left: Turn counterclockwise 90 degrees.
.It tR
Hard right: Turn clockwise 90 degrees.
.It "tt [abe*]"
Towards: Turn towards a beacon, airport or exit. The turn is
just an estimate.
.It "tta" Em number
Turn towards the given airport.
.It "ttb" Em number
Turn towards the specified beacon.
.It "tte" Em number
Turn towards an exit.
.It "tt*" Em number
Same as ttb.
.El
.El
.Ss THE DELAY COMMAND
The
.Em Delay
(a/@)
command may be appended to any
.Em Delayable
command. It allows the controller to instruct a plane to do an action
when the plane reaches a particular beacon (or other objects in future
versions).
.Bl -tag -width "aaaa"
.It ab Em number
Do the delayable command when the plane reaches the specified
beacon. The `b' for ``beacon'' is redundant to allow for expansion.
`@' can be used instead of `a'.
.El
.Ss "MARKING, UNMARKING AND IGNORING"
Planes are
.Em marked
by default when they enter the arena. This means they are displayed
in highlighted mode on the radar display. A plane may also be either
.Em unmarked
or
.Em ignored.
An
.Em unmarked
plane is drawn in unhighlighted mode, and a line of dashes is displayed in
the command field of the information area. The plane will remain this
way until a mark command has been issued. Any other command will be issued,
but the command line will return to a line of dashes when the command
is completed.
.Pp
An
.Em ignored
plane is treated the same as an unmarked plane, except that it will
automatically switch to
.Em marked
status when a delayed command has been processed. This is useful if
you want to forget about a plane for a while, but its flight path has
not yet been completely set.
.Pp
As with all of the commands, marking, unmarking and ignoring will take effect
at the beginning of the next update. Do not be surprised if the plane does
not immediately switch to unhighlighted mode.
.Ss EXAMPLES
.Bl -tag -width gtte4ab2 -offset indent
.It atlab1
Plane A: turn left at beacon #1
.It cc
Plane C: circle
.It gtte4ab2
Plane G: turn towards exit #4 at beacon #2
.It ma+2
Plane M: altitude: climb 2000 feet
.It stq
Plane S: turn to 315
.It xi
Plane X: ignore
.El
.Sh "OTHER INFORMATION"
.Bl -bullet
.It
Jets move every update; prop planes move every other update.
.It
All planes turn a most 90 degrees per movement.
.It
Planes enter at 7000 feet and leave at 9000 feet.
.It
Planes flying at an altitude of 0 crash if they are not over an airport.
.It
Planes waiting at airports can only be told to take off (climb in altitude).
.El
.Sh "NEW GAMES"
The
.Pa Game_List
file lists the currently available play fields. New field description
file names must be placed in this file to be playable. If a player
specifies a game not in this file, his score will not be logged.
.Pp
The game field description files are broken into two parts. The first
part is the definition section. Here, the four tunable game parameters
must be set. These variables are set with the syntax:
.Pp
.Dl "variable = number;"
.Pp
Variable may be one of:
.Li update,
indicating the number of seconds between forced updates;
.Li newplane,
indicating (about) the number of updates between new plane entries;
.Li width,
indicating the width of the play field; or
.Li height,
indicating the height of the play field.
.Pp
The second part of the field description files describes the locations
of the exits, the beacons, the airports and the lines.
The syntax is as follows:
.Pp
.Bd -literal -offset indent
.Bl -tag -width airport: -compact
.It beacon:
(x y) ... ;
.It airport:
(x y direction) ... ;
.It exit:
(x y direction) ... ;
.It line:
[ (x1 y1) (x2 y2) ] ... ;
.El
.Ed
.Pp
For beacons, a simple x, y coordinate pair is used (enclosed in
parenthesis). Airports and exits require a third value, which is one
of the directions
.Em wedcxzaq.
For airports, this is the direction that planes must be going to take
off and land, and for exits, this is the direction that planes will going
when they
.Em enter
the arena. This may not seem intuitive, but as there is no restriction on
direction of exit, this is appropriate.
Lines are slightly different, since they need two coordinate pairs to
specify the line endpoints. These endpoints must be enclosed in
square brackets.
.Pp
All statements are semi-colon (;) terminated. Multiple item statements
accumulate. Each definition must occur exactly once, before any
item statements. Comments begin with a hash (#) symbol
and terminate with a newline.
The coordinates are between zero and width-1 and height-1
inclusive. All of the exit coordinates must lie on the borders, and
all of the beacons and airports must lie inside of the borders.
Line endpoints may be anywhere within the field, so long as
the lines are horizontal, vertical or
.Em exactly
diagonal.
.Ss "FIELD FILE EXAMPLE"
.Bd -literal -unfilled
# This is the default game.
update = 5;
newplane = 5;
width = 30;
height = 21;
exit: ( 12 0 x ) ( 29 0 z ) ( 29 7 a ) ( 29 17 a )
( 9 20 e ) ( 0 13 d ) ( 0 7 d ) ( 0 0 c ) ;
beacon: ( 12 7 ) ( 12 17 ) ;
airport: ( 20 15 w ) ( 20 18 d ) ;
line: [ ( 1 1 ) ( 6 6 ) ]
[ ( 12 1 ) ( 12 6 ) ]
[ ( 13 7 ) ( 28 7 ) ]
[ ( 28 1 ) ( 13 16 ) ]
[ ( 1 13 ) ( 11 13 ) ]
[ ( 12 8 ) ( 12 16 ) ]
[ ( 11 18 ) ( 10 19 ) ]
[ ( 13 17 ) ( 28 17 ) ]
[ ( 1 7 ) ( 11 7 ) ] ;
.Ed
.Sh FILES
Files are kept in a special directory. See the OPTIONS for a way to
print this path out. It is normally
.Pa @atc_dir@.
.Pp
This directory contains the file
.Pa Game_List,
which holds the list of playable games, as well as the games
themselves.
.Pp
The scores are kept in
.Pa @atc_scorefile@.
.Sh AUTHOR
Ed James, UC Berkeley: edjames@ucbvax.berkeley.edu, ucbvax!edjames
.Pp
This game is based on someone's description of the overall flavor
of a game written for some unknown PC many years ago, maybe.
.Sh BUGS
The screen sometimes refreshes after you have quit.
.Pp
Yet Another Curses Bug was discovered during the development of this game.
If your curses library clrtobot.o is version 5.1 or earlier,
you will have erase problems with the backspace operator in the input
window.

44
fortune/datfiles/limerick Normal file
View File

@@ -0,0 +1,44 @@
A computer called Illiac4
Had a rather tough bug in its core.
It chewed up its cards
And spewed yards and yards
Of illegible tape on the floor.
%
A computer, to print out a fact,
Will divide, multiply, and subtract.
But this output can be
No more than debris,
If the input was short of exact.
-- Gigo
%
A dreary young bank clerk named Fennis
Wished to foster an aura of menace;
To make people afraid
He wore gloves of grey suede
And white footgear intended for tennis.
-- Edward Gorey
%
A hacker who screwed a mag tape
Was caught and convicted of rape.
To jail he did go,
From which, to his woe
He couldn't get out with ESC.
%
A linguist thought it a farce
That memory space was so sparse.
One day they increased it.
Said he as he seized it:
"At last! Enough core for the parse".
%
A progressive professor named Winners
Held classes each evening for sinners.
They were graded and spaced
So the vile and debased
Would not be held back by beginners.
%
A very intelligent turtle
Found programming UNIX a hurdle
The system, you see,
Ran as slow as did he,
And that's not saying much for the turtle.
%

View File

@@ -0,0 +1,2 @@
There are no potentially offensive fortunes installed on this
system. For further details, contact your system administrator.

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,2 @@
There are no potentially offensive fortunes installed on this
system. For further details, contact your system administrator.

View File

@@ -0,0 +1,385 @@
SHUT UP HIPPY
%
YOU'RE ALL SHEEP
%
SELL ME DRUGS
%
TELEVISION LOVES ME
%
DON'T POSTPONE JOY
%
FUCK SLOGANS
%
COFFEE NOW DAMMIT
%
THIS WORLD IS SHIT
%
SMASH THE STATE
%
DARN THE GOV'T
%
WHITEY WILL PAY
%
MY JOB SUCKS ASS
%
BAD SEX SUCKS
%
I'M FUCKING METAL
%
I WORSHIP SATAN HA HA
%
ADULTS ARE DUMB
%
WE'RE DOOMED
%
DON'T GET CAUGHT
%
THE END IS NEAR
%
GOD IS OBSOLETE
%
FUCK YOU, GOD
%
NO MORE BULLSHIT
%
WARM THE GLOBE
%
JESUS HATES ME
%
FUCK WORK
%
DRUGS HELP ALOT
%
COPS SMELL FUNNY
%
WEIRDOS UNITE!
%
MICROSOFT MUST DIE
%
WHY DOES SCHOOL SUCK?
%
MY BOSS IS A JERK
%
JESUS JUST LEFT
%
REBOOT AMERICA
%
DESTROY CAPITALISM
%
I HATE THE RICH
%
I AM AN ANARCHIST
%
BOMB THE MALL
%
WAKE THE FUCK UP
%
DOPE SMOKIN' MORON
%
KIDS LOVE SATAN
%
THE SYSTEM'S FUCKED
%
WOMEN WILL RISE
%
FUCK SCHOOL
%
I HATE COMPUTERS
%
LIFE ISN'T FAIR
%
POLITICS ARE BORING
%
NO CHANGE SORRY
%
GOOD FOR NOTHING
%
RACISM IS TYPICAL
%
YOU'RE A SEXIST
%
BORED
%
BROKE
%
WAGE-SLAVE
%
MAKE IT STOP
%
FUCK ART LET'S KILL
%
END CIVILIZATION
%
CALL IN SICK
%
TWENTYNOTHING
%
GOAT-BOY
%
My dad's a cop too,
couldja let me go now?
%
KEEP MUSIC EVIL
%
FUCK FAST FOOD
%
ORGASMS ARE GOOD
%
BREAK SOME LAWS
%
STAMP OUT REALITY
%
LIVE THE CHAOS
%
WE'RE ALL PERVERTS
%
UNEMPLOYABLE
%
LEGALIZE YOURSELF
%
T.V. CASUALTY
%
BE NOT HALF-ASSED
%
ANNOY THE BORING
%
PUNK ROCK GIRL
%
GOD MASTURBATES
%
DIE MTV DIE
%
I AM A POSEUR
%
TOUCH ME I'M SICK
%
ANTI-FASHION
%
PIGS VS. PEOPLE
%
NOT OF THIS EARTH
%
DRUGS SUCK ALOT
%
Sex with you would suck.
%
I'm killing the Earth!
%
I guess I was punk once.
%
i represent
GOD
you fuck
%
My world is cold
and without hope.
%
GIMME GIMME
FOOD STAMPS
%
THIS ISN'T ME
%
FUCK DECAF
%
DEFEATED
%
Blow up Disneyland.
%
California is overrated.
%
UNAMERICAN
%
I AM CONFUSED
%
SEX TOYS ROCK
%
GO FUCKING PRAY
%
NATURE IS PISSED
%
FUGAZIFY YOURSELF
%
I'M IN SCENESTER HELL
%
RESIST DESPAIR
%
EVIL WILL TRIUMPH
%
FUCK YOUR LAME ADS
%
RACE MIXING IS COOL
%
EMBRACE VIOLENCE
%
AMERICAN WASTE
%
FUCKING HOSTILE
%
SEIZE LIBERTY
%
DESTROY WHAT
BORES YOU
ON SIGHT
%
FUCK YEAH I'M WEIRD
%
FUCK CENSORSHIP
%
WE'RE NOT DUMB
%
DEMAND JUSTICE
%
FREAK PRIDE
%
CULT MEMBER
%
CONFORMIST
REVOLUTION
%
FUCK SHIT UP
%
DON'T LET ME FAIL
%
GROOVE MATTERS
%
SURVIVE Y2K SOMEHOW
%
TAX THE RICH
%
MAKE YUPPIES SUFFER
%
GET A JOB JUNKIE
%
ARM THE HOMELESS
%
BOYCOTT GEN-X CRAP
%
GODLESS COMMIE SCUM
%
I STILL BELIEVE
%
SCARE THE SQUARE
%
I AM A BAD ASS
%
UNLEASH INFINITY
%
ESTROGEN POWER
%
HEDONISM NOW!
%
SOMEBODY DOSE ME
%
REAGAN WAS WORSE
%
children know everything
%
TRAITOR
%
SINNER
%
UNITY
%
UNDERSTAND
%
GO CORPORATE
%
You LIVE in that head?
%
JUST BE PURE
%
PIGS SHOULDN'T RULE
%
Go work on your website.
%
America eats its young.
%
LAUGH AT ASSHOLES
%
PEOPLE ARE MIRACLES
%
DESTINATION UNKNOWN
%
HEAL YOUR FUCKERS
%
CONSIDER SOBREITY
%
INHERIT THE EARTH
%
DROP THE ATTITUDE
%
ALL POLITICIANS LIE
%
GOTTA LOVE HOTTIES
%
what's stopping you?
%
IMPEACH 'EM ALL
%
HOOK ME UP BABY
%
i'm so fucking beautiful
%
SO MANY FEELINGS
%
QUIT BEING PASSIVE
%
GO BEYOND COMFORT
%
STOP LIVING LIKE VEAL
%
ask me about my pain
%
OVERTHROW THAT SHIT
%
BORN TO CHILL
%
Whose future is it, anyway?
%
This is a nation of whores.
%
YOUR KIDS ARE TRIPPING
%
FUCK ALL PREJUDICE
%
SHHHHHH. LISTEN.
%
FIGHT FAT PHOBIA
%
VICTORY OVER HORSESHIT
%
everyone is a prostitute
%
DON'T STOP BELIEVING
%
YOU'RE BISEXUAL
%
MINIMIZE BAD THINGS
%
YOU'RE MY RELIGION
%
I WORSHIP YOU
%
MY MACINTOSH RULES
%
CHEER UP EMO KID
%
LIVE FREE OR DIE
%
TELEVISION IS TORTURE
%
BRING THAT BEAT BACK
%
HUG A REVOLUTIONARY
%
DON'T FEAR THE REAPER
%
SHOW ME THE WAY
%
I CAN MAKE YOU GOD
%
WOMEN TAKE OVER
%
SO FUCKING DEEP
%
WHY OBEY MORONS?

120
include/sys/endian.h Normal file
View File

@@ -0,0 +1,120 @@
/* sys/endian.h - bsd-games compatibility with NetBSD <sys/endian.h> (not
* a complete emulation).
*
* Copyright (c) 1999 Joseph Samuel Myers.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <features.h>
#include <sys/types.h>
#include <endian.h>
#include <netinet/in.h>
#if __BYTE_ORDER == __BIG_ENDIAN
#ifndef be16toh
#define be16toh(x) ((u_int16_t)(x))
#endif
#ifndef htobe16
#define htobe16(x) ((u_int16_t)(x))
#endif
#ifndef be32toh
#define be32toh(x) ((u_int32_t)(x))
#endif
#ifndef htobe32
#define htobe32(x) ((u_int32_t)(x))
#endif
#ifndef be64toh
#define be64toh(x) ((u_int64_t)(x))
#endif
#ifndef htobe64
#define htobe64(x) ((u_int64_t)(x))
#endif
#ifndef BE16TOH
#define BE16TOH(x) ((void)0)
#endif
#ifndef HTOBE16
#define HTOBE16(x) ((void)0)
#endif
#ifndef BE32TOH
#define BE32TOH(x) ((void)0)
#endif
#ifndef HTOBE32
#define HTOBE32(x) ((void)0)
#endif
#ifndef BE64TOH
#define BE64TOH(x) ((void)0)
#endif
#ifndef HTOBE64
#define HTOBE64(x) ((void)0)
#endif
#else /* little-endian */
#ifndef be16toh
#define be16toh(x) ((u_int16_t)ntohs((u_int16_t)(x)))
#endif
#ifndef htobe16
#define htobe16(x) ((u_int16_t)htons((u_int16_t)(x)))
#endif
#ifndef be32toh
#define be32toh(x) ((u_int32_t)ntohl((u_int32_t)(x)))
#endif
#ifndef htobe32
#define htobe32(x) ((u_int32_t)htonl((u_int32_t)(x)))
#endif
#ifndef be64toh
#ifdef __bswap_64 /* glibc */
#define be64toh(x) ((u_int64_t)__bswap_64((u_int64_t)(x)))
#else /* no __bswap_64 */
#ifdef __swab64 /* Linux kernel headers (libc5, at least with kernel 2.2) */
#define be64toh(x) ((u_int64_t)__swab64((u_int64_t)(x)))
#else /* no __bswap_64 or __swab64 */
static __inline__ u_int64_t be64toh(u_int64_t __x);
static __inline__ u_int64_t be64toh(u_int64_t __x) { return (((u_int64_t)be32toh(__x & (u_int64_t)0xFFFFFFFFULL)) << 32) | ((u_int64_t)be32toh((__x & (u_int64_t)0xFFFFFFFF00000000ULL) >> 32)); }
#define be64toh(x) be64toh((x))
#endif /* no __bswap_64 or __swab64 */
#endif /* no __bswap_64 */
#endif /* no be64toh */
#ifndef htobe64
#define htobe64(x) be64toh(x)
#endif
#ifndef BE16TOH
#define BE16TOH(x) ((x) = be16toh((x)))
#endif
#ifndef HTOBE16
#define HTOBE16(x) ((x) = htobe16((x)))
#endif
#ifndef BE32TOH
#define BE32TOH(x) ((x) = be32toh((x)))
#endif
#ifndef HTOBE32
#define HTOBE32(x) ((x) = htobe32((x)))
#endif
#ifndef BE64TOH
#define BE64TOH(x) ((x) = be64toh((x)))
#endif
#ifndef HTOBE64
#define HTOBE64(x) ((x) = htobe64((x)))
#endif
#endif /* little-endian */

388
robots/auto.c Normal file
View File

@@ -0,0 +1,388 @@
/* $NetBSD: auto.c,v 1.4 1999/09/08 21:17:56 jsm Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Christos Zoulas.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the NetBSD
* Foundation, Inc. and its contributors.
* 4. Neither the name of The NetBSD Foundation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
/*
* Automatic move.
* intelligent ?
* Algo :
* IF scrapheaps don't exist THEN
* IF not in danger THEN
* stay at current position;
* ELSE move away from the closest robot;
* FI
* ELSE
* find closest heap;
* find closest robot;
* IF scrapheap is adjacenHEN
* move behind the scrapheap
* ELSE
* move away from the closest robot
* FI
* ELSE
* take the move that takes you away from the
* robots and closest to the heap
* FI
* FI
*/
#include "robots.h"
#define ABS(a) (((a)>0)?(a):-(a))
#define MIN(a,b) (((a)>(b))?(b):(a))
#define MAX(a,b) (((a)<(b))?(b):(a))
#define CONSDEBUG(a)
static int distance __P((int, int, int, int));
static int xinc __P((int));
static int yinc __P((int));
static const char *find_moves __P((void));
static COORD *closest_robot __P((int *));
static COORD *closest_heap __P((int *));
static char move_towards __P((int, int));
static char move_away __P((COORD *));
static char move_between __P((COORD *, COORD *));
static int between __P((COORD *, COORD *));
/* distance():
* return "move" number distance of the two coordinates
*/
static int
distance(x1, y1, x2, y2)
int x1, y1, x2, y2;
{
return MAX(ABS(ABS(x1) - ABS(x2)), ABS(ABS(y1) - ABS(y2)));
} /* end distance */
/* xinc():
* Return x coordinate moves
*/
static int
xinc(dir)
int dir;
{
switch(dir) {
case 'b':
case 'h':
case 'y':
return -1;
case 'l':
case 'n':
case 'u':
return 1;
case 'j':
case 'k':
default:
return 0;
}
}
/* yinc():
* Return y coordinate moves
*/
static int
yinc(dir)
int dir;
{
switch(dir) {
case 'k':
case 'u':
case 'y':
return -1;
case 'b':
case 'j':
case 'n':
return 1;
case 'h':
case 'l':
default:
return 0;
}
}
/* find_moves():
* Find possible moves
*/
static const char *
find_moves()
{
int x, y;
COORD test;
const char *m;
char *a;
static const char moves[] = ".hjklyubn";
static char ans[sizeof moves];
a = ans;
for(m = moves; *m; m++) {
test.x = My_pos.x + xinc(*m);
test.y = My_pos.y + yinc(*m);
move(test.y, test.x);
switch(winch(stdscr)) {
case ' ':
case PLAYER:
for(x = test.x - 1; x <= test.x + 1; x++) {
for(y = test.y - 1; y <= test.y + 1; y++) {
move(y, x);
if(winch(stdscr) == ROBOT)
goto bad;
}
}
*a++ = *m;
}
bad:;
}
*a = 0;
if(ans[0])
return ans;
else
return "t";
}
/* closest_robot():
* return the robot closest to us
* and put in dist its distance
*/
static COORD *
closest_robot(dist)
int *dist;
{
COORD *rob, *end, *minrob = NULL;
int tdist, mindist;
mindist = 1000000;
end = &Robots[MAXROBOTS];
for (rob = Robots; rob < end; rob++) {
tdist = distance(My_pos.x, My_pos.y, rob->x, rob->y);
if (tdist < mindist) {
minrob = rob;
mindist = tdist;
}
}
*dist = mindist;
return minrob;
} /* end closest_robot */
/* closest_heap():
* return the heap closest to us
* and put in dist its distance
*/
static COORD *
closest_heap(dist)
int *dist;
{
COORD *hp, *end, *minhp = NULL;
int mindist, tdist;
mindist = 1000000;
end = &Scrap[MAXROBOTS];
for (hp = Scrap; hp < end; hp++) {
if (hp->x == 0 && hp->y == 0)
break;
tdist = distance(My_pos.x, My_pos.y, hp->x, hp->y);
if (tdist < mindist) {
minhp = hp;
mindist = tdist;
}
}
*dist = mindist;
return minhp;
} /* end closest_heap */
/* move_towards():
* move as close to the given direction as possible
*/
static char
move_towards(dx, dy)
int dx, dy;
{
char ok_moves[10], best_move;
char *ptr;
int move_judge, cur_judge, mvx, mvy;
(void)strcpy(ok_moves, find_moves());
best_move = ok_moves[0];
if (best_move != 'F') {
mvx = xinc(best_move);
mvy = yinc(best_move);
move_judge = ABS(mvx - dx) + ABS(mvy - dy);
for (ptr = &ok_moves[1]; *ptr != '\0'; ptr++) {
mvx = xinc(*ptr);
mvy = yinc(*ptr);
cur_judge = ABS(mvx - dx) + ABS(mvy - dy);
if (cur_judge < move_judge) {
move_judge = cur_judge;
best_move = *ptr;
}
}
}
return best_move;
} /* end move_towards */
/* move_away():
* move away form the robot given
*/
static char
move_away(rob)
COORD *rob;
{
int dx, dy;
dx = sign(My_pos.x - rob->x);
dy = sign(My_pos.y - rob->y);
return move_towards(dx, dy);
} /* end move_away */
/* move_between():
* move the closest heap between us and the closest robot
*/
static char
move_between(rob, hp)
COORD *rob;
COORD *hp;
{
int dx, dy;
float slope, cons;
/* equation of the line between us and the closest robot */
if (My_pos.x == rob->x) {
/*
* me and the robot are aligned in x
* change my x so I get closer to the heap
* and my y far from the robot
*/
dx = - sign(My_pos.x - hp->x);
dy = sign(My_pos.y - rob->y);
CONSDEBUG(("aligned in x"));
}
else if (My_pos.y == rob->y) {
/*
* me and the robot are aligned in y
* change my y so I get closer to the heap
* and my x far from the robot
*/
dx = sign(My_pos.x - rob->x);
dy = -sign(My_pos.y - hp->y);
CONSDEBUG(("aligned in y"));
}
else {
CONSDEBUG(("no aligned"));
slope = (My_pos.y - rob->y) / (My_pos.x - rob->x);
cons = slope * rob->y;
if (ABS(My_pos.x - rob->x) > ABS(My_pos.y - rob->y)) {
/*
* we are closest to the robot in x
* move away from the robot in x and
* close to the scrap in y
*/
dx = sign(My_pos.x - rob->x);
dy = sign(((slope * ((float) hp->x)) + cons) -
((float) hp->y));
}
else {
dx = sign(((slope * ((float) hp->x)) + cons) -
((float) hp->y));
dy = sign(My_pos.y - rob->y);
}
}
CONSDEBUG(("me (%d,%d) robot(%d,%d) heap(%d,%d) delta(%d,%d)",
My_pos.x, My_pos.y, rob->x, rob->y, hp->x, hp->y, dx, dy));
return move_towards(dx, dy);
} /* end move_between */
/* between():
* Return true if the heap is between us and the robot
*/
int
between(rob, hp)
COORD *rob;
COORD *hp;
{
/* I = @ */
if (hp->x > rob->x && My_pos.x < rob->x)
return 0;
/* @ = I */
if (hp->x < rob->x && My_pos.x > rob->x)
return 0;
/* @ */
/* = */
/* I */
if (hp->y < rob->y && My_pos.y > rob->y)
return 0;
/* I */
/* = */
/* @ */
if (hp->y > rob->y && My_pos.y < rob->y)
return 0;
return 1;
} /* end between */
/* automove():
* find and do the best move if flag
* else get the first move;
*/
char
automove()
{
#if 0
return find_moves()[0];
#else
COORD *robot_close;
COORD *heap_close;
int robot_dist, robot_heap, heap_dist;
robot_close = closest_robot(&robot_dist);
if (robot_dist > 1)
return('.');
if (!Num_scrap)
/* no scrap heaps just run away */
return move_away(robot_close);
heap_close = closest_heap(&heap_dist);
robot_heap = distance(robot_close->x, robot_close->y,
heap_close->x, heap_close->y);
if (robot_heap <= heap_dist && !between(robot_close, heap_close)) {
/*
* robot is closest to us from the heap. Run away!
*/
return move_away(robot_close);
}
return move_between(robot_close, heap_close);
#endif
} /* end automove */

50
substfiles2 Normal file
View File

@@ -0,0 +1,50 @@
# substfiles2 - list of files in which parameters are to be substituted.
# These ones get substituted during the make process.
#
# Copyright (c) 1997, 1998, 1999 Joseph Samuel Myers.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. The name of the author may not be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
atc/atc.6
backgammon/backgammon/backgammon.6
caesar/rot13
canfield/canfield/canfield.6
cribbage/cribbage.6
dm/dm.8
dm/dm.conf.5
fortune/fortune/fortune.6
hangman/hangman.6
hunt/hunt/hunt.6
hunt/huntd/huntd.6
monop/monop.6
quiz/datfiles/index
quiz/quiz.6
robots/robots.6
rogue/rogue.6
snake/snake/snake.6
tetris/tetris.6
trek/trek.6
wtf/wtf.6
wtf/wtf

96
substscr Executable file
View File

@@ -0,0 +1,96 @@
#!/bin/sh
# substscr - substitute parameters to create a file from a .in.
#
# Copyright (c) 1999 Joseph Samuel Myers.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. The name of the author may not be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
# First argument is some combination of:
# r to generate makefile rules
# g to generate the file in question
# Second argument gives the style of comment:
# c for C comment
# h for generic # comment
# m for manpage comment
# n for none
# s for shell comment
# Third argument is the source file.
# Fourth argument is the target file.
# The target gets its permissions from the source.
set -e
if [ $# != 4 ]; then
echo "usage: $0 action comment-style source target" >&2
exit 1
fi
action="$1"
style="$2"
source="$3"
target="$4"
if echo $action |grep -q g; then
echo "Generating $target from $source"
rm -f $target
cp "$source" "$target" # set permissions
case "$style" in
(c)
echo "/* Automatically generated from $source. Do not edit. */" >"$target"
;;
(h)
echo "# Automatically generated from $source. Do not edit." >"$target"
;;
(m)
echo ".\\\" Automatically generated from $source. Do not edit." >"$target"
;;
(n)
: >"$target"
;;
(s)
echo "#!/bin/sh" >"$target"
echo "# Automatically generated from $source. Do not edit." >>"$target"
;;
(*)
echo "$0: unknown comment style $style" >&2
exit 1
esac
sed -f subst.sed <"$source" >>"$target"
fi
if echo $action |grep -q r; then
# Append to subst.rules.
cat >>subst.rules <<EOF
$target: $source subst.sed substscr
./substscr g $style $source $target
EOF
fi

15
tests/bcd.foo Normal file
View File

@@ -0,0 +1,15 @@
________________________________________________
/FOO |
|] |
| ]] |
| |
|111111111111111111111111111111111111111111111111|
|222222222222222222222222222222222222222222222222|
|333333333333333333333333333333333333333333333333|
|444444444444444444444444444444444444444444444444|
|555555555555555555555555555555555555555555555555|
|]]]666666666666666666666666666666666666666666666|
|777777777777777777777777777777777777777777777777|
|888888888888888888888888888888888888888888888888|
|999999999999999999999999999999999999999999999999|
|________________________________________________|

15
tests/bcd.foobar Normal file
View File

@@ -0,0 +1,15 @@
________________________________________________
/FOO BAR |
|] ]] |
| ]] ] |
| |
|11111]111111111111111111111111111111111111111111|
|2222]2222222222222222222222222222222222222222222|
|333333333333333333333333333333333333333333333333|
|444444444444444444444444444444444444444444444444|
|555555555555555555555555555555555555555555555555|
|]]]666666666666666666666666666666666666666666666|
|777777777777777777777777777777777777777777777777|
|888888888888888888888888888888888888888888888888|
|999999]99999999999999999999999999999999999999999|
|________________________________________________|

30
tests/bcd.fooxbar Normal file
View File

@@ -0,0 +1,30 @@
________________________________________________
/FOO |
|] |
| ]] |
| |
|111111111111111111111111111111111111111111111111|
|222222222222222222222222222222222222222222222222|
|333333333333333333333333333333333333333333333333|
|444444444444444444444444444444444444444444444444|
|555555555555555555555555555555555555555555555555|
|]]]666666666666666666666666666666666666666666666|
|777777777777777777777777777777777777777777777777|
|888888888888888888888888888888888888888888888888|
|999999999999999999999999999999999999999999999999|
|________________________________________________|
________________________________________________
/BAR |
|]] |
| ] |
| |
|1]1111111111111111111111111111111111111111111111|
|]22222222222222222222222222222222222222222222222|
|333333333333333333333333333333333333333333333333|
|444444444444444444444444444444444444444444444444|
|555555555555555555555555555555555555555555555555|
|666666666666666666666666666666666666666666666666|
|777777777777777777777777777777777777777777777777|
|888888888888888888888888888888888888888888888888|
|99]999999999999999999999999999999999999999999999|
|________________________________________________|

64
tests/bcd.test Executable file
View File

@@ -0,0 +1,64 @@
#!/bin/sh
# tests/bcd.test - test functionality of bcd.
#
# Copyright (c) 1999 Joseph Samuel Myers.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. The name of the author may not be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
set -e
. tests/common
testexec bcd bcd/bcd
testno 1
bcd/bcd foo >test.out 2>&1 || failtest
compare test.out tests/bcd.foo
rm -f test.out
testno 2
bcd/bcd "foo bar" >test.out 2>&1 || failtest
compare test.out tests/bcd.foobar
rm -f test.out
testno 3
bcd/bcd >test.out 2>&1 <<EOF || failtest
foo
EOF
compare test.out tests/bcd.foo
rm -f test.out
testno 4
bcd/bcd foo bar >test.out 2>&1 || failtest
compare test.out tests/bcd.fooxbar
rm -f test.out
testno 5
bcd/bcd >test.out 2>&1 <<EOF || failtest
foo
bar
EOF
compare test.out tests/bcd.fooxbar
rm -f test.out

100
tests/caesar.constin Normal file
View File

@@ -0,0 +1,100 @@
Ymj Htsxynyzynts tk ymj Zsnyji Xyfyjx tk Frjwnhf
Uwjfrgqj
Bj, ymj ujtuqj tk ymj Zsnyji Xyfyjx, ns twijw yt ktwr f rtwj ujwkjhy
zsnts, jxyfgqnxm ozxynhj, nsxzwj itrjxynh ywfsvznqnyd, uwtanij ktw ymj
htrrts ijkjsxj, uwtrtyj ymj ljsjwfq bjqkfwj, fsi xjhzwj ymj gqjxxnslx
tk qngjwyd yt tzwxjqajx fsi tzw utxyjwnyd, it twifns fsi jxyfgqnxm
ymnx Htsxynyzynts ktw ymj Zsnyji Xyfyjx tk Frjwnhf.
Fwynhqj N
Xjhynts 1
Fqq qjlnxqfynaj utbjwx mjwjns lwfsyji xmfqq gj ajxyji ns f Htslwjxx tk
ymj Zsnyji Xyfyjx, bmnhm xmfqq htsxnxy tk f Xjsfyj fsi Mtzxj tk
Wjuwjxjsyfynajx.
Xjhynts 2
Ymj Mtzxj tk Wjuwjxjsyfynajx xmfqq gj htrutxji tk rjrgjwx hmtxjs jajwd
xjhtsi djfw gd ymj ujtuqj tk ymj xjajwfq Xyfyjx, fsi ymj jqjhytw ns
jfhm Xyfyj xmfqq mfaj ymj vzfqnknhfyntsx wjvznxnyj ktw jqjhytwx tk ymj
rtxy szrjwtzx gwfshm tk ymj Xyfyj Qjlnxqfyzwj.
St ujwxts xmfqq gj f Wjuwjxjsyfynaj bmt xmfqq sty mfaj fyyfnsji ymj
flj tk ybjsyd-knaj djfwx, fsi gjjs xjajs djfwx f hnynejs tk ymj Zsnyji
Xyfyjx, fsi bmt xmfqq sty, bmjs jqjhyji, gj fs nsmfgnyfsy tk ymfy
Xyfyj ns bmnhm mj xmfqq gj hmtxjs.
Wjuwjxjsyfynajx fsi inwjhy yfcjx xmfqq gj fuutwyntsji frtsl ymj
xjajwfq Xyfyjx bmnhm rfd gj nshqziji bnymns ymnx Zsnts, fhhtwinsl yt
ymjnw wjxujhynaj szrgjwx, bmnhm xmfqq gj ijyjwrnsji gd fiinsl ymj
bmtqj szrgjw tk kwjj ujwxtsx, nshqzinsl ymtxj gtzsi yt xjwanhj ktw f
yjwr tk djfwx, fsi jchqzinsl Nsinfsx sty yfcji, ymwjj-knkymx tk fqq
tymjw ujwxtsx. Ymj fhyzfq jszrjwfynts xmfqq gj rfij bnymns ymwjj
djfwx fkyjw ymj knwxy rjjynsl tk ymj Htslwjxx tk ymj Zsnyji Xyfyjx,
fsi bnymns jajwd xzgxjvzjsy yjwr tk yjs djfwx, ns xzhm rfssjw fx ymjd
xmfqq gd qfb inwjhy. Ymj szrgjw tk Wjuwjxjsyfynajx xmfqq sty jchjji
tsj ktw jajwd ymnwyd ymtzxfsi, gzy jfhm Xyfyj xmfqq mfaj fy qjfxy tsj
Wjuwjxjsyfynaj; fsi zsynq xzhm jszrjwfynts xmfqq gj rfij, ymj Xyfyj tk
Sjb Mfruxmnwj xmfqq gj jsynyqji yt hmttxj ymwjj, Rfxxfhmzxjyyx jnlmy,
Wmtij Nxqfsi fsi Uwtanijshj Uqfsyfyntsx tsj, Htssjhynhzy knaj, Sjb
Dtwp xnc, Sjb Ojwxjd ktzw, Ujssxdqafsnf jnlmy, Ijqfbfwj tsj, Rfwdqfsi
xnc, Anwlnsnf yjs, Stwym Hfwtqnsf knaj, Xtzym Hfwtqnsf knaj, fsi
Ljtwlnf ymwjj.
Bmjs afhfshnjx mfuujs ns ymj wjuwjxjsyfynts kwtr fsd Xyfyj, ymj
Jcjhzynaj Fzymtwnyd ymjwjtk xmfqq nxxzj bwnyx tk jqjhynts yt knqq xzhm
afhfshnjx.
Ymj Mtzxj tk Wjuwjxjsyfynajx xmfqq hmttxj ymjnw Xujfpjw fsi tymjw
tkknhjwx; fsi xmfqq mfaj ymj xtqj utbjw tk nrujfhmrjsy.
Xjhynts 3
Ymj Xjsfyj tk ymj Zsnyji Xyfyjx xmfqq gj htrutxji tk ybt Xjsfytwx kwtr
jfhm Xyfyj, hmtxjs gd ymj Qjlnxqfyzwj ymjwjtk, ktw xnc djfwx; fsi jfhm
Xjsfytw xmfqq mfaj tsj atyj.
Nrrjinfyjqd fkyjw ymjd xmfqq gj fxxjrgqji ns htsxjvzjshj tk ymj knwxy
jqjhynts, ymjd xmfqq gj inaniji fx jvzfqqd fx rfd gj nsyt ymwjj
hqfxxjx. Ymj xjfyx tk ymj Xjsfytwx tk ymj knwxy hqfxx xmfqq gj
afhfyji fy ymj jcunwfynts tk ymj xjhtsi djfw, tk ymj xjhtsi hqfxx fy
ymj jcunwfynts tk ymj ktzwym djfw, fsi tk ymj ymnwi hqfxx fy ymj
jcunwfynts tk ymj xncym djfw, xt ymfy tsj-ymnwi rfd gj hmtxjs jajwd
xjhtsi djfw; fsi nk afhfshnjx mfuujs gd wjxnlsfynts, tw tymjwbnxj,
izwnsl ymj wjhjxx tk ymj Qjlnxqfyzwj tk fsd Xyfyj, ymj Jcjhzynaj
ymjwjtk rfd rfpj yjrutwfwd fuutnsyrjsyx zsynq ymj sjcy rjjynsl tk ymj
Qjlnxqfyzwj, bmnhm xmfqq ymjs knqq xzhm afhfshnjx.
St ujwxts xmfqq gj f Xjsfytw bmt xmfqq sty mfaj fyyfnsji yt ymj flj tk
ymnwyd djfwx, fsi gjjs snsj djfwx f hnynejs tk ymj Zsnyji Xyfyjx, fsi
bmt xmfqq sty, bmjs jqjhyji, gj fs nsmfgnyfsy tk ymfy Xyfyj ktw bmnhm
mj xmfqq gj hmtxjs.
Ymj Anhj-Uwjxnijsy tk ymj Zsnyji Xyfyjx xmfqq gj Uwjxnijsy tk ymj
Xjsfyj, gzy xmfqq mfaj st atyj, zsqjxx ymjd gj jvzfqqd inaniji.
Ymj Xjsfyj xmfqq hmttxj ymjnw tymjw tkknhjwx, fsi fqxt f Uwjxnijsy
_uwt_yjrutwj_, ns ymj fgxjshj tk ymj Anhj Uwjxnijsy, tw bmjs mj xmfqq
jcjwhnxj ymj tkknhj tk ymj Uwjxnijsy tk ymj Zsnyji Xyfyjx.
Ymj Xjsfyj xmfqq mfaj ymj xtqj utbjw yt ywd fqq nrujfhmrjsyx. Bmjs
xnyynsl ktw ymfy uzwutxj, ymjd xmfqq gj ts tfym tw fkknwrfynts. Bmjs
ymj Uwjxnijsy tk ymj Zsnyji Xyfyjx nx ywnji, ymj Hmnjk Ozxynhj xmfqq
uwjxnij: fsi st ujwxts xmfqq gj htsanhyji bnymtzy ymj htshzwwjshj tk
ybt-ymnwix tk ymj rjrgjwx uwjxjsy.
Oziljrjsy ns hfxjx tk nrujfhmrjsy xmfqq sty jcyjsi kzwymjw ymfs yt
wjrtafq kwtr tkknhj, fsi inxvzfqnknhfynts yt mtqi fsi jsotd fsd tkknhj
tk mtstw, ywzxy, tw uwtkny zsijw ymj Zsnyji Xyfyjx: gzy ymj ufwyd
htsanhyji xmfqq sjajwymjqjxx gj qnfgqj fsi xzgojhy yt nsinhyrjsy,
ywnfq, oziljrjsy fsi uzsnxmrjsy, fhhtwinsl yt qfb.

100
tests/caesar.constout Normal file
View File

@@ -0,0 +1,100 @@
The Constitution of the United States of America
Preamble
We, the people of the United States, in order to form a more perfect
union, establish justice, insure domestic tranquility, provide for the
common defense, promote the general welfare, and secure the blessings
of liberty to ourselves and our posterity, do ordain and establish
this Constitution for the United States of America.
Article I
Section 1
All legislative powers herein granted shall be vested in a Congress of
the United States, which shall consist of a Senate and House of
Representatives.
Section 2
The House of Representatives shall be composed of members chosen every
second year by the people of the several States, and the elector in
each State shall have the qualifications requisite for electors of the
most numerous branch of the State Legislature.
No person shall be a Representative who shall not have attained the
age of twenty-five years, and been seven years a citizen of the United
States, and who shall not, when elected, be an inhabitant of that
State in which he shall be chosen.
Representatives and direct taxes shall be apportioned among the
several States which may be included within this Union, according to
their respective numbers, which shall be determined by adding the
whole number of free persons, including those bound to service for a
term of years, and excluding Indians not taxed, three-fifths of all
other persons. The actual enumeration shall be made within three
years after the first meeting of the Congress of the United States,
and within every subsequent term of ten years, in such manner as they
shall by law direct. The number of Representatives shall not exceed
one for every thirty thousand, but each State shall have at least one
Representative; and until such enumeration shall be made, the State of
New Hampshire shall be entitled to choose three, Massachusetts eight,
Rhode Island and Providence Plantations one, Connecticut five, New
York six, New Jersey four, Pennsylvania eight, Delaware one, Maryland
six, Virginia ten, North Carolina five, South Carolina five, and
Georgia three.
When vacancies happen in the representation from any State, the
Executive Authority thereof shall issue writs of election to fill such
vacancies.
The House of Representatives shall choose their Speaker and other
officers; and shall have the sole power of impeachment.
Section 3
The Senate of the United States shall be composed of two Senators from
each State, chosen by the Legislature thereof, for six years; and each
Senator shall have one vote.
Immediately after they shall be assembled in consequence of the first
election, they shall be divided as equally as may be into three
classes. The seats of the Senators of the first class shall be
vacated at the expiration of the second year, of the second class at
the expiration of the fourth year, and of the third class at the
expiration of the sixth year, so that one-third may be chosen every
second year; and if vacancies happen by resignation, or otherwise,
during the recess of the Legislature of any State, the Executive
thereof may make temporary appointments until the next meeting of the
Legislature, which shall then fill such vacancies.
No person shall be a Senator who shall not have attained to the age of
thirty years, and been nine years a citizen of the United States, and
who shall not, when elected, be an inhabitant of that State for which
he shall be chosen.
The Vice-President of the United States shall be President of the
Senate, but shall have no vote, unless they be equally divided.
The Senate shall choose their other officers, and also a President
_pro_tempore_, in the absence of the Vice President, or when he shall
exercise the office of the President of the United States.
The Senate shall have the sole power to try all impeachments. When
sitting for that purpose, they shall be on oath or affirmation. When
the President of the United States is tried, the Chief Justice shall
preside: and no person shall be convicted without the concurrence of
two-thirds of the members present.
Judgement in cases of impeachment shall not extend further than to
removal from office, and disqualification to hold and enjoy any office
of honor, trust, or profit under the United States: but the party
convicted shall nevertheless be liable and subject to indictment,
trial, judgement and punishment, according to law.

44
tests/caesar.test Executable file
View File

@@ -0,0 +1,44 @@
#!/bin/sh
# tests/caesar.test - test functionality of caesar.
#
# Copyright (c) 1999 Joseph Samuel Myers.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. The name of the author may not be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
set -e
. tests/common
testexec caesar caesar/caesar
testno 1
caesar/caesar <tests/caesar.constin >test.out 2>&1 || failtest
compare test.out tests/caesar.constout
rm -f test.out
testno 2
caesar/caesar 21 <tests/caesar.constin >test.out 2>&1 || failtest
compare test.out tests/caesar.constout
rm -f test.out

55
tests/common Normal file
View File

@@ -0,0 +1,55 @@
#!/bin/sh
# tests/common - common functions for bsd-games testsuite.
#
# Copyright (c) 1999 Joseph Samuel Myers.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. The name of the author may not be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
# testexec game executable
testexec () {
testgame="$1"
if [ -x "$2" ]; then
true
else
exit 0
fi
}
testno () {
printf "%s" "$testgame test $1... "
}
failtest () {
echo "FAIL"
exit 1
}
compare () {
if cmp -s "$1" "$2"; then
echo "PASS"
else
failtest
fi
}

2
tests/factor.123456 Normal file
View File

@@ -0,0 +1,2 @@
123: 3 41
456: 2 2 2 3 19

1
tests/factor.123456789 Normal file
View File

@@ -0,0 +1 @@
123456789: 3 3 3607 3803

1
tests/factor.987654321 Normal file
View File

@@ -0,0 +1 @@
987654321: 3 3 17 17 379721

57
tests/factor.test Executable file
View File

@@ -0,0 +1,57 @@
#!/bin/sh
# tests/factor.test - test functionality of factor.
#
# Copyright (c) 1999 Joseph Samuel Myers.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. The name of the author may not be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
set -e
. tests/common
testexec factor factor/factor
testno 1
factor/factor 123456789 >test.out 2>&1 || failtest
compare test.out tests/factor.123456789
rm -f test.out
testno 2
factor/factor 987654321 >test.out 2>&1 || failtest
compare test.out tests/factor.987654321
rm -f test.out
testno 3
factor/factor 123 456 >test.out 2>&1 || failtest
compare test.out tests/factor.123456
rm -f test.out
testno 4
factor/factor <<EOF >test.out 2>&1 || failtest
123
456
EOF
compare test.out tests/factor.123456
rm -f test.out

3
tests/morse.SOS Normal file
View File

@@ -0,0 +1,3 @@
...,
---,
...,

3
tests/morse.foo Normal file
View File

@@ -0,0 +1,3 @@
dit dit daw dit,
daw daw daw,
daw daw daw,

1
tests/morse.sos Normal file
View File

@@ -0,0 +1 @@
sos

52
tests/morse.test Executable file
View File

@@ -0,0 +1,52 @@
#!/bin/sh
# morse.test - test functionality of morse.
#
# Copyright (c) 1999 Joseph Samuel Myers.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. The name of the author may not be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
set -e
. tests/common
testexec morse morse/morse
# morse is somewhat broken and should probably be replaced with the
# OpenBSD version. This limits the tests we can do until we fix it.
testno 1
morse/morse foo >test.out 2>&1 || failtest
compare test.out tests/morse.foo
rm -f test.out
testno 2
morse/morse -s SOS >test.out 2>&1 || failtest
compare test.out tests/morse.SOS
rm -f test.out
testno 3
morse/morse -d <tests/morse.SOS >test.out 2>&1 || failtest
compare test.out tests/morse.sos
rm -f test.out

3
tests/number.-0.1 Normal file
View File

@@ -0,0 +1,3 @@
minus
one.
tenths.

2
tests/number.123456 Normal file
View File

@@ -0,0 +1,2 @@
one hundred twenty-three thousand.
four hundred fifty-six.

3
tests/number.987654321 Normal file
View File

@@ -0,0 +1,3 @@
nine hundred eighty-seven million.
six hundred fifty-four thousand.
three hundred twenty-one.

49
tests/number.test Executable file
View File

@@ -0,0 +1,49 @@
#!/bin/sh
# number.test - test functionality of number.
#
# Copyright (c) 1999 Joseph Samuel Myers.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. The name of the author may not be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
set -e
. tests/common
testexec number number/number
testno 1
number/number -- -0.1 >test.out 2>&1 || failtest
compare test.out tests/number.-0.1
rm -f test.out
testno 2
number/number 123456 >test.out 2>&1 || failtest
compare test.out tests/number.123456
rm -f test.out
testno 3
number/number -- 987654321 >test.out 2>&1 || failtest
compare test.out tests/number.987654321
rm -f test.out

49
tests/pig.test Executable file
View File

@@ -0,0 +1,49 @@
#!/bin/sh
# pig.test - test functionality of pig.
#
# Copyright (c) 1999 Joseph Samuel Myers.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. The name of the author may not be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
set -e
. tests/common
testexec pig pig/pig
testno 1
echo "This is a test." |pig/pig >test.out 2>&1 || failtest
compare test.out tests/pig.test1
rm -f test.out
testno 2
echo "Is this a test?" |pig/pig >test.out 2>&1 || failtest
compare test.out tests/pig.test2
rm -f test.out
testno 3
echo "IS THIS A TEST?" |pig/pig >test.out 2>&1 || failtest
compare test.out tests/pig.test3
rm -f test.out

1
tests/pig.test1 Normal file
View File

@@ -0,0 +1 @@
Isthay isway away esttay.

1
tests/pig.test2 Normal file
View File

@@ -0,0 +1 @@
Isway isthay away esttay?

1
tests/pig.test3 Normal file
View File

@@ -0,0 +1 @@
ISWAY ISTHAY AWAY ESTTAY?

1
tests/pom.1998fm1 Normal file
View File

@@ -0,0 +1 @@
Mon 1998 Jan 12 17:00:00 (UTC): The Moon was Full

1
tests/pom.1998fm2 Normal file
View File

@@ -0,0 +1 @@
Wed 1998 Nov 4 05:00:00 (UTC): The Moon was Full

1
tests/pom.1998fq1 Normal file
View File

@@ -0,0 +1 @@
Mon 1998 Jan 5 14:00:00 (UTC): The Moon was at the First Quarter

1
tests/pom.1998fq2 Normal file
View File

@@ -0,0 +1 @@
Wed 1998 Oct 28 12:00:00 (UTC): The Moon was at the First Quarter

1
tests/pom.1998lq1 Normal file
View File

@@ -0,0 +1 @@
Tue 1998 Jan 20 20:00:00 (UTC): The Moon was at the Last Quarter

1
tests/pom.1998lq2 Normal file
View File

@@ -0,0 +1 @@
Wed 1998 Nov 11 00:00:00 (UTC): The Moon was at the Last Quarter

1
tests/pom.1998nm1 Normal file
View File

@@ -0,0 +1 @@
Wed 1998 Jan 28 06:00:00 (UTC): The Moon was New

1
tests/pom.1998nm2 Normal file
View File

@@ -0,0 +1 @@
Tue 1998 Oct 20 10:00:00 (UTC): The Moon was New

84
tests/pom.test Executable file
View File

@@ -0,0 +1,84 @@
#!/bin/sh
# pom.test - test functionality of pom.
#
# Copyright (c) 1999 Joseph Samuel Myers.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. The name of the author may not be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
set -e
. tests/common
testexec pom pom/pom
# Test dates from Astronomical Almanac 1998, rounded to nearest hour.
# Should add dates from other years.
# We should also test the fraction illuminated given by the program, but
# it isn't really accurate enough to do this reliably and the Astronomical
# Almanac only gives these figures to 2 decimal places (like pom) so I don't
# know which are border cases and which are good tests.
export TZ=UTC0
testno 1
pom/pom 1998010514 >test.out 2>&1 || failtest
compare test.out tests/pom.1998fq1
rm -f test.out
testno 2
pom/pom 1998011217 >test.out 2>&1 || failtest
compare test.out tests/pom.1998fm1
rm -f test.out
testno 3
pom/pom 1998012020 >test.out 2>&1 || failtest
compare test.out tests/pom.1998lq1
rm -f test.out
testno 4
pom/pom 1998012806 >test.out 2>&1 || failtest
compare test.out tests/pom.1998nm1
rm -f test.out
testno 5
pom/pom 1998102010 >test.out 2>&1 || failtest
compare test.out tests/pom.1998nm2
rm -f test.out
testno 6
pom/pom 1998102812 >test.out 2>&1 || failtest
compare test.out tests/pom.1998fq2
rm -f test.out
testno 7
pom/pom 1998110405 >test.out 2>&1 || failtest
compare test.out tests/pom.1998fm2
rm -f test.out
testno 8
pom/pom 1998111100 >test.out 2>&1 || failtest
compare test.out tests/pom.1998lq2
rm -f test.out

10
tests/ppt.Foobarnl Normal file
View File

@@ -0,0 +1,10 @@
___________
| o .oo |
| oo o.ooo|
| oo o.ooo|
| o . |
| oo . o |
| oo . o|
| ooo . o |
| o. o |
___________

9
tests/ppt.foobar Normal file
View File

@@ -0,0 +1,9 @@
___________
| oo .oo |
| oo o.ooo|
| oo o.ooo|
| o . |
| oo . o |
| oo . o|
| ooo . o |
___________

49
tests/ppt.test Executable file
View File

@@ -0,0 +1,49 @@
#!/bin/sh
# ppt.test - test functionality of ppt.
#
# Copyright (c) 1999 Joseph Samuel Myers.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. The name of the author may not be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
set -e
. tests/common
testexec ppt ppt/ppt
testno 1
ppt/ppt "foo bar" >test.out 2>&1 || failtest
compare test.out tests/ppt.foobar
rm -f test.out
testno 2
ppt/ppt foo bar >test.out 2>&1 || failtest
compare test.out tests/ppt.foobar
rm -f test.out
testno 3
echo "Foo bar" |ppt/ppt >test.out 2>&1 || failtest
compare test.out tests/ppt.Foobarnl
rm -f test.out

25
tests/primes.100 Normal file
View File

@@ -0,0 +1,25 @@
2
3
5
7
11
13
17
19
23
29
31
37
41
43
47
53
59
61
67
71
73
79
83
89
97

24
tests/primes.1e6 Normal file
View File

@@ -0,0 +1,24 @@
1000003
1000033
1000037
1000039
1000081
1000099
1000117
1000121
1000133
1000151
1000159
1000171
1000183
1000187
1000193
1000199
1000211
1000213
1000231
1000249
1000253
1000273
1000289
1000291

16
tests/primes.1e9 Normal file
View File

@@ -0,0 +1,16 @@
1000000007
1000000009
1000000021
1000000033
1000000087
1000000093
1000000097
1000000103
1000000123
1000000181
1000000207
1000000223
1000000241
1000000271
1000000289
1000000297

49
tests/primes.test Executable file
View File

@@ -0,0 +1,49 @@
#!/bin/sh
# primes.test - test functionality of primes.
#
# Copyright (c) 1999 Joseph Samuel Myers.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. The name of the author may not be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
set -e
. tests/common
testexec primes primes/primes
testno 1
primes/primes 1 100 >test.out 2>&1 || failtest
compare test.out tests/primes.100
rm -f test.out
testno 2
primes/primes 1000000 1000300 >test.out 2>&1 || failtest
compare test.out tests/primes.1e6
rm -f test.out
testno 3
primes/primes 1000000000 1000000300 >test.out 2>&1 || failtest
compare test.out tests/primes.1e9
rm -f test.out

2
tests/rot13.FooBar Normal file
View File

@@ -0,0 +1,2 @@
Sbb
One

1
tests/rot13.foo Normal file
View File

@@ -0,0 +1 @@
sbb

49
tests/rot13.test Executable file
View File

@@ -0,0 +1,49 @@
#!/bin/sh
# rot13.test - test functionality of rot13.
#
# Copyright (c) 1999 Joseph Samuel Myers.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. The name of the author may not be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
set -e
. tests/common
testexec rot13 caesar/rot13
testno 1
caesar/rot13 >test.out 2>&1 <<EOF || failtest
foo
EOF
compare test.out tests/rot13.foo
rm -f test.out
testno 2
caesar/rot13 >test.out 2>&1 <<EOF || failtest
Foo
Bar
EOF
compare test.out tests/rot13.FooBar
rm -f test.out

7
wtf/Makefile.bsd Normal file
View File

@@ -0,0 +1,7 @@
# $NetBSD: Makefile,v 1.1 1999/07/22 01:03:20 mrg Exp $
SCRIPTS= wtf
SCRIPTSDIR= /usr/games
MAN= wtf.6
.include <bsd.prog.mk>

37
wtf/Makefrag Normal file
View File

@@ -0,0 +1,37 @@
# Makefrag - makefile fragment for wtf
#
# Copyright (c) 1999 Joseph Samuel Myers.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. The name of the author may not be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
wtf_DIRS := $(GAMESDIR) $(MAN6DIR) $(shell dirname $(WTF_ACRONYMFILE))
wtf_all: wtf/wtf wtf/wtf.6
wtf_install: wtf_all
$(INSTALL_SCRIPT) wtf/wtf $(INSTALL_PREFIX)$(GAMESDIR)/wtf
$(HIDE_GAME) wtf
$(INSTALL_DATA) wtf/acronyms $(INSTALL_PREFIX)$(WTF_ACRONYMFILE)
$(INSTALL_MANUAL) wtf/wtf.6

91
wtf/acronyms Normal file
View File

@@ -0,0 +1,91 @@
$NetBSD: acronyms,v 1.40 1999/09/16 12:47:31 kleink Exp $
AFAICR as far as I can recall
AFAICT as far as I can tell
AFAIK as far as I know
AFAIR as far as I recall
AFK away from keyboard
ASAP as soon as possible
BBL [I'll] be back later
BBS be back soon
BFD big fucking deal
BIAB back in a bit
BIAF back in a few
BIAS back in a second
BIAW back in a while
BRB [I'll] be right back
BTTH butt to the head
BTW by the way
CMIIW correct me if I'm wrong
CNP continued [in my] next post
DNDK don't know, don't care
DTRT do the right thing
DTWT do the wrong thing
DWIM do what I mean
EG evil grin
EMSG email message
ETLA extended three letter acronym
FSDO for some definition of
FUBAR fucked up beyond all recognition
FUD fear, uncertianty and doubt
FWIW for what it's worth
FYI for your information
G grin
GMTA great minds think alike
HHIS hanging head in shame
HTH hope this helps
IANAL I am not a lawyer
IIANM if I am not mistaken
IIRC if I recall correctly
IMCO in my considered opinion
IMHO in my humble opinion
IMNSHO in my not so humble opinion
IMO in my opinion
IOW in other words
IRL in real life
ISTM it seems to me
ISTR I seem to recall
JMO just my opinion
JTLYK just to let you know
KISS keep it simple, stupid
L8R later
LMSO laughing my socks off
LOL laughing out loud
LTNS long time no see
MTF more to follow
MYOB mind your own business
NFC no fucking clue
NFI no fucking idea
NIH not invented here
NRN no reply necessary
OIC oh, I see
OTOH on the other hand
OTTOMH off the top of my head
PITA pain in the ass
PPL pretty please
RL real life
ROTFL rolling on the floor laughing
RTFB read the fine book
RTFM read the fine manual
RTFMP read the fine man page
RTFS read the fine source
SEP someone else's problem
SFA sweet fuck all
SHID slaps head in disgust
SMLSFB So many losers, so few bullets
SMOP simple matter of programming
SNAFU situation normal, all fucked up
SNERT Snot-Nosed egotistical rude teenager
SO significant other
SOL shit out [of] luck
TIA thanks in advance
TLA three letter acronym
TMI too much information
TTFN ta ta for now
TYVM thank you very much
UTSL use the source, Luke
VEG very evil grin
WTF {what,where,who,why} the fuck
WTH {what,where,who,why} the hell
YKWIM you know what I mean
YMMV your mileage may vary

49
wtf/wtf.6.in Normal file
View File

@@ -0,0 +1,49 @@
.\" $NetBSD: wtf.6,v 1.3 1999/07/25 20:29:04 briggs Exp $
.\"
.\" Public Domain
.\"
.Dd July 21, 1999
.Dt WTF 6
.Os
.Sh NAME
.Nm wtf
.Nd translates acronyms for you
.Sh SYNOPSIS
.Nm
.Op Ar is
.Ar acronym Ar ...
.Sh DESCRIPTION
The
.Nm
utility displays the expansion of the acronyms
specified on the command line. If the acronym is unknown,
.Nm
will check to see if the acronym is known by the
.Xr whatis 1
command.
.Pp
If
.Dq is
is specified on the command line, it will be ignored, allowing the
fairly natural
.Dq wtf is WTF
usage.
.Sh ENVIRONMENT
.Bl -tag -width ACRONYMDB
.It Ev ACRONYMDB
The default acronym database may be overridden by setting the
environment variable
.Ev ACRONYMDB
to the name of a file in the proper format (acronym[tab]meaning).
.El
.Sh FILES
.Bl -tag -width @wtf_acronymfile@ -compact
.It Pa @wtf_acronymfile@
default acronym database.
.El
.Sh SEE ALSO
.Xr whatis 1
.Sh HISTORY
.Nm
first appeared in
.Nx 1.5 .

36
wtf/wtf.in Executable file
View File

@@ -0,0 +1,36 @@
#!/bin/sh
#
# $NetBSD: wtf,v 1.5 1999/08/13 03:02:06 sommerfeld Exp $
#
# Public domain
#
acronyms=${ACRONYMDB:-@wtf_acronymfile@}
if [ X"$1" = X"is" ] ; then
shift
fi
if [ $# -lt 1 ] ; then
echo "Usage: $0 [is] <acronym>"
fi
rv=0
while [ $# -gt 0 ] ; do
target=`echo $1 | tr '[a-z]' '[A-Z]'`
ans=`sed -ne "/^$target[[:space:]]/s/^$target[[:space:]]*//p" \
< $acronyms 2>/dev/null`
if [ "$ans" != "" ] ; then
echo "$target: $ans"
else
ans=`whatis $1 2> /dev/null | egrep "^$1[, ]" 2> /dev/null`
if [ $? -eq 0 ] ; then
echo "$1: $ans"
else
echo "Gee... I don't know what $1 means..." 1>&2
rv=1
fi
fi
shift
done
exit $rv