MRDCH@TAURUS.BITNET (06/09/85)
From: Mordechai Chachamu <mrdch@taurus.BitNet>
Hello everybody!!!
Since I posted the news about the GALAXY game, I received
about 30 requests to post the sources. I don't know if that
number is considered big or not, but it was more than I could
handle by private communication.
So here it is. I have packed it all in 10 files, to be sent one
after the other. There are few things that require special attention
1. The files are all expanded (no tabs). The Makefiles within the
sources should be unexpanded in order to function.
2. The game runs on 780 with 4.1 BSD but was tested with 4.2 with no
apparent problems. It seems to me a little too big for 64K
machines, but I didn't check that out.
3. I am eagerly waiting for reactions. This point is mentioned in
almost any conceivable point.
4. If the game will stir interest, and players would like to comment
about it to other players, may be another news group should be
formed.
5. Please take note of the conditions for installation in
"install_howto".
This is file #1 out of 10. It contains files with installation remarks
and the manual page.
# This is a shell archive.
# Remove everything above and including the cut line.
# Then run the rest of the file through sh.
-----cut here-----cut here-----cut here-----cut here-----
#!/bin/sh
# shar: Shell Archiver
# Run the following text with /bin/sh to create:
# Manifest
# READ_ME
# install.sh
# install_howto
# galaxy.6
# galaxy.man
# This archive created: Sat Jun 8 14:16:52 1985
echo shar: extracting Manifest '(1962 characters)'
cat << \SHAR_EOF > Manifest
Comments on:
Why we did what we did and who helped us
Mordechai Chachamu
Amnnon Horowits
1. Background
The idea of galaxy came to me (the first author) few
years ago. I felt that the video games, and in general -
computerized games, are usually thrilling only for few
times. They either depend on swift reactions and/or sheer
luck, or implement a computerized versions of old games.
Thus I looked for a game that answers two criteria:
1) It is practically impossible to be played without a com-
puter.
2) The computer has no influence upon the outcome of the
game.
The way to satisfy those seemingly contradictory
requirements was to create a game that challenges TWO
players sitting at TWO different terminals. The game uses
the computer merely as a data base manager and as a
transmitting media between the two players. Skimming through
the game's document will soon reveal that there is no
rational way to play this game without a computer.
As the game evolved, it became clear that it implements
some more principles. Namely -
3) You can never have it all.
4) There is no "best solution".
5) There is always some amount of uncertainity.
We feel that although the game is hard to get familiar
with, once it's principles and their implementation is
understood, GALAXY is a very attractive game.
First attempts to write the game were futile, mostly
because I lucked knowledge in UNIX. At this stage came to
rescue the second author, that managed most of the tricky
parts.
2. Acknowledgments
Many thanks to the people in the computer lab of Tel
Aviv University. Specially helpful (and encouraging) were
Nir Peleg, On Paradise and Robert Segall.
Mordechai Chachamu (mrdch@taurus)
Amnnon Horowits (amnnon@taurus)
SHAR_EOF
if test 1962 -ne "`wc -c Manifest`"
then
echo shar: error transmitting Manifest '(should have been 1962 characters)'
fi
echo shar: extracting READ_ME '(968 characters)'
cat << \SHAR_EOF > READ_ME
What have we got here:
This directory contains ALL what it takes to install, run and
(hopefully) understand the game of GALAXY.
Files:
Manifest - some background motivation and "history".
install_howto - detailed description of installing procedure.
install.sh - a shell script that does it all. Read it first!!!
Directories:
src - GALAXY main source.
src1 - secondary source. command files, response stuff, etc.
man - manual page.
doc - galaxy's document.
online - galaxy's document as it apears on line during the game.
We will be *VERY* glad to receive ANY comment. Mail to:
{mrdch,amnnon}@taurus (BITNET)
{mrdch,amnnon}@taurus.bitnet@berkely (ARPA)
{mrdch,amnnon}%taurus.bitnet@wiscvm.ARPA (CSNET)
and if all fails, then
...!decvax!humus!taurus!{mrdch,amnnon} (UUCP)
SHAR_EOF
if test 968 -ne "`wc -c READ_ME`"
then
echo shar: error transmitting READ_ME '(should have been 968 characters)'
fi
echo shar: extracting install.sh '(1909 characters)'
cat << \SHAR_EOF > install.sh
# This is the galaxy maker.
# Be sure to set the following shell-variables before you run this
# command file.
# Since this file has to use super-user privileges, be sure to read
# it before you use it.
# Good luck.
SDIR=.
#SDIR=/users/guest/galaxy/distr
SOURCES=$SDIR/src
SOURCES1=$SDIR/src1
LIBDIR=/usr/games/lib/galaxy
MAN=$SDIR/man
DOC=$SDIR/doc
ONLINE=$SDIR/online
cat << Funny
Warning: Read this file before running it!
Warning: This file must be run with super_user priviliges.
Before running it , create a user named galaxy,
group - games.
Shall I proceed ?
Funny
read answer
if [ "$answer" != y ]; then
echo GoodBye
exit 1
fi
if [ ! -d $LIBDIR ]; then
mkdir $LIBDIR
chuser galaxy $LIBDIR
exit 1
fi
cd $SOURCES; make galaxy
cd $SOURCES1; make all
mkdir $LIBDIR/online ; chuser galaxy $LIBDIR/online
cp $ONLINE/* $LIBDIR/online ; chuser galaxy $LIBDIR/online/*
# install all files in library directory....
cd $LIBDIR
cp $SOURCES/galaxy galaxy.out # galaxy main program
chuser galaxy galaxy.out
chmod 4111 galaxy.out
cp $SOURCES1/pager pager # call the second user
chuser galaxy pager
cp $SOURCES1/local local # 2 terminal I/O handler
chuser galaxy local
cp $SOURCES1/galaxy.motd galaxy.motd # general note
chuser galaxy galaxy.motd
cp $SOURCES1/galaxy.csh /usr/games/galaxy # command file.
chuser galaxy /usr/games/galaxy
chmod 755 /usr/games/galaxy
cp $SOURCES1/okgalaxy /usr/games/okgalaxy # response program
chuser galaxy /usr/games/okgalaxy
echo > galaxy.scor # score file.
chuser galaxy galaxy.scor
echo > wizards # wizard file.
chmod 644 wizards
chuser galaxy wizards
cp $MAN/galaxy.6 /usr/man/man6/galaxy.6 # manual
cp $DOC/galaxy.doc /usr/doc/galaxy # document
SHAR_EOF
if test 1909 -ne "`wc -c install.sh`"
then
echo shar: error transmitting install.sh '(should have been 1909 characters)'
fi
echo shar: extracting install_howto '(7263 characters)'
cat << \SHAR_EOF > install_howto
***************************************************************
* PLEASE NOTICE THE FOLLOWING CONDITIONS *
***************************************************************
As the authors of the game, we would like to make some
requests and remarks concerning the game installation.
1. The sources contained hereby are distributed free, for the
much hoped enjoyment of all game lovers.
2. Being in public domain, anyone is entitled to change/add/delete
anything he wishes.
3. We make a distinction between two kinds of changes:
"Bug fix" - a change that brings the game to act closer to
the way it should. (As defined in the document).
"Enhancement" - a change that alters the way a player THINKS
during the play.
As a test to distinguish between the two, one should answer
the question:
"Will I play differently BECAUSE of that change?"
4. We would appreciate hearing about changes of the first kind.
If possible, please mail them to us.
5. If a change of the second kind is introduced, we expect the
person to compile it under a DIFFERENT name.
(However similar to the origin). In addition, we would like
to hear about it, and the reasoning behind it.
7. The game may be redistributed on the condition that no file
from the original distribution will be left out.
8. The reason for the requests above is:
Galaxy is different from many computer games, by involving
TWO players at the same time. It is our wish that two
people from different SITES will be able to compete one
against the other. This can be achieved ONLY if the rules and
conditions specified in the document remain intact.
9. On the other hand, we are eagerly waiting for reactions
of any kind. If there will be some public opinion concerning
the way the game SHOULD be, we will correct it on future
versions.
***************************************************************
* END OF CONDITIONS. NOW THE FUN. *
***************************************************************
Installing galaxy - Three ways to treat a lady.
1. Run the install.sh in this directory. It must be run with
Super User privileges, so at least read it before typing
the command.
2. Refer to the end of this document, which outlines a step by
step procedure.
3. Read further, and possibly gain more insight to the structure
of this game.
Contents of the distribution directory.
The distribution directory contains several subdirectories:
"Src" holds the source for the main program and "src1" has the
source for miscellaneous programs.
"Man" holds the manual page, for general reference.
"Doc" contains the complete documentation for the novice and
experienced player.
"Online" is the same document in small pieces, that can be viewed
during the game.
After compiling the source two programs are obtained:
"Galaxy" and "okgalaxy".
"Galaxy" is the game itself. Whenever a user wishes to challenge
somebody to this play, he should run "galaxy". If the offer is
accepted, the other user runs "okgalaxy".
Protection
In order to enjoy the game to it's full potential, ALL relevant
files should have their access bits set so that NO forgery
is possible. When a game is saved, the saved file belongs to
"galaxy", and it's mode set to 600.
The two runable modules belong to galaxy.
Their mode should be 4111.
The directory "/usr/games/lib/galaxy" is to be owned by galaxy too,
and have it's mode bits set to 700.
Manuals
"Nroff" the document and the manual page. Place them in their
appropriate place.
(The "galaxy.doc" at "/usr/doc" and "galaxy.nrf" in "/usr/doc/nroffed").
The "online" holds the entries for the online "help" facility of
the game. It should be copied entirely to "/usr/games/lib/galaxy/online"
directory.
Terminals
The screen is a vital instrument here. The game looks for the type
of terminal used, as defined by TERM in the environment. It then
extracts some entries from the "termcap" data base. If the
terminal lacks some basic capabilities, the session will be aborted.
***** High baud rates are recommended. *****
One feature of the game is it's ability to make good use of
2 screens terminals. There is NO entry for "FLip to the next page" and
"Flip Back to the previous page" in termcap(5). In many new terminals
such capability exists. If such is the case at your place, add those
two entries. We have defined them as "fl" and "fb" respectively.
Installation - step by step
The procedure outlined here is a detailed version of the
command file install.sh in this directory.
It is assumed that a uid named "galaxy" is created, within the
"games" group. To avoid use of super user privileges, all files
belong to galaxy.
The variables outlined here can be freely changed.
SDIR = /users/guest/galaxy/distr ; the "home" dir.
; subdirectories within "home" directory.
SOURCES = $SDIR/src
SOURCES1 = $SDIR/src1
MAN = $SDIR/man
DOC = $SDIR/doc
ONLINE = $SDIR/online
; where most of the game will reside
LIBDIR = /usr/games/lib/galaxy
; create LIBDIR with galaxy ownership
mkdir $LIBDIR
chuser galaxy $LIBDIR
; compile the programs
cd $SOURCES; make galaxy
cd $SOURCES1; make all
; transfer them to their place and take care of mode bits
cd $LIBDIR
cp $SOURCES/galaxy galaxy.out # galaxy main program
chuser galaxy galaxy.out
chmod 4111 galaxy.out
cp $SOURCES1/pager pager # call the second user
chuser galaxy pager
cp $SOURCES1/local local # 2 terminal I/O handler
chuser galaxy local
cp $SOURCES1/galaxy.csh /usr/games/galaxy # command file.
chuser galaxy /usr/games/galaxy
chmod 755 /usr/games/galaxy
cp $SOURCES1/okgalaxy /usr/games/okgalaxy # response program
chuser galaxy /usr/games/okgalaxy
; create the score file
echo > galaxy.scor # score file.
chuser galaxy galaxy.scor
; take care of documentation
cp $MAN/galaxy.6 /usr/man/man6/galaxy.6 # manual
cp $DOC/galaxy.doc /usr/doc/galaxy # document
; and the online documentation
mkdir $LIBDIR/online ; chuser galaxy $LIBDIR/online
cp $ONLINE/* $LIBDIR/online ; chuser galaxy $LIBDIR/online/*
; The following suggestions are not essential, but recommended.
make a file in /usr/games/lib/galaxy by the name "wizards".
This file should contain login names of people who would
like to experiment and debug (???) things in that game.
Copy the sources to /usr/src/games/galaxy
Read the "Terminals" paragraph above, and see if you can do
something about it.
We cannot over-emphasize our request for comments criticism and,
yes, even encouragements.
Please mail them to
Our address:
{mrdch,amnnon}@taurus (BITNET)
{mrdch,amnnon}@taurus.bitnet@berkeley (ARPA)
{mrdch,amnnon}%taurus.bitnet@wiscvm.ARPA (CSNET)
and if all fails, then
...!decvax!humus!taurus!{mrdch,amnnon} (UUCP)
Mordechai Chachamu
Amnon Horowits
SHAR_EOF
if test 7263 -ne "`wc -c install_howto`"
then
echo shar: error transmitting install_howto '(should have been 7263 characters)'
fi
echo shar: extracting galaxy.6 '(2121 characters)'
cat << \SHAR_EOF > galaxy.6
.TH GALAXY 6 MRDCH&AMNNON
.SH NAME
galaxy, okgalaxy \- A two player duel in space
.SH SYNOPSIS
.B /usr/games/galaxy
[ \-t \-a \-m user ]
.br
.B /usr/games/okgalaxy
.SH DESCRIPTION
.I Galaxy
is a game of strategy and cunning for two players.
It is played on two different CRT terminals, which must be
from among those supported by vi(1). The game displays a map of a remote
part of the universe, with two identical galaxies on each terminal.
Each player owns one galaxy. The aim of the game is to conquer the
opponent's Capital, which is the center of his galaxy.
.I Both players
give commands simultaneously, without knowing the enemy's position
and intentions.
.br
There are quite a few commands, that enable each player
to perform various tasks. Refer to the
.I Galaxy's
document for specification. The "help" command enables online
review of major parts from that document.
.PP
To play the
.I
galaxy
game, run /usr/games/galaxy.
You will be asked
who do you want to play with. You should specify a logged in user name.
That user will receive a message asking him to accept the challenge.
If he accepts, he should run /usr/games/okgalaxy
within some reasonable time. Only then the game starts.
.PP
If you wish to practice
.I
galaxy
you can enter "-null" instead of a real user name. You then have
the ability to see and/or command the "other" side by giving the
"cp" (change player) command. You can switch back easily
by the same command.
.PP
To see the scores obtained so far, run /usr/games/galaxy with the following options:
.br
\-t \- show the top 10 players and related statistics.
.br
\-a \- show all games played so far.
.br
\-m \- show all the games played by you.
.br
user \- show all games played by 'user'.
.br
Further documentation may be found in
.I
Galaxy's
document.
.SH FILES
/usr/games/lib/galaxy library directory.
.SH SEE ALSO
M. Chachamu and A. Horowits
.I Galactical War
.SH BUGS
Infinity is a good approximtion.
The document is lengthy and lacks humor.
.br
.I Please
mail any bugs or comments to the authors at taurus.
.SH AUTHORS
Mordechai Chachamu
.br
Amnon Horowits.
SHAR_EOF
if test 2121 -ne "`wc -c galaxy.6`"
then
echo shar: error transmitting galaxy.6 '(should have been 2121 characters)'
fi
echo shar: extracting galaxy.man '(2661 characters)'
cat << \SHAR_EOF > galaxy.man
GALAXY(6) UNIX Programmer's Manual GALAXY(6)
NAME
galaxy, okgalaxy - A two player duel in space
SYNOPSIS
/usr/games/galaxy [ -t -a -m user ]
/usr/games/okgalaxy
DESCRIPTION
_G_a_l_a_x_y is a game of strategy and cunning for two players.
It is played on two different CRT terminals, which must be
from among those supported by vi(1). The game displays a map
of a remote part of the universe, with two identical galax-
ies on each terminal. Each player owns one galaxy. The aim
of the game is to conquer the opponent's Capital, which is
the center of his galaxy. _B_o_t_h _p_l_a_y_e_r_s give commands simul-
taneously, without knowing the enemy's position and inten-
tions.
There are quite a few commands, that enable each player to
perform various tasks. Refer to the _G_a_l_a_x_y'_s document for
specification. The "help" command enables online review of
major parts from that document.
To play the _g_a_l_a_x_y game, run /usr/games/galaxy. You will be
asked who do you want to play with. You should specify a
logged in user name. That user will receive a message ask-
ing him to accept the challenge. If he accepts, he should
run /usr/games/okgalaxy within some reasonable time. Only
then the game starts.
If you wish to practice _g_a_l_a_x_y you can enter "-null" instead
of a real user name. You then have the ability to see and/or
command the "other" side by giving the "cp" (change player)
command. You can switch back easily by the same command.
To see the scores obtained so far, run /usr/games/galaxy
with the following options:
-t - show the top 10 players and related statistics.
-a - show all games played so far.
-m - show all the games played by you.
user - show all games played by 'user'.
Further documentation may be found in _G_a_l_a_x_y'_s document.
FILES
/usr/games/lib/galaxy library directory.
SEE ALSO
M. Chachamu and A. Horowits _G_a_l_a_c_t_i_c_a_l _W_a_r
BUGS
Infinity is a good approximtion. The document is lengthy
and lacks humor.
_P_l_e_a_s_e mail any bugs or comments to the authors at taurus.
Printed 6/8/85 MRDCH&AMNNON 1
GALAXY(6) UNIX Programmer's Manual GALAXY(6)
AUTHORS
Mordechai Chachamu
Amnon Horowits.
Printed 6/8/85 MRDCH&AMNNON 2
SHAR_EOF
if test 2661 -ne "`wc -c galaxy.man`"
then
echo shar: error transmitting galaxy.man '(should have been 2661 characters)'
fi
# End of shell archive
exit 0MRDCH@TAURUS.BITNET (06/09/85)
From: Mordechai Chachamu <mrdch@taurus.BitNet>
Hello everybody!!!
This is part #2 out of 10. It contains the complete document
of galaxy (raw and nroffed). It should be placed in ~galaxy/doc.
mrdch
# This is a shell archive.
# Remove everything above and including the cut line.
# Then run the rest of the file through sh.
-----cut here-----cut here-----cut here-----cut here-----
#!/bin/sh
# shar: Shell Archiver
# Run the following text with /bin/sh to create:
# Galaxy.doc
# Galaxy.nrf
# Makefile
# This archive created: Fri Jun 7 23:07:27 1985
echo shar: extracting Galaxy.doc '(35910 characters)'
cat << \SHAR_EOF > Galaxy.doc
.TL
Galactical War \- a new fascinating game for two players.
.AU
Mrdch and Amnnon
.AB
You were a mighty king of a splendid galaxy, reigning your kingdom
in peace and abundance for hundreds of years.
It all ended suddenly
(and sadly) when
cruel and powerful villains invaded your galaxy. You made a
hasty retreat, managing to rescue only a small party
of your most loyal subjects.
Not much of your enormous treasure was saved,
and you had only a few ships left
at your command. After years of wandering in the unimaginably large
universe, you stumble upon a galaxy which appears uninhabited, yet
suitable as a first move in attempting to regain your glory.
You install your Capital at
the center of the galaxy.
As a precaution you send patrol ships to explore
your surroundings. On their return, they bring bad news.
In a nearby galaxy, there is another
kingdom. You decide not to let another catastrophe happen to you.
This time, you are determined to destroy the enemy.
Feeding your computer with all the available information about
this part of the universe produces the following result:
.AE
.PP
.DS
.\" .if t \F2(fx\f2\s10
.ss 19
* # # # # # @
* * @ @
* * * # # # @ @
* * * * # # # @ @ @ @
* @
* * @ @
* * * * * * * # # # @ @ @ @ @ @ @
* * @ @
*
* * * * # # # @ @ @ @
* * * # # # @ @ @
* * @ @
* # # # # # @
.ss 12
.\" .if t \s0\fP\F2I
.DE
.NH
Key concepts
.IP Tellers 10
Teller is the official money used in the universe. One teller equals
150 Uni-Kilos of gold. You currently have 100 Tellers. (The coin
is named after Hieronimus X. Teller, the man who discovered the
existence of Natural Plastic.)
.IP Ships 10
When you escaped, you had with you 15
A-type HAWKs (High Acceleration War
Kruisers). An A-type HAWK is equipped
with 65 Mega Hertz Laser Blasters , 4 H-bomb Launchers and a 100
Erg Shield. Laser Blasters are used in ship to ship battle,
H-bombs can hit stars. The shield protects you from offensive weapons
used by the enemy. If knowledge is acquired, better ships can be built.
.IP Missiles 10
Missiles are stationary devices that have the capability to intercept
the landing (or the passage) of an enemy ship, and destroy it.
Their activation depends only on the detection of the approaching ship(s).
When detection is made, the missile steers itself
towards the ship and explodes it.
.IP ALMs 10
Anti-Landing-Mines (ALMs) are useful devices to be left on deserted planets.
After their installation they radiate in such a manner that destroys
human body. Anyone (even you) trying to land on such planet
without deactivating the ALMs will have the landing ships destroyed.
The ALMs are detectable and can be remotely deactivated.
If this is done, the planet is completely safe.
.IP Fighters 10
In each A-type HAWK there are 64 fighters, so you have 960
fighters in combat position.
You can recruit additional fighters from among your citizens.
.IP Citizens 10
There are 100 citizens with you. They will work the fields and labor in
the factories, supplying all the life necessities to the entire population.
The number of citizens
increases annually by 10%. Each citizen pays
1 Teller per GSY (Galactical Standard Year), as tax.
.NH
Other objects in the game.
.NH 2
Planets' Properties.
.PP
All the planets in the galaxy are rich
in natural resources. You can establish one or more colonies
on any of the planets.
These colonies can contribute to the war effort in several ways:
.IP 1: 3
Providing nourishment and other life necessities.(Agricultural planet).
.IP 2: 3
Providing mining metals needed to build additional war-ships.(Mining planet).
.IP 3: 3
Building new ships.(Industrial planet).
.IP 4: 3
Developing faster, stronger and more efficient weapons.(Scientific planet).
.PP
Naturally, each activity carried out in a colony requires manpower.
You will have to assign citizens or fighters for that purpose.
.NH 2
Technological Development.
.PP
Assigning people to work as scientists and investing money in
basic research will lead to the development of better weapons.
Better weapons mean ships that need half the manpower to operate,
carry twice the amount of blasting power and
their shield is twice heavier.
When you posses enough knowledge to build B-type ships, you can
build both A-type and B-type ships. More development will allow you to
build C-type ships, etc.
Of course, in order to develop a more advanced technology, you
need to invest more man-time and money (for each successive level) .
.NH 2
Constructing ships.
.PP
When you have the knowledge, the material, the money, and the
manpower needed to build another HAWK and you wish to do so,
you can build any type of ship you wish.
.NH 2
Espionage.
.PP
Information is a "survive or perish" factor. Knowing the enemy's
bases, war-potential, mines etc. is more than helpful to decide
what to do next. Not knowing it... well.
You can send spies to any star in the galaxy. Be sure to supply
them with enough money to bribe or spend in any way necessary to solicit
the required information .
Not surprisingly, the enemy knows the importance of knowledge too.
You can defend yourself in two ways:
.IP 1: 3
Passively, by tightening up security on the planet ("Black out").
This will make it harder for the enemy's spies to reveal
the truth about the planet. They will have to spend more money,
(and time) to get the information. Nevertheless, no planet can
be totally secured against information leaks.
.IP 2: 3
Actively, by investing money in counter-espionage.
This will NOT prevent the enemy's spies from getting the
information, but as soon as he knows something, you will be
notified exactly what information fell into the enemy's
hands. Unfortunately, this counter-espionage is not spy-proof.
The enemy can discover that you know already about
his hard-acquired information by investing in
counter-counter-espionage. This can go on and on, but
it seems that after a certain point, knowing
that the enemy KNOWS something is of little importance, for
the facts are (possibly) much different by that time.
.NH 2
Time
.PP
The GSY (Galactical
Standard Year) is the time reference for you and your enemy. Each
GSY has 100 GSDs (Galactical Standard Day). The current
time is updated at the end of each command.
Some commands are carried out immediately, while other take time
to be completed. The following events are time consuming,
and their effect is only evident at the end of the year:
.PP
Tax payment, ALM activation, mining metals, buiding new ships,
gathering more knowledge, updating the population size and espionage
reports.
.PP
A GSY equals about 3 minutes of Earth time.
However, to enable the players to speed up things if
they so wish, a NEW YEAR will arrive also in case that BOTH
players have given the "ny" command (see the "ny" command section).
.NH 2
The Battle
.PP
Any attempt to land upon
an enemy-occupied planet will result in immediate battle.
The balance between the
fighting forces determines the outcome of the battle. Usually
any X-type HAWK equals another X-type HAWK, so that when engaged in fighting
the two ships will destroy each other. If the fighting is between unequal
levels, the (X+1)-type is twice stronger then X-type. For example,
if a B-type ship fights
against an A-type ship, the A-type will be destroyed and the B-type will
remain intact. But if 2 A-type ships fight 1 B-type ship \-
the two forces will destroy each other.
If a ship is hit in a battle, it is totally destroyed,
and whatever it carries is lost.
The above rules hold in cases that the base of the attacking
ships is exactly 1 planet apart from their target. If they had to travel
a longer distance, their combat efficiency decreases. There is a possibility
that a defending ship will destroy an attacking one, of the SAME level,
without getting hurt. These chances increase significantly at distances
longer then 4. If you succeed in conquering a planet,
all its residents become your slaves. If there were any slaves there,
they are freed, for they are your citizens once captured. Any metal
digged now belongs to you. However, if it is a scientific planet, the
knowledge there will be A-level only. The scientists had enough time to destroy
all the evidence for higher knowledge.
.NH 2
Capturing a planet without violence.
.PP
To capture a planet you have to control ALL the planets
that have DIRECT access to that planet. That is, there is no route between
the enemy's capital and the to-be-captured planet
that doesn't go through one of your planets.
If you succeed, all the goods that
are on that planet (even knowledge) are now yours.
The planet's inhabitants, including soldiers, will become your
slaves \- to labor as miners. (You cannot use
the enemy's ships. Their body is different, and all the survival
means are totally alien to you).
.NH 1
Let's get started.
.NH 2
The screen.
.PP
The screen is divided into two areas. The upper area
presents the map shown above. You can see two galaxies. One is
yours and the other is the enemy's. Each galaxy consists of three nested
circles of planets and the Capital in their center.
Between them there are some stars
which (at the beginning of the game) don't belong to either of you.
This area is called the intergalactical area.
The lower part of the screen is used for
communication between you and your faithful Head of Administration.
All the commands are given to him. He is the channel through which
all the information to you is reported, and all your commands properly
delivered to your subjects scattered throughout the galaxy.
The information that is constantly kept updated beneath the map
is the name of the planet under cursor, the amount of money left
and the current year.
Another line is dedicated to messages sent to you by the enemy
and other information that is reported to you. Usually this information
is independent of the last issued command. The messages are
displayed one after the other. It takes about three commands
for the next message to show up, but if the '-' key is pressed, the
next message (if existent) will be displayed immediately.
You are prompted with '-More-' whenever there is another message
waiting. Also note that the terminal's bell rings when a new
message has arrived.
.NH 2
Moving the cursor.
.PP
If the cursor is within one of the circles in a galaxy,
you can either move along the circle's radius, or along its perimeter.
As a rule, the numerical keypad is used as a direction indicator. For example
the '8' points north, the '6' east and the '1' south-west. The '.' will
move you clockwise, while the ',' counter-clockwise. The '5' key, which is
in the middle, will flip over the page (if the terminal has this capability)
so that the
information on the other side can be reexamined.
To visualize things better, here is the representation of the keypad, as
used by the program. If the terminal lacks keypad \- use imagination.
.PP
.DS
7 8 9
4 5 6
1 2 3
.DE
.PP
If the cursor is on one of the
stars between the two galaxies, you can move to all directions but usually
not diagonally.
(The allowed routes in this area are marked on the map below).
If a key other then numeric is pressed, this is interpreted as a
character belonging to a command. Thereupon the cursor will move
down to the line marked 'Command: '. If at any time you wish to return
to the Map section, press the 'esc' key. To return back you can either
press the 'esc' key again, or simply continue the command. (The latter
case holds only if the character typed is NOT numeric.)
.NH 2
The commands
.PP
Many commands require the specification of a planet on which
the intended activity is to take place.
By default, the planet that the cursor is currently on - is the
subject of the command. At any time you can have it's name
printed on the command line by pressing cntr/p .
If you want to specify another planet you can either move
the cursor to it or give its coordinates in Space:
.br
The left galaxy is abbreviated L, the right R and the in-between
region C. In a galaxy the circles are numbered 0-3, with the center
at 0. The planets are numbered 0-7 in circles 1-2 and 0-9 and a-f in
circle 3. The planet at the hour-12 position is the 0 number, and
the rest have consecutive numbers CLOCKWISE. In the center part,
there are 7 rows of planets, numbered 0-6 top to bottom. In each
row there are 3 or 5 planets, numbered 0-4 LEFT to RIGHT in the
first and the last row, and 1-3 in the rest. To clarify
the matter, here is the map with some planets' names written
next to them. The allowed routes in the intergalaxy region are
marked too.
.DS
.ss 19
l30 c00 c02 r30
l3f * ---------_#-----#----#----#-----#_-------- @ r31
* *--^^ | | | ^^--@r3f @
l3e c11 | |
* * * ------#----#----#------ @r3e @ @
l3d l27 l21 | | |
* * * * ----#----#----#---- @ @ @ @
* | | | @ r11
l3c l17* * l34 | c32 | r26 @ @
* * * * * * * ---#----#----#--- @ @ @ @ @ @ @
* *l13 | | | @ @
l3b * | | c43 @
* * * * ----#----#----#---- @ @ @ @
l3a | | |
* * * -------#----#----#c53--- @ @ @
l24 | | | r39
l39* *---___ | | | ___--@ @
* ----------#-----#----#----#-----#--------- @
l38 c60 c64
.ss 12
.DE
.NH 2
Help \- Get online help during the game.
.PP
With so much information to process, no wonder that you will occasionly
feel lost. The "help" command enables you to receive most of this
manual on the screen during the game.
.PP
Format and examples:
.IP help 20
Get a description of the available "help" options.
.IP "help os" 20
Get the manual entry for the "os" command.
.IP "help -espionage" 20
Get the manual explanation of the espionage factor in this game.
.NH 2
Os \- Report an Overall Statistics.
.PP
At any time, you can ask for an overall evaluation of your
situation. You will receive the statistics concerning your financial,
military and population position. You can add 1 or more characters
to the command (see examples below). As a result, the planets with
the attribute specified in your command will
change their map representation so that they are easily distinguished
from the rest. If the situation has changed
since the last command with the same parameters, the planet
representation defaults to the original one (shown on the map above).
.br
Note that the characters can be
combined. Especially useful is the combination that starts with 'n'.
This restores the whole map to the original representation, so that
any changes are easily noted.
.PP
Format and examples:
.IP os 20
Report a numeric overview of the situation.
.IP "os a" 20
Show on the map the planets that you have trapped with ALM's.
.IP "os b" 20
Show on the map which planet was "blacked out".
.IP "os c" 20
Show on the map where construction of new ships is in progress.
.IP "os d" 20
Show on the map where detect-movement devices were installed.
.IP "os e" 20
Show on the map enemy's planets to which spies have been sent.
.IP "os f" 20
Show on the map the planets with your ships on them.
.IP "os F" 20
Show on the map the planets with your fighters on them.
.IP "os i" 20
Show on the map which of your planets have counter-espionage.
.IP "os k" 20
Show on the map where you have knowledge better then A.
.IP "os m" 20
Show on the map where are your missiles.
.IP "os n" 20
Restore the map to it's original representation.
.IP "os o" 20
Show on the map which planets you own.
.IP "os p" 20
Show on the map where anti-detection paint was invested.
.IP "os s" 20
Show on the map which planet has special category.
.NH 2
Ps \- Report the Planet Situation.
.PP
Information about any
particular planet is also always available, and you can have
its full description reported
to you. The description will include details on the properties of the
planet, its military and economic situation and its inhabitants.
Of course, asking about a planet that doesn't belong to you might result
in very little information.
If espionage reports are needed, they should be explicitly requested.
.PP
Format and examples:
.IP ps 20
Report about the planet under cursor (called "current").
.IP "ps i" 20
Report espionage results in the current planet.
.IP "ps c50" 20
Report about planet c50.
.IP "ps c50 i" 20
Report espionage results in planet c50.
.NH 2
En \- Enquire about a planet.
.PP
Using this command you can invest money in espionage. You have to
specify the planet, the level of espionage, the specific issue of
interest and the amount of money dedicated to
that purpose. Note that some espionage assignments are easier to
carry out, and thus will require less money than others.
The topics that can be subjects of enquiry are:
.PP
The kind of planet (s), planet's population (p), planet's knowledge level (k),
amount of metal (t), number and type of ships there (f), number of
ALMs installed (a), number and type of missiles (m).
.PP
As for the level. Sending spies to get information as per
above is called "zero level" (it need not be specified). Setting
counter-espionage for that level is ALSO "zero level". When the enemy wishes
to establish a counter-counter-espionage it will be called
"first level". This level represents for the defender the
"counter-counter-counter-espionage" and so on.
.PP
Format and examples:
.IP "en f 20" 20
Set spies on current planet, level zero, check out the forces there, investing 20 tellers.
.IP "en c50 s 20" 20
Set spies on c50, level zero, report planet's status investing 20 tellers.
.IP "en c50 1 p 20" 20
Set spies on c50, first level, report the population status investing 20 tellers.
.NH 2
Bo \- Black out a planet.
.PP
This command enables you to make life harder for the enemy's
spies and detective devices. By blacking out a planet, the amount of
time and money needed to obtain information
is increased.
You can black out ANY planet, provided that you have landed on it. This includes
planets on which you plan to install ALMs when leaving.
Note again that this command can be
given only while your forces are ON the planet.
.PP
Format and examples:
.IP "bo 20" 20
Black out the current planet, investing 20 tellers.
.IP "bo c50 20" 20
Black out planet c50, investing 20 tellers.
.NH 2
As \- Assign people from occupation to occupation.
.PP
If you want to change the balance of manpower
among the various occupations on any of your planets,
you can give the As command.
You start with Citizens and Fighters, but you can add Scientists,
Miners and Builders as need arises.
If you have succeeded to take slaves-
they can be assigned to work ONLY in the mines. Remember, however, that
they cannot be trusted even with such simple work. In order for them
to produce anything there must be at least 1 miner from your population
to supervise them.
.PP
Format and examples:
.IP "as 20 c f" 20
Assign from current planet 20 citizens to fighters.
.IP "as c50 20 c s" 20
Assign from c50 20 citizens to scientists.
.IP "as c50 20 m b" 20
Assign from c50 20 miners to builders.
.NH 2
Bs \- Build ships.
.PP
With this command the builders will start working on the construction
of new ships. The command specifies the planet on which the construction
will take place, the level and no. of ships to be built and
the money assigned for that purpose. If any of prerequisites for
ship construction is absent, the work will not start. However,
it is not necessary that the material and/or the money needed
to accomplish ALL the work be available at the time that the
command is given.
.PP
Format and examples:
.IP "bs 2a 20" 20
Build on the current planet 2 A-type ships, investing 20 tellers.
.IP "bs c50 2a 20" 20
Build on c50 2 A-type ships, investing 20 tellers.
.IP "bs 2a" 20
Build 2 A-type ships on the current planet, using money already provided.
.IP "bs c50 t 20" 20
Add 20 tellers to cover building ships expenses on planet c50.
.NH 2
Sm \- Set missiles.
.PP
Missiles are defense weapons. Once installed on a planet,
they cannot be transferred elsewhere. They can intercept and
destroy any enemy ship that tries to land on that planet, as well as
passing by ships. An A-type missile destroys A-type
ship , B-type missile destroys B-type ship etc.
B-type missile destroys 2 A-type ships, etc. As with ship
construction, the knowledge for better missiles should be available
before any attempt at setting them. Also, there must be enough
soldiers to carry out the work.
.PP
Installing missiles does not ensure their operation.
Their activation
depends on detecting the enemy's movement. If not enough money was
invested in detecting devices, the enemy can even land on the
planet without interference from the missiles
( see the "dt" command for details).
.PP
Format and examples:
.IP "sm 2a" 20
Set on the current planet 3 A-type missiles.
.IP "sm c51 2a" 20
Set on c51 2 A-type missiles.
.IP "sm c51 2a 4b" 20
Set on c51 2 A-type and 4 B-type missiles.
.NH 2
Fd \- Feed the population.
.PP
With this very general command you can make your people happy, content
and highly motivated, or ill-tempered good-for-nothing slobs. Not only
food, but all the necessities are acquired with the money you put aside
with this command. If the available money does not suffice
to feed the entire
population, the priority is: Fighters(f), scientists(s), builders(b),
miners(m) and slaves(v). Citizens support themselves,
so there is no need to feed them.
.PP
Format and examples:
.IP "fd 20" 20
Invest 20 tellers to feed the population.
.NH 2
Tr \- Invest in trade.
.PP
Investing money in trade can be of great help. A good trading year
can bring a 5-25 percent profit. The drawback is, of course, that
the money will be available only the NEXT year. The profit percent
highly depends on the number of planets under your control.
If the number is higher than the original number, 0.5 percent
is added per conquered planet. If not, you will have the minimal
profit only.
.PP
Format and examples:
.IP "tr 20" 20
Invest 20 tellers in trade.
.NH 2
Rt \- Retrieve money given.
.PP
Sometimes (too often) we all make typing mistakes.
This command enables a player to recover from SOME of them.
If too much money was given to feed the population(f),
trade(t), blackout(b) or buiding ships(s), it may be
retrieved, with some lose. Note that these are the only
instances that recovery is possible.
.PP
Format and examples:
.IP "rt 1000 t"
Retrieve 1000 Tellers from trade investment.
.IP "rt 1000 f"
Retrieve 1000 Tellers from food given.
.IP "rt 1000 b c50"
Retrieve 1000 Tellers from blackout investment at
planet c50.
.IP "rt 1000 s"
Retrieve 1000 Tellers from ship building investment on
current planet.
.NH 2
Tk \- Take people or equipment.
.PP
The Tk command enables
you to take people or equipment from a specified planet
and move them to another planet. If you intend to move people,
you specify their occupation and number.
An A-type HAWK can carry 128 persons (in addition to the regular crew)
a B-type HAWK carries 256 etc.
In addition, A-type HAWK can carry mining products sufficient to
build another A-type HAWK. To carry the material for a B-type
HAWK, you need either 2 A-type HAWKs or a B-type HAWK etc.
The amount of mining material is specified by A-type HAWKs quantities.
The only commodity that doesn't raise any
transportation problems is knowledge. Any type HAWK can carry
any type of knowledge.
When a MOVE command is given (see Mv), the maximum
amount of people and material is loaded onto the departing ships.
The priority when loading people is given by the order
specified in the Feed command. (see Fd) .
.PP
Format and examples:
.IP "tk 20 s" 20
Take from current planet 20 scientists.
.IP "tk c50 20 m" 20
Take from c50 20 miners.
.IP "tk c50 k" 20
Take from c50 it's knowledge.
.IP "tk c50 20 t" 20
Take from c50 mining products for 20 A-type HAWKs.
.NH 2
Mv \- Move forces from planet to planet.
.PP
This command enables you to move from planet to planet.
For this end, you specify the base planet,
the destination planet, the direction and the force to be moved.
You can travel
with a single command to any planet that is on a "straight" line.
For example, the following routes are possible:
.PP
From c64 to l38, from r31 to r39, from l27 to l36 etc. However, the
following are NOT possible (with a single command):
.PP
From l17 to l25, from c31 to c20, from r30 to c52 etc.
.PP
If it is possible to move from a given planet to another
via more than one permissible route, the exact direction of movement
may be specified. The direction specification is done with
the same character used to move
the current planet pointer on the screen (see section 3.2), preceded
by the '>' character. If direction is not given, a straight line
direction will be chosen, whenever possible.
.br
If any Tk commands were given to the base planet,
the people and/or the material specified will be moved with the force
mentioned in the Mv command.
Note that the Mv command is in fact a LAND command on the
destination planet.
.PP
Format and examples: (Assuming that the current planet is l00)
.IP "mv -c31 3A" 23
Move from current planet to c31 3 A-type HAWKs.
.IP "mv l3e - 3a" 23
Move from l3e to the current planet 3 A-type HAWKs.
.IP "mv l24 -l20 >8 6A 4B C" 23
Move from l24 to l20 6 A-type, 4 B-type and 1 C-type, going "north".
.NH 2
Lv \- Leave people and/or material at location.
.PP
The Lv command enables you to leave on a planet
anything that you have taken with the Tk command.
When leaving knowledge, it is possible that the knowledge will
still transportable by giving the `k' parameter. If the knowledge
is intended to be left on the planet without any intention to move
it furter, then `K' (upper case) should be specifyied.
.PP
Format and examples:
.IP "lv 20 s" 20
Leave on current planet 20 scientists.
.IP "lv c50 20 m" 20
Leave on c50 20 miners.
.IP "lv c50 k" 20
Leave on c50 the knowledge previously taken, enabling it's movement
to other planets.
.IP "lv c50 K" 20
Leave on c50 the knowledge previously taken.
.IP "lv c50 20 t" 20
Leave on c50 mining products for 20 A-type HAWKs.
.NH 2
Dt \- Install detect movement devices.
.PP
You cannot prevent the enemy from passing by one of your planets.
However,
you can be notified when it happens. Giving the Dt command will install
at a specified planet special Movement Detection devices. They cannot
accurately report WHAT had passed, but only that movement occurred.
As time passes, this devices have a tendency to deteriorate, and after
several years they will be completely ineffective,
if maintenance (money) is not provided.
.PP
Format and examples:
.IP "dt 20" 20
Invest at current planet 20 tellers to detect movement.
.IP "dt c50 20" 20
Invest at c50 20 tellers to detect movement.
.NH 2
Nd \- Paint ship with anti detection paint.
.PP
There is something you can do to prevent the enemy from detecting your
movement in hyper space. You can paint your ships with an
Anti-Magnetic-Glare paint. The effectiveness of this paint is
proportional to the no. of paint layers.
The only drawback (apart from the money involved),
is that the paint wears off when traveling in hyper space.
To repaint the ships you have to land first.
The detection probability is proportional to the AMG paint
condition compared with the strength of the detection devices.
.br
Note that with the money provided the paint is only purchased.
The actual painting will be done only after the "Mv" command was
given, so that the paint will have the maximum effect. There is
no paint left after the "Mv" command execution.
.PP
Format and examples:
.IP "nd 20" 20
Buy AMG paint at current planet with 20 tellers.
.IP "nd c50 20" 20
Buy AMG paint at c50 with 20 tellers .
.NH 2
Lm \- Lay out Anti-Landing-Mines (ALM).
.PP
Any planet can be transformed into a deadly trap.
Laying down the mines is a costly action, not lesser then their deactivation.
In order to lay the mine, (or mines), you have to LAND on the planet.
Only then can you install the mines. These devices become active
one year after their installation. So, you must leave
immediately. Any human form remaining longer then a year
will be totally disintegrated.
.PP
Format and examples:
.IP "lm 2" 20
Install on current planet 2 ALMs.
.IP "lm c50 3" 20
Install on c50 3 ALMs.
.NH 2
Dm \- Deactivate Anti-Landing-Mines (ALM).
.PP
If you are at a short distance from a mined planet,
(one traveling planet apart in ANY direction),
you can try and deactivate the ALMs. It is better to know in advance
HOW MANY of those devices were laid on that planet,
in order to deactivate them all.
Remember that even one ALM can destroy a whole armada, if it
tries to land. If the mines were installed by yourself, you
know their exact number and location, so that the deactivating
process is less expensive.
.PP
Format and examples:
.IP "dm 2" 20
Deactivate at current planet 2 ALMs.
.IP "dm c50 3" 20
Deactivate at c50 3 ALMs.
.NH 2
Wr \- Write a message to the enemy.
.PP
You can ask/blame/tell your opponent anything you want by
writing him a message. The message should be one line long.
You can write as many as you wish.
If you intend to communicate with him, be patient until he answers back.
.PP
Format and examples:
.IP "wr Shall we take a break and save the game??"
.NH 2
Sv \- Save the game.
.PP
Since this is a game for two players, one session
may not be enough for finishing the game. If one partner wishes to save the game
and gives the "Sv" command, his opponent will be notified.
If offer accepted, the game will be saved.
(You need two to Tango.) If a "year" had passed and no positive answer was
given, then the TWO players have to agree on saving the game.
If no parameter is given, the game will be saved under the name "galaxy.save".
If a file name was specified, the game will be saved under this name.
.PP
Format and examples:
.IP "sv ~john/games/john_vs_michel"
.NH 2
Rs \- Restore a saved game.
.PP
After lunch is over, and you wish to continue a saved game, give the
"restore" command, using the same file name that you used when saving it.
As with "save", both players must agree.
.PP
Format and examples:
.IP "rs ~john/games/john_vs_michel"
.NH 2
Menu \- See summary of all available commands.
.PP
In case you forget the commands, or their format,
you can have them displayed in a short form.
This is NOT a comprehensive help. To get such help,
type "help <command name>".
.PP
Format and examples:
.IP "menu"
.NH 2
Mp \- Redraw the map of the game.
.PP
If your terminal gets messages from other users, and the galaxies look a mess,
you can rectify things easily by the "map" command. The original map will
be displayed, clearing everything else.
.PP
Format and examples:
.IP "mp"
.NH 2
Nn \- Ask for a break in game.
.PP
The galaxy game tends to be rather long. If a break is
needed, then giving the "Nn" command (NO new year) the time
will freeze. While break is activated, all commands are
executable except for "Mv". To resume playing, use the "Ny"
command.
.PP
Format and examples:
.IP "nn"
.NH 2
Ny \- Ask for a new year.
.PP
It may happen that you don't find anything useful to perform
during a current GSY,
and all you do is wait for it to end. By giving the "Ny" command you
can shorten this interval. Of course, in order for the command to be effective,
BOTH players must agree by giving the same command. No report is send
to the enemy that you have given the command, so that each player decides on
his own.
In addition, this commands resumes a stoped game (by "Nn").
.PP
Format and examples:
.IP "ny"
.NH 2
Qt \- Quit the game.
.PP
If you wish to discontinue the game without losing face, you can give this
command. However, your partner should feel the same and agree too by
giving the same command. Automatic canceling of this command takes place
at the beginning of a new year.
Giving the command AGAIN within the same year has the same effect.
.PP
Format and examples:
.IP "qt"
.NH 2
Gu \- Give up the game.
.PP
If you feel that all is lost, or you got tired of the game, you may surrender.
Naturally, this will be considered a loss, and your opponent will be credited
for that. There is no "back up" to that command, so make sure that this
is truly your intention.
.PP
Format and examples:
.IP "gu"
.NH 2
Cp \- Change player.
.PP
This command is only permissible during practice sessions. Practice sessions
are designed to let one player get familiar with the game by playing
the roles of BOTH sides and thus to get acquainted with all the relevant
aspects of the game from both sides.
See 'man galaxy' for specifications.
.PP
Format and examples:
.IP "cp" 20
Assume the role of the "other" side.
.bp
Summary of the commands:
.IP Os 10
Report overall statistics.
.IP Ps 10
Report the planets situation.
.IP En 10
Enquire about a planet (espionage).
.IP Bo 10
Black out a planet.
.IP As 10
Assign people from occupation to occupation.
.IP Bs 10
Build new ships.
.IP Sm 10
Set missiles on a planet.
.IP Fd 10
Feed the population.
.IP Tr 10
Invest in trade.
.IP Tk 10
Take forces or equipment from location.
.IP Mv 10
Move forces from planet to planet.
.IP Lv 10
Leave them at another location.
.IP Dt 10
Install detect movement device.
.IP Nd 10
Paint ship with anti detection paint.
.IP Lm 10
Lay out Anti-Landing-Mines (ALM).
.IP Dm 10
Deactivate Anti-Landing-Mines (ALM).
.IP Wr 10
Write a message to the opponent.
.IP Mp 10
Redraw the map of the game.
.IP Sv 10
Save the game.
.IP Rs 10
Restore a previously saved game.
.IP Qt 10
Ask opponent to abort session.
.IP Nn 10
Ask for a break in game.
.IP Ny 10
Ask the opponent to cause a new year.
.IP Gu 10
Quit and admit defeated.
.IP Cp 10
Change player.
.IP menu 10
Get the command list.
.IP help 10
Get help on commands and concepts.
.bp
.PP
Acknowledgments
.PP
Many thanks to the people in the computer lab of Tel Aviv University.
Specially helpful (and encouraging) were Nir Peleg, On Paradise and
Robert Segall.
.PP
Ina Weiner did a wonderfull job editing this document. Virtually
every sentence here bears her mark.
.PP
Among the many that were asked to advise, criticize
and debug at various stages of the game creation are Dany Breslauer,
Danny Khen, Arie Blumenzweig, Igal Shapira, Oren Ben-kiki and Ury
Jamshy. We heartly thank them for the time they spent and the
patience they (usually) had for our requests.
.DS
Our address:
{mrdch,amnnon}@taurus (BITNET)
{mrdch,amnnon}@taurus.bitnet@berkely (ARPA)
{mrdch,amnnon}%taurus.bitnetwiscvm.ARPA (CSNET)
and if all fails, then
...!decvax!humus!taurus!{mrdch,amnnon} (UUCP)
Mordechai Chachamu
Amnnon Horowits
.DE
SHAR_EOF
if test 35910 -ne "`wc -c Galaxy.doc`"
then
echo shar: error transmitting Galaxy.doc '(should have been 35910 characters)'
fi
echo shar: extracting Galaxy.nrf '(42827 characters)'
cat << \SHAR_EOF > Galaxy.nrf
Galactical War - a new fascinating game for two
players.
Mrdch and Amnnon
_A_B_S_T_R_A_C_T
You were a mighty king of a splendid galaxy,
reigning your kingdom in peace and abundance for
hundreds of years. It all ended suddenly (and
sadly) when cruel and powerful villains invaded
your galaxy. You made a hasty retreat, managing to
rescue only a small party of your most loyal sub-
jects. Not much of your enormous treasure was
saved, and you had only a few ships left at your
command. After years of wandering in the unimagin-
ably large universe, you stumble upon a galaxy
which appears uninhabited, yet suitable as a first
move in attempting to regain your glory. You
install your Capital at the center of the galaxy.
As a precaution you send patrol ships to explore
your surroundings. On their return, they bring bad
news. In a nearby galaxy, there is another king-
dom. You decide not to let another catastrophe
happen to you. This time, you are determined to
destroy the enemy. Feeding your computer with all
the available information about this part of the
universe produces the following result:
June 7, 1985
- 2 -
* # # # # # @
* * @ @
* * * # # # @ @ @
* * * * # # # @ @ @ @
* @
* * @ @
* * * * * * * # # # @ @ @ @ @ @ @
* * @ @
* @
* * * * # # # @ @ @ @
* * * # # # @ @ @
* * @ @
* # # # # # @
_1. _K_e_y _c_o_n_c_e_p_t_s
Tellers Teller is the official money used in the universe.
One teller equals 150 Uni-Kilos of gold. You
currently have 100 Tellers. (The coin is named
after Hieronimus X. Teller, the man who discovered
the existence of Natural Plastic.)
Ships When you escaped, you had with you 15 A-type
HAWKs (High Acceleration War Kruisers). An A-type
HAWK is equipped with 65 Mega Hertz Laser Blasters
, 4 H-bomb Launchers and a 100 Erg Shield. Laser
Blasters are used in ship to ship battle, H-bombs
can hit stars. The shield protects you from offen-
sive weapons used by the enemy. If knowledge is
acquired, better ships can be built.
Missiles Missiles are stationary devices that have the
capability to intercept the landing (or the pas-
sage) of an enemy ship, and destroy it. Their
activation depends only on the detection of the
approaching ship(s). When detection is made, the
missile steers itself towards the ship and
explodes it.
ALMs Anti-Landing-Mines (ALMs) are useful devices to be
left on deserted planets. After their installa-
tion they radiate in such a manner that destroys
human body. Anyone (even you) trying to land on
such planet without deactivating the ALMs will
have the landing ships destroyed. The ALMs are
June 7, 1985
- 3 -
detectable and can be remotely deactivated. If
this is done, the planet is completely safe.
Fighters In each A-type HAWK there are 64 fighters, so you
have 960 fighters in combat position. You can
recruit additional fighters from among your
citizens.
Citizens There are 100 citizens with you. They will work
the fields and labor in the factories, supplying
all the life necessities to the entire population.
The number of citizens increases annually by 10%.
Each citizen pays 1 Teller per GSY (Galactical
Standard Year), as tax.
_2. _O_t_h_e_r _o_b_j_e_c_t_s _i_n _t_h_e _g_a_m_e.
_2._1. _P_l_a_n_e_t_s' _P_r_o_p_e_r_t_i_e_s.
All the planets in the galaxy are rich in natural
resources. You can establish one or more colonies on any of
the planets. These colonies can contribute to the war
effort in several ways:
1: Providing nourishment and other life
necessities.(Agricultural planet).
2: Providing mining metals needed to build additional war-
ships.(Mining planet).
3: Building new ships.(Industrial planet).
4: Developing faster, stronger and more efficient
weapons.(Scientific planet).
Naturally, each activity carried out in a colony
requires manpower. You will have to assign citizens or
fighters for that purpose.
_2._2. _T_e_c_h_n_o_l_o_g_i_c_a_l _D_e_v_e_l_o_p_m_e_n_t.
Assigning people to work as scientists and investing
money in basic research will lead to the development of
better weapons. Better weapons mean ships that need half
the manpower to operate, carry twice the amount of blasting
power and their shield is twice heavier. When you posses
enough knowledge to build B-type ships, you can build both
A-type and B-type ships. More development will allow you to
build C-type ships, etc. Of course, in order to develop a
more advanced technology, you need to invest more man-time
and money (for each successive level) .
June 7, 1985
- 4 -
_2._3. _C_o_n_s_t_r_u_c_t_i_n_g _s_h_i_p_s.
When you have the knowledge, the material, the money,
and the manpower needed to build another HAWK and you wish
to do so, you can build any type of ship you wish.
_2._4. _E_s_p_i_o_n_a_g_e.
Information is a "survive or perish" factor. Knowing
the enemy's bases, war-potential, mines etc. is more than
helpful to decide what to do next. Not knowing it... well.
You can send spies to any star in the galaxy. Be sure to
supply them with enough money to bribe or spend in any way
necessary to solicit the required information . Not
surprisingly, the enemy knows the importance of knowledge
too. You can defend yourself in two ways:
1: Passively, by tightening up security on the planet
("Black out"). This will make it harder for the enemy's
spies to reveal the truth about the planet. They will
have to spend more money, (and time) to get the informa-
tion. Nevertheless, no planet can be totally secured
against information leaks.
2: Actively, by investing money in counter-espionage. This
will NOT prevent the enemy's spies from getting the
information, but as soon as he knows something, you will
be notified exactly what information fell into the
enemy's hands. Unfortunately, this counter-espionage is
not spy-proof. The enemy can discover that you know
already about his hard-acquired information by investing
in counter-counter-espionage. This can go on and on, but
it seems that after a certain point, knowing that the
enemy KNOWS something is of little importance, for the
facts are (possibly) much different by that time.
_2._5. _T_i_m_e
The GSY (Galactical Standard Year) is the time refer-
ence for you and your enemy. Each GSY has 100 GSDs (Galacti-
cal Standard Day). The current time is updated at the end of
each command. Some commands are carried out immediately,
while other take time to be completed. The following events
are time consuming, and their effect is only evident at the
end of the year:
Tax payment, ALM activation, mining metals, buiding new
ships, gathering more knowledge, updating the population
size and espionage reports.
A GSY equals about 3 minutes of Earth time. However,
to enable the players to speed up things if they so wish, a
NEW YEAR will arrive also in case that BOTH players have
given the "ny" command (see the "ny" command section).
June 7, 1985
- 5 -
_2._6. _T_h_e _B_a_t_t_l_e
Any attempt to land upon an enemy-occupied planet will
result in immediate battle. The balance between the fight-
ing forces determines the outcome of the battle. Usually any
X-type HAWK equals another X-type HAWK, so that when engaged
in fighting the two ships will destroy each other. If the
fighting is between unequal levels, the (X+1)-type is twice
stronger then X-type. For example, if a B-type ship fights
against an A-type ship, the A-type will be destroyed and the
B-type will remain intact. But if 2 A-type ships fight 1 B-
type ship - the two forces will destroy each other. If a
ship is hit in a battle, it is totally destroyed, and what-
ever it carries is lost. The above rules hold in cases that
the base of the attacking ships is exactly 1 planet apart
from their target. If they had to travel a longer distance,
their combat efficiency decreases. There is a possibility
that a defending ship will destroy an attacking one, of the
SAME level, without getting hurt. These chances increase
significantly at distances longer then 4. If you succeed in
conquering a planet, all its residents become your slaves.
If there were any slaves there, they are freed, for they are
your citizens once captured. Any metal digged now belongs to
you. However, if it is a scientific planet, the knowledge
there will be A-level only. The scientists had enough time
to destroy all the evidence for higher knowledge.
_2._7. _C_a_p_t_u_r_i_n_g _a _p_l_a_n_e_t _w_i_t_h_o_u_t _v_i_o_l_e_n_c_e.
To capture a planet you have to control ALL the planets
that have DIRECT access to that planet. That is, there is no
route between the enemy's capital and the to-be-captured
planet that doesn't go through one of your planets. If you
succeed, all the goods that are on that planet (even
knowledge) are now yours. The planet's inhabitants, includ-
ing soldiers, will become your slaves - to labor as miners.
(You cannot use the enemy's ships. Their body is different,
and all the survival means are totally alien to you).
_3. _L_e_t'_s _g_e_t _s_t_a_r_t_e_d.
_3._1. _T_h_e _s_c_r_e_e_n.
The screen is divided into two areas. The upper area
presents the map shown above. You can see two galaxies. One
is yours and the other is the enemy's. Each galaxy consists
of three nested circles of planets and the Capital in their
center. Between them there are some stars which (at the
beginning of the game) don't belong to either of you. This
area is called the intergalactical area. The lower part of
the screen is used for communication between you and your
faithful Head of Administration. All the commands are given
to him. He is the channel through which all the information
to you is reported, and all your commands properly delivered
June 7, 1985
- 6 -
to your subjects scattered throughout the galaxy. The
information that is constantly kept updated beneath the map
is the name of the planet under cursor, the amount of money
left and the current year. Another line is dedicated to
messages sent to you by the enemy and other information that
is reported to you. Usually this information is independent
of the last issued command. The messages are displayed one
after the other. It takes about three commands for the next
message to show up, but if the '-' key is pressed, the next
message (if existent) will be displayed immediately. You
are prompted with '-More-' whenever there is another mes-
sage waiting. Also note that the terminal's bell rings when
a new message has arrived.
_3._2. _M_o_v_i_n_g _t_h_e _c_u_r_s_o_r.
If the cursor is within one of the circles in a galaxy,
you can either move along the circle's radius, or along its
perimeter. As a rule, the numerical keypad is used as a
direction indicator. For example the '8' points north, the
'6' east and the '1' south-west. The '.' will move you
clockwise, while the ',' counter-clockwise. The '5' key,
which is in the middle, will flip over the page (if the ter-
minal has this capability) so that the information on the
other side can be reexamined. To visualize things better,
here is the representation of the keypad, as used by the
program. If the terminal lacks keypad - use imagination.
7 8 9
4 5 6
1 2 3
If the cursor is on one of the stars between the two
galaxies, you can move to all directions but usually not
diagonally. (The allowed routes in this area are marked on
the map below). If a key other then numeric is pressed,
this is interpreted as a character belonging to a command.
Thereupon the cursor will move down to the line marked 'Com-
mand: '. If at any time you wish to return to the Map sec-
tion, press the 'esc' key. To return back you can either
press the 'esc' key again, or simply continue the command.
(The latter case holds only if the character typed is NOT
numeric.)
_3._3. _T_h_e _c_o_m_m_a_n_d_s
Many commands require the specification of a planet on
which the intended activity is to take place. By default,
the planet that the cursor is currently on - is the subject
June 7, 1985
- 7 -
of the command. At any time you can have it's name printed
on the command line by pressing cntr/p . If you want to
specify another planet you can either move the cursor to it
or give its coordinates in Space:
The left galaxy is abbreviated L, the right R and the in-
between region C. In a galaxy the circles are numbered 0-3,
with the center at 0. The planets are numbered 0-7 in cir-
cles 1-2 and 0-9 and a-f in circle 3. The planet at the
hour-12 position is the 0 number, and the rest have consecu-
tive numbers CLOCKWISE. In the center part, there are 7 rows
of planets, numbered 0-6 top to bottom. In each row there
are 3 or 5 planets, numbered 0-4 LEFT to RIGHT in the first
and the last row, and 1-3 in the rest. To clarify the
matter, here is the map with some planets' names written
next to them. The allowed routes in the intergalaxy region
are marked too.
l30 c00 c02 r30
l3f * ---------_#-----#----#----#-----#_-------- @ r31
* *--^^ | | | ^^--@r3f @
l3e c11 | |
* * * ------#----#----#------ @r3e @ @
l3d l27 l21 | | |
* * * * ----#----#----#---- @ @ @ @
* | | | @ r11
l3c l17* * l34 | c32 | r26 @ @
* * * * * * * ---#----#----#--- @ @ @ @ @ @ @
* *l13 | | | @ @
l3b * | | c43 @
* * * * ----#----#----#---- @ @ @ @
l3a | | |
* * * -------#----#----#c53--- @ @ @
l24 | | | r39
l39* *---___ | | | ___--@ @
* ----------#-----#----#----#-----#--------- @
l38 c60 c64
_3._4. _H_e_l_p - _G_e_t _o_n_l_i_n_e _h_e_l_p _d_u_r_i_n_g _t_h_e _g_a_m_e.
With so much information to process, no wonder that you
will occasionly feel lost. The "help" command enables you to
receive most of this manual on the screen during the game.
Format and examples:
help Get a description of the available
"help" options.
help os Get the manual entry for the "os" com-
mand.
June 7, 1985
- 8 -
help -espionage Get the manual explanation of the
espionage factor in this game.
_3._5. _O_s - _R_e_p_o_r_t _a_n _O_v_e_r_a_l_l _S_t_a_t_i_s_t_i_c_s.
At any time, you can ask for an overall evaluation of
your situation. You will receive the statistics concerning
your financial, military and population position. You can
add 1 or more characters to the command (see examples
below). As a result, the planets with the attribute speci-
fied in your command will change their map representation so
that they are easily distinguished from the rest. If the
situation has changed since the last command with the same
parameters, the planet representation defaults to the origi-
nal one (shown on the map above).
Note that the characters can be combined. Especially useful
is the combination that starts with 'n'. This restores the
whole map to the original representation, so that any
changes are easily noted.
Format and examples:
os Report a numeric overview of the situa-
tion.
os a Show on the map the planets that you
have trapped with ALM's.
os b Show on the map which planet was
"blacked out".
os c Show on the map where construction of
new ships is in progress.
os d Show on the map where detect-movement
devices were installed.
os e Show on the map enemy's planets to which
spies have been sent.
os f Show on the map the planets with your
ships on them.
os F Show on the map the planets with your
fighters on them.
os i Show on the map which of your planets
have counter-espionage.
os k Show on the map where you have knowledge
better then A.
os m Show on the map where are your missiles.
June 7, 1985
- 9 -
os n Restore the map to it's original
representation.
os o Show on the map which planets you own.
os p Show on the map where anti-detection
paint was invested.
os s Show on the map which planet has special
category.
_3._6. _P_s - _R_e_p_o_r_t _t_h_e _P_l_a_n_e_t _S_i_t_u_a_t_i_o_n.
Information about any particular planet is also always
available, and you can have its full description reported to
you. The description will include details on the properties
of the planet, its military and economic situation and its
inhabitants. Of course, asking about a planet that doesn't
belong to you might result in very little information. If
espionage reports are needed, they should be explicitly
requested.
Format and examples:
ps Report about the planet under cursor
(called "current").
ps i Report espionage results in the current
planet.
ps c50 Report about planet c50.
ps c50 i Report espionage results in planet c50.
_3._7. _E_n - _E_n_q_u_i_r_e _a_b_o_u_t _a _p_l_a_n_e_t.
Using this command you can invest money in espionage.
You have to specify the planet, the level of espionage, the
specific issue of interest and the amount of money dedicated
to that purpose. Note that some espionage assignments are
easier to carry out, and thus will require less money than
others. The topics that can be subjects of enquiry are:
The kind of planet (s), planet's population (p),
planet's knowledge level (k), amount of metal (t), number
and type of ships there (f), number of ALMs installed (a),
number and type of missiles (m).
As for the level. Sending spies to get information as
per above is called "zero level" (it need not be specified).
Setting counter-espionage for that level is ALSO "zero
level". When the enemy wishes to establish a counter-
counter-espionage it will be called "first level". This
level represents for the defender the "counter-counter-
June 7, 1985
- 10 -
counter-espionage" and so on.
Format and examples:
en f 20 Set spies on current planet, level zero,
check out the forces there, investing 20
tellers.
en c50 s 20 Set spies on c50, level zero, report
planet's status investing 20 tellers.
en c50 1 p 20 Set spies on c50, first level, report
the population status investing 20 tell-
ers.
_3._8. _B_o - _B_l_a_c_k _o_u_t _a _p_l_a_n_e_t.
This command enables you to make life harder for the
enemy's spies and detective devices. By blacking out a
planet, the amount of time and money needed to obtain infor-
mation is increased. You can black out ANY planet, provided
that you have landed on it. This includes planets on which
you plan to install ALMs when leaving. Note again that this
command can be given only while your forces are ON the
planet.
Format and examples:
bo 20 Black out the current planet, investing
20 tellers.
bo c50 20 Black out planet c50, investing 20 tell-
ers.
_3._9. _A_s - _A_s_s_i_g_n _p_e_o_p_l_e _f_r_o_m _o_c_c_u_p_a_t_i_o_n _t_o _o_c_c_u_p_a_t_i_o_n.
If you want to change the balance of manpower among the
various occupations on any of your planets, you can give the
As command. You start with Citizens and Fighters, but you
can add Scientists, Miners and Builders as need arises. If
you have succeeded to take slaves- they can be assigned to
work ONLY in the mines. Remember, however, that they cannot
be trusted even with such simple work. In order for them to
produce anything there must be at least 1 miner from your
population to supervise them.
Format and examples:
as 20 c f Assign from current planet 20 citizens
to fighters.
as c50 20 c s Assign from c50 20 citizens to scien-
tists.
June 7, 1985
- 11 -
as c50 20 m b Assign from c50 20 miners to builders.
_3._1_0. _B_s - _B_u_i_l_d _s_h_i_p_s.
With this command the builders will start working on
the construction of new ships. The command specifies the
planet on which the construction will take place, the level
and no. of ships to be built and the money assigned for that
purpose. If any of prerequisites for ship construction is
absent, the work will not start. However, it is not neces-
sary that the material and/or the money needed to accomplish
ALL the work be available at the time that the command is
given.
Format and examples:
bs 2a 20 Build on the current planet 2 A-type
ships, investing 20 tellers.
bs c50 2a 20 Build on c50 2 A-type ships, investing
20 tellers.
bs 2a Build 2 A-type ships on the current
planet, using money already provided.
bs c50 t 20 Add 20 tellers to cover building ships
expenses on planet c50.
_3._1_1. _S_m - _S_e_t _m_i_s_s_i_l_e_s.
Missiles are defense weapons. Once installed on a
planet, they cannot be transferred elsewhere. They can
intercept and destroy any enemy ship that tries to land on
that planet, as well as passing by ships. An A-type missile
destroys A-type ship , B-type missile destroys B-type ship
etc. B-type missile destroys 2 A-type ships, etc. As with
ship construction, the knowledge for better missiles should
be available before any attempt at setting them. Also, there
must be enough soldiers to carry out the work.
Installing missiles does not ensure their operation.
Their activation depends on detecting the enemy's movement.
If not enough money was invested in detecting devices, the
enemy can even land on the planet without interference from
the missiles ( see the "dt" command for details).
Format and examples:
sm 2a Set on the current planet 3 A-type mis-
siles.
sm c51 2a Set on c51 2 A-type missiles.
sm c51 2a 4b Set on c51 2 A-type and 4 B-type
June 7, 1985
- 12 -
missiles.
_3._1_2. _F_d - _F_e_e_d _t_h_e _p_o_p_u_l_a_t_i_o_n.
With this very general command you can make your people
happy, content and highly motivated, or ill-tempered good-
for-nothing slobs. Not only food, but all the necessities
are acquired with the money you put aside with this command.
If the available money does not suffice to feed the entire
population, the priority is: Fighters(f), scientists(s),
builders(b), miners(m) and slaves(v). Citizens support them-
selves, so there is no need to feed them.
Format and examples:
fd 20 Invest 20 tellers to feed the popula-
tion.
_3._1_3. _T_r - _I_n_v_e_s_t _i_n _t_r_a_d_e.
Investing money in trade can be of great help. A good
trading year can bring a 5-25 percent profit. The drawback
is, of course, that the money will be available only the
NEXT year. The profit percent highly depends on the number
of planets under your control. If the number is higher than
the original number, 0.5 percent is added per conquered
planet. If not, you will have the minimal profit only.
Format and examples:
tr 20 Invest 20 tellers in trade.
_3._1_4. _R_t - _R_e_t_r_i_e_v_e _m_o_n_e_y _g_i_v_e_n.
Sometimes (too often) we all make typing mistakes.
This command enables a player to recover from SOME of them.
If too much money was given to feed the population(f),
trade(t), blackout(b) or buiding ships(s), it may be
retrieved, with some lose. Note that these are the only
instances that recovery is possible.
Format and examples:
rt 1000 t
Retrieve 1000 Tellers from trade investment.
rt 1000 f
Retrieve 1000 Tellers from food given.
rt 1000 b c50
Retrieve 1000 Tellers from blackout investment at
planet c50.
rt 1000 s
June 7, 1985
- 13 -
Retrieve 1000 Tellers from ship building investment on
current planet.
_3._1_5. _T_k - _T_a_k_e _p_e_o_p_l_e _o_r _e_q_u_i_p_m_e_n_t.
The Tk command enables you to take people or equipment
from a specified planet and move them to another planet. If
you intend to move people, you specify their occupation and
number. An A-type HAWK can carry 128 persons (in addition
to the regular crew) a B-type HAWK carries 256 etc. In
addition, A-type HAWK can carry mining products sufficient
to build another A-type HAWK. To carry the material for a
B-type HAWK, you need either 2 A-type HAWKs or a B-type HAWK
etc. The amount of mining material is specified by A-type
HAWKs quantities. The only commodity that doesn't raise any
transportation problems is knowledge. Any type HAWK can
carry any type of knowledge. When a MOVE command is given
(see Mv), the maximum amount of people and material is
loaded onto the departing ships. The priority when loading
people is given by the order specified in the Feed command.
(see Fd) .
Format and examples:
tk 20 s Take from current planet 20 scientists.
tk c50 20 m Take from c50 20 miners.
tk c50 k Take from c50 it's knowledge.
tk c50 20 t Take from c50 mining products for 20 A-
type HAWKs.
_3._1_6. _M_v - _M_o_v_e _f_o_r_c_e_s _f_r_o_m _p_l_a_n_e_t _t_o _p_l_a_n_e_t.
This command enables you to move from planet to planet.
For this end, you specify the base planet, the destination
planet, the direction and the force to be moved. You can
travel with a single command to any planet that is on a
"straight" line. For example, the following routes are pos-
sible:
From c64 to l38, from r31 to r39, from l27 to l36 etc.
However, the following are NOT possible (with a single com-
mand):
From l17 to l25, from c31 to c20, from r30 to c52 etc.
If it is possible to move from a given planet to
another via more than one permissible route, the exact
direction of movement may be specified. The direction
specification is done with the same character used to move
the current planet pointer on the screen (see section 3.2),
preceded by the '>' character. If direction is not given, a
June 7, 1985
- 14 -
straight line direction will be chosen, whenever possible.
If any Tk commands were given to the base planet, the people
and/or the material specified will be moved with the force
mentioned in the Mv command. Note that the Mv command is in
fact a LAND command on the destination planet.
Format and examples: (Assuming that the current planet
is l00)
mv -c31 3A Move from current planet to c31 3 A-
type HAWKs.
mv l3e - 3a Move from l3e to the current planet 3
A-type HAWKs.
mv l24 -l20 >8 6A 4B C Move from l24 to l20 6 A-type, 4 B-
type and 1 C-type, going "north".
_3._1_7. _L_v - _L_e_a_v_e _p_e_o_p_l_e _a_n_d/_o_r _m_a_t_e_r_i_a_l _a_t _l_o_c_a_t_i_o_n.
The Lv command enables you to leave on a planet any-
thing that you have taken with the Tk command. When leaving
knowledge, it is possible that the knowledge will still
transportable by giving the `k' parameter. If the knowledge
is intended to be left on the planet without any intention
to move it furter, then `K' (upper case) should be
specifyied.
Format and examples:
lv 20 s Leave on current planet 20 scientists.
lv c50 20 m Leave on c50 20 miners.
lv c50 k Leave on c50 the knowledge previously
taken, enabling it's movement to other
planets.
lv c50 K Leave on c50 the knowledge previously
taken.
lv c50 20 t Leave on c50 mining products for 20 A-
type HAWKs.
_3._1_8. _D_t - _I_n_s_t_a_l_l _d_e_t_e_c_t _m_o_v_e_m_e_n_t _d_e_v_i_c_e_s.
You cannot prevent the enemy from passing by one of
your planets. However, you can be notified when it happens.
Giving the Dt command will install at a specified planet
special Movement Detection devices. They cannot accurately
report WHAT had passed, but only that movement occurred. As
time passes, this devices have a tendency to deteriorate,
and after several years they will be completely ineffective,
if maintenance (money) is not provided.
June 7, 1985
- 15 -
Format and examples:
dt 20 Invest at current planet 20 tellers to
detect movement.
dt c50 20 Invest at c50 20 tellers to detect move-
ment.
_3._1_9. _N_d - _P_a_i_n_t _s_h_i_p _w_i_t_h _a_n_t_i _d_e_t_e_c_t_i_o_n _p_a_i_n_t.
There is something you can do to prevent the enemy from
detecting your movement in hyper space. You can paint your
ships with an Anti-Magnetic-Glare paint. The effectiveness
of this paint is proportional to the no. of paint layers.
The only drawback (apart from the money involved), is that
the paint wears off when traveling in hyper space. To
repaint the ships you have to land first. The detection
probability is proportional to the AMG paint condition com-
pared with the strength of the detection devices.
Note that with the money provided the paint is only pur-
chased. The actual painting will be done only after the
"Mv" command was given, so that the paint will have the max-
imum effect. There is no paint left after the "Mv" command
execution.
Format and examples:
nd 20 Buy AMG paint at current planet with 20
tellers.
nd c50 20 Buy AMG paint at c50 with 20 tellers .
_3._2_0. _L_m - _L_a_y _o_u_t _A_n_t_i-_L_a_n_d_i_n_g-_M_i_n_e_s (_A_L_M).
Any planet can be transformed into a deadly trap. Lay-
ing down the mines is a costly action, not lesser then their
deactivation. In order to lay the mine, (or mines), you
have to LAND on the planet. Only then can you install the
mines. These devices become active one year after their
installation. So, you must leave immediately. Any human form
remaining longer then a year will be totally disintegrated.
Format and examples:
lm 2 Install on current planet 2 ALMs.
lm c50 3 Install on c50 3 ALMs.
_3._2_1. _D_m - _D_e_a_c_t_i_v_a_t_e _A_n_t_i-_L_a_n_d_i_n_g-_M_i_n_e_s (_A_L_M).
If you are at a short distance from a mined planet,
(one traveling planet apart in ANY direction), you can try
and deactivate the ALMs. It is better to know in advance HOW
MANY of those devices were laid on that planet, in order to
June 7, 1985
- 16 -
deactivate them all. Remember that even one ALM can destroy
a whole armada, if it tries to land. If the mines were
installed by yourself, you know their exact number and loca-
tion, so that the deactivating process is less expensive.
Format and examples:
dm 2 Deactivate at current planet 2 ALMs.
dm c50 3 Deactivate at c50 3 ALMs.
_3._2_2. _W_r - _W_r_i_t_e _a _m_e_s_s_a_g_e _t_o _t_h_e _e_n_e_m_y.
You can ask/blame/tell your opponent anything you want
by writing him a message. The message should be one line
long. You can write as many as you wish. If you intend to
communicate with him, be patient until he answers back.
Format and examples:
wr Shall we take a break and save the game??
_3._2_3. _S_v - _S_a_v_e _t_h_e _g_a_m_e.
Since this is a game for two players, one session may
not be enough for finishing the game. If one partner wishes
to save the game
and gives the "Sv" command, his opponent will be notified.
If offer accepted, the game will be saved. (You need two to
Tango.) If a "year" had passed and no positive answer was
given, then the TWO players have to agree on saving the
game. If no parameter is given, the game will be saved
under the name "galaxy.save". If a file name was specified,
the game will be saved under this name.
Format and examples:
sv ~john/games/john_vs_michel
_3._2_4. _R_s - _R_e_s_t_o_r_e _a _s_a_v_e_d _g_a_m_e.
After lunch is over, and you wish to continue a saved
game, give the "restore" command, using the same file name
that you used when saving it. As with "save", both players
must agree.
Format and examples:
rs ~john/games/john_vs_michel
_3._2_5. _M_e_n_u - _S_e_e _s_u_m_m_a_r_y _o_f _a_l_l _a_v_a_i_l_a_b_l_e _c_o_m_m_a_n_d_s.
In case you forget the commands, or their format, you
can have them displayed in a short form. This is NOT a
June 7, 1985
- 17 -
comprehensive help. To get such help, type "help <command
name>".
Format and examples:
menu
_3._2_6. _M_p - _R_e_d_r_a_w _t_h_e _m_a_p _o_f _t_h_e _g_a_m_e.
If your terminal gets messages from other users, and
the galaxies look a mess, you can rectify things easily by
the "map" command. The original map will be displayed,
clearing everything else.
Format and examples:
mp
_3._2_7. _N_n - _A_s_k _f_o_r _a _b_r_e_a_k _i_n _g_a_m_e.
The galaxy game tends to be rather long. If a break is
needed, then giving the "Nn" command (NO new year) the time
will freeze. While break is activated, all commands are
executable except for "Mv". To resume playing, use the "Ny"
command.
Format and examples:
nn
_3._2_8. _N_y - _A_s_k _f_o_r _a _n_e_w _y_e_a_r.
It may happen that you don't find anything useful to
perform during a current GSY, and all you do is wait for it
to end. By giving the "Ny" command you can shorten this
interval. Of course, in order for the command to be effec-
tive, BOTH players must agree by giving the same command. No
report is send to the enemy that you have given the command,
so that each player decides on his own. In addition, this
commands resumes a stoped game (by "Nn").
Format and examples:
ny
_3._2_9. _Q_t - _Q_u_i_t _t_h_e _g_a_m_e.
If you wish to discontinue the game without losing
face, you can give this command. However, your partner
should feel the same and agree too by giving the same com-
mand. Automatic canceling of this command takes place at the
beginning of a new year. Giving the command AGAIN within
the same year has the same effect.
June 7, 1985
- 18 -
Format and examples:
qt
_3._3_0. _G_u - _G_i_v_e _u_p _t_h_e _g_a_m_e.
If you feel that all is lost, or you got tired of the
game, you may surrender. Naturally, this will be considered
a loss, and your opponent will be credited for that. There
is no "back up" to that command, so make sure that this is
truly your intention.
Format and examples:
gu
_3._3_1. _C_p - _C_h_a_n_g_e _p_l_a_y_e_r.
This command is only permissible during practice ses-
sions. Practice sessions are designed to let one player get
familiar with the game by playing the roles of BOTH sides
and thus to get acquainted with all the relevant aspects of
the game from both sides. See 'man galaxy' for specifica-
tions.
Format and examples:
cp Assume the role of the "other" side.
June 7, 1985
- 19 -
Summary of the commands:
Os Report overall statistics.
Ps Report the planets situation.
En Enquire about a planet (espionage).
Bo Black out a planet.
As Assign people from occupation to occupation.
Bs Build new ships.
Sm Set missiles on a planet.
Fd Feed the population.
Tr Invest in trade.
Tk Take forces or equipment from location.
Mv Move forces from planet to planet.
Lv Leave them at another location.
Dt Install detect movement device.
Nd Paint ship with anti detection paint.
Lm Lay out Anti-Landing-Mines (ALM).
Dm Deactivate Anti-Landing-Mines (ALM).
Wr Write a message to the opponent.
Mp Redraw the map of the game.
Sv Save the game.
Rs Restore a previously saved game.
Qt Ask opponent to abort session.
Nn Ask for a break in game.
Ny Ask the opponent to cause a new year.
Gu Quit and admit defeated.
Cp Change player.
menu Get the command list.
June 7, 1985
- 20 -
help Get help on commands and concepts.
June 7, 1985
- 21 -
Acknowledgments
Many thanks to the people in the computer lab of Tel
Aviv University. Specially helpful (and encouraging) were
Nir Peleg, On Paradise and Robert Segall.
Ina Weiner did a wonderfull job editing this document.
Virtually every sentence here bears her mark.
Among the many that were asked to advise, criticize and
debug at various stages of the game creation are Dany
Breslauer, Danny Khen, Arie Blumenzweig, Igal Shapira, Oren
Ben-kiki and Ury Jamshy. We heartly thank them for the time
they spent and the patience they (usually) had for our
requests.
Our address:
{mrdch,amnnon}@taurus (BITNET)
{mrdch,amnnon}@taurus.bitnet@berkely (ARPA)
{mrdch,amnnon}%taurus.bitnet@wiscvm.ARPA (CSNET)
and if all fails, then
...!decvax!humus!taurus!{mrdch,amnnon} (UUCP)
Mordechai Chachamu
Amnnon Horowits
June 7, 1985
SHAR_EOF
if test 42827 -ne "`wc -c Galaxy.nrf`"
then
echo shar: error transmitting Galaxy.nrf '(should have been 42827 characters)'
fi
echo shar: extracting Makefile '(82 characters)'
cat << \SHAR_EOF > Makefile
ROFF = nroff
Galaxy.nrf : Galaxy.doc
tbl Galaxy.doc | ${ROFF} -ms > Galaxy.nrf
SHAR_EOF
if test 82 -ne "`wc -c Makefile`"
then
echo shar: error transmitting Makefile '(should have been 82 characters)'
fi
# End of shell archive
exit 0MRDCH@TAURUS.BITNET (06/09/85)
From: Mordechai Chachamu <mrdch@taurus.BitNet>
Hello everybody!!!
This is part #4 of 10. It containes some files that are auxiliary
to the game itself, may be better called "utilities". They should
be placed in ~galaxy/src1.
mrdch
# This is a shell archive.
# Remove everything above and including the cut line.
# Then run the rest of the file through sh.
-----cut here-----cut here-----cut here-----cut here-----
#!/bin/sh
# shar: Shell Archiver
# Run the following text with /bin/sh to create:
# Makefile
# READ_ME
# constants.h
# edscore.c
# galaxy.csh
# galaxy.motd
# local.c
# okgalaxy.c
# pager.c
# safe
# score.h
# This archive created: Sat Jun 8 13:51:28 1985
echo shar: extracting Makefile '(774 characters)'
cat << \SHAR_EOF > Makefile
#
# %W% (mrdch&amnnon) %E%
#
LIBDIR = /usr/games/lib/galaxy
GAMES = /usr/games
MV = /bin/mv
CFLAGS = -O -s
all: okgalaxy pager local edscore
okgalaxy: okgalaxy.c
cc ${CFLAGS} -o okgalaxy okgalaxy.c
pager: pager.c
cc ${CFLAGS} -o pager pager.c
local: local.c
cc ${CFLAGS} -o local local.c
edscore: edscore.c constants.h score.h
cc $(CFLAGS) -o edscore edscore.c
.DEFAULT:
sccs get $@
clean:
/bin/rm okgalaxy pager local edscore
install: all
chuser galaxy okgalaxy pager local edscore galaxy.motd galaxy.csh
chmod 755 galaxy.csh
cp okgalaxy pager local edscore ${LIBDIR}
chmod 4111 ${LIBDIR}/okgalaxy
cp galaxy.motd ${LIBDIR}
cp galaxy.csh ${GAMES}/galaxy
SHAR_EOF
if test 774 -ne "`wc -c Makefile`"
then
echo shar: error transmitting Makefile '(should have been 774 characters)'
fi
echo shar: extracting READ_ME '(498 characters)'
cat << \SHAR_EOF > READ_ME
This directory holds the service programs, used by galaxy.
The make will make it all. Read before using.
Some remarks:
"galaxy.csh" is the front end of the whole game. It enables
posting of some remarks through a motd file in
/users/games/lib/galaxy.
"edscore" enables paging through the score file for editing
purpose. Use whenever necessary.
"okgalxy","pager" and "local" are programs to establish
communication when the game starts.
mrdch & amnnon
SHAR_EOF
if test 498 -ne "`wc -c READ_ME`"
then
echo shar: error transmitting READ_ME '(should have been 498 characters)'
fi
echo shar: extracting constants.h '(3763 characters)'
cat << \SHAR_EOF > constants.h
/*
* %W% (mrdch&amnnon) %E%
*/
/*
* this file contains all the constants used by the game.
*/
# define HOME "/usr/games/lib/galaxy/"
# define LOCAL "/usr/games/lib/galaxy/local"
# define WIZFIL "/usr/games/lib/galaxy/wizards"
# define LOGFIL "/usr/games/lib/galaxy/galaxy.log"
# define SAVEFIL "/usr/games/lib/galaxy/galaxy.save"
# define SAVETMP "/usr/games/lib/galaxy/galaxy.tmp"
# define GALSCOR "/usr/games/lib/galaxy/galaxy.scor"
# define PAGER "/usr/games/lib/galaxy/pager"
# define ESPSIZ 8 /* max nesting of espionage */
# define MAXSHIPS 7 /* how many types of ships */
# define MAXPL 91 /* how many planets are there */
# define PLKINDS 5 /* how many kinds of planets */
# define MAXCHAN 2 /* maximum no. of chanels to open */
# define NCREW 64 /* no. of fighters in A-type HAWK */
# define VISITORS 128 /* no. of additional people */
# define MSGSIZ 150 /* max chars in a single masseg */
# define CLASES 6 /* how many clases of people */
# define FIGT 0 /* fighters */
# define CITI 1 /* citizens */
# define SCIE 2 /* scientists */
# define BUIL 3 /* builders */
# define MINE 4 /* miners */
# define SLAV 5 /* slaves */
# define ESPTYP 7 /* different types of espionage:*/
# define ESPKIND 0 /* what kind of planet is it */
# define ESPPOP 1 /* how many people are there */
# define ESPKNOW 2 /* what is the knowledge level */
# define ESPMTL 3 /* how much metal was digged out*/
# define ESPSHIP 4 /* what are the forces there */
# define ESPALM 5 /* how many ALM were installed */
# define ESPMSL 6 /* how many missiles are there */
# define BUILD_MONEY 0 /* MONEY given to build ships */
# define LEVEL 1 /* the LEVEL of ships ordered build */
# define NSHIPS 2 /* the NO. of ships ordered build */
# define N_PSI 20 /* max possible messages on screen */
# define ALMCOST 100 /* how much costs 1 ALM */
# define REMOVE_COST 50 /* to remove one if yours */
# define ALM_KILL_COST 200 /* to remove from the enemy's planet */
# define YEARLENGTH 180 /* a turn is 3 min. */
# define PERC_TRADE 10 /* the minimum % of profit in trade */
# define PERC_POPUL 10 /* the % of natural growth */
# define FEED_RATIO 100 /* no. people fed by 1 teller a year*/
# define MINING_FACTOR 100 /* years_manpower 1A metals */
# define KNOW_FACTOR 1000 /* years_manpower to raise 1 level */
# define SHIP_COST 100 /* basic cost factor to build ship */
# define MISSILE_COST 400 /* to put a A-type missile */
# define REDUCE_RATE 10 /* detecting lost effect % in a year */
# define FADE_RATE 25 /* undetection paint fading rate */
# define MIN_ESP 100 /* the minimum to report ANYTHING */
# define KIND_ESP MIN_ESP /* to find out the planet's type */
# define POPUL_ESP 5*MIN_ESP /* for it's population */
# define KNOW_ESP 3*MIN_ESP /* the level of knowledge there */
# define METAL_ESP 2*MIN_ESP /* how much metal has he */
# define FORCE_ESP 10*MIN_ESP /* what are his forces there */
# define ALM_ESP 2*MIN_ESP /* how many alms he's got */
# define MSL_ESP 8*MIN_ESP /* how many missiles he set there */
SHAR_EOF
if test 3763 -ne "`wc -c constants.h`"
then
echo shar: error transmitting constants.h '(should have been 3763 characters)'
fi
echo shar: extracting edscore.c '(1888 characters)'
cat << \SHAR_EOF > edscore.c
/*
* %W% (mrdch&amnnon) %E%
*/
# include <sys/types.h>
# include "constants.h"
# include "score.h"
# include <stdio.h>
char *tmpf = "/usr/games/lib/galaxy/scoreXXXXXX";
char *ctime ();
int tmp,
sc;
main () {
struct score s;
char c;
long time();
sc = open (GALSCOR, 0);
if (sc < 0) {
perror (GALSCOR);
exit (1);
}
tmp = creat (mktemp (tmpf), 0600);
if (tmp < 0) {
perror (tmpf);
exit (1);
}
while (read (sc, &s, sizeof (s)) == sizeof (s)) {
if (c != 'q') {
char *str,
*index ();
str = ctime (&s.played_at);
*index (str, '\n') = '\0';
printf ("%s,%s %d %s ", s.win, s.los, s.years, str);
c = getchar ();
if (c != '\n')
while (getchar () != '\n');
}
switch (c) {
case 'd':
break;
case 'q':
default:
write (tmp, &s, sizeof (s));
break;
case 'a':
write (tmp, &s, sizeof (s));
printf("winner ? ");
gets(s.win);
printf("looser ? ");
gets(s.los);
printf("years ? ");
rint(&s.years);
s.played_at = time(0);
write(tmp, &s, sizeof(s));
break;
}
}
if (unlink (GALSCOR) < 0) {
fprintf (stderr, "unlink ");
perror (GALSCOR);
exit (1);
}
if (link (tmpf, GALSCOR) < 0) {
fprintf (stderr, "link ");
perror (GALSCOR);
exit (1);
}
if (unlink (tmpf) < 0) {
fprintf (stderr, "unlink ");
perror (tmpf);
exit (1);
}
exit (0);
}
rint(i)
int *i;
{
char s[100];
gets(s);
*i = atoi(s);
}
SHAR_EOF
if test 1888 -ne "`wc -c edscore.c`"
then
echo shar: error transmitting edscore.c '(should have been 1888 characters)'
fi
echo shar: extracting galaxy.csh '(158 characters)'
cat << \SHAR_EOF > galaxy.csh
#! /bin/csh -f
#
# %W% (mrdch&amnnon) %E%
#
set motd = "/usr/games/lib/galaxy/galaxy.motd"
if ( -e $motd) cat $motd
/usr/games/lib/galaxy/galaxy.out $argv
SHAR_EOF
if test 158 -ne "`wc -c galaxy.csh`"
then
echo shar: error transmitting galaxy.csh '(should have been 158 characters)'
fi
echo shar: extracting galaxy.motd '(214 characters)'
cat << \SHAR_EOF > galaxy.motd
Wellcome to the Universe of Galaxies!!!
If that's your first time to try galaxy, I hope you have
read the manual first. If not, hit 'del' to exit and
then do 'man galaxy'.
Enjoy your journey!!!
SHAR_EOF
if test 214 -ne "`wc -c galaxy.motd`"
then
echo shar: error transmitting galaxy.motd '(should have been 214 characters)'
fi
echo shar: extracting local.c '(421 characters)'
cat << \SHAR_EOF > local.c
/*
* %W% (mrdch&amnnon) %E%
*/
# include <stdio.h>
struct chan
{
int ichan ;
char c ;
} ;
main(ac, av)
int ac ;
char **av ;
{
struct chan c ;
if(ac != 2)
exit(1) ;
c.ichan = atoi(av[1]) ;
while(!feof(stdin))
{
c.c = getchar() ;
write(1, (char *)&c, sizeof(c)) ;
}
exit(0) ;
}
SHAR_EOF
if test 421 -ne "`wc -c local.c`"
then
echo shar: error transmitting local.c '(should have been 421 characters)'
fi
echo shar: extracting okgalaxy.c '(804 characters)'
cat << \SHAR_EOF > okgalaxy.c
/*
* %W% (mrdch&amnnon) %E%
*/
# include <stdio.h>
# include <signal.h>
# include <sys/types.h>
# include <sys/stat.h>
struct stat stbuf ;
char *tty ;
main()
{
char *ttyname() ;
int doexit() ;
tty = ttyname(0) ;
if(tty == 0)
{
fprintf(stderr, "Don't know you.\n") ;
exit(1) ;
}
stat(tty, &stbuf) ;
signal(SIGINT, doexit) ;
signal(SIGQUIT, doexit) ;
signal(SIGTSTP, doexit) ;
if(chmod(tty, 0666) == -1)
{
fprintf(stderr, "Your tty ain't yours.\n") ;
exit(1) ;
}
printf("Please wait.....") ;
fflush(stdout) ;
pause() ;
}
doexit()
{
chmod(tty, stbuf.st_mode) ;
exit(0) ;
}
SHAR_EOF
if test 804 -ne "`wc -c okgalaxy.c`"
then
echo shar: error transmitting okgalaxy.c '(should have been 804 characters)'
fi
echo shar: extracting pager.c '(563 characters)'
cat << \SHAR_EOF > pager.c
/*
* %W% (mrdch&amnnon) %E%
*/
# include <stdio.h>
main(ac, av)
int ac ;
char **av ;
{
FILE *tty ;
if(ac != 3)
getout("arg count") ;
tty = fopen(av[1], "w") ;
if(tty == NULL)
getout("cannot open terminal") ;
fprintf(tty, "\07\07%s would like to play galaxy with you.\n\r",av[2]) ;
fprintf(tty, "\07\07If you wish to play exec /usr/games/okgalaxy\n\r") ;
exit(0) ;
}
getout(s)
char *s ;
{
fprintf(stderr, "pager: %s.\n", s) ;
exit(1) ;
}
SHAR_EOF
if test 563 -ne "`wc -c pager.c`"
then
echo shar: error transmitting pager.c '(should have been 563 characters)'
fi
echo shar: creating directory safe
mkdir safe
chdir safe
echo shar: extracting Makefile '(768 characters)'
cat << \SHAR_EOF > Makefile
#
# %W% (mrdch&amnnon) %E%
#
LIBDIR = /usr/games/lib/galaxy
GAMES = /usr/games
MV = /bin/mv
CFLAGS = -O -s
all: okgalaxy pager local edscore
okgalaxy: okgalaxy.c
cc ${CFLAGS} -o okgalaxy okgalaxy.c
pager: pager.c
cc ${CFLAGS} -o pager pager.c
local: local.c
cc ${CFLAGS} -o local local.c
edscore: edscore.c constants.h score.h
cc $(CFLAGS) -o edscore edscore.c
.DEFAULT:
sccs get $@
clean:
/bin/rm okgalaxy pager local edscore
install: all
chuser galaxy okgalaxy pager local edscore galaxy.motd galaxy.csh
chmod 755 galaxy.csh
cp okgalaxy pager local edscore ${LIBDIR}
chmod 4111 ${LIBDIR}/okgalaxy
cp galaxy.motd ${LIBDIR}
cp galaxy.csh ${GAMES}
SHAR_EOF
if test 768 -ne "`wc -c Makefile`"
then
echo shar: error transmitting Makefile '(should have been 768 characters)'
fi
echo shar: extracting READ_ME '(498 characters)'
cat << \SHAR_EOF > READ_ME
This directory holds the service programs, used by galaxy.
The make will make it all. Read before using.
Some remarks:
"galaxy.csh" is the front end of the whole game. It enables
posting of some remarks through a motd file in
/users/games/lib/galaxy.
"edscore" enables paging through the score file for editing
purpose. Use whenever necessary.
"okgalxy","pager" and "local" are programs to establish
communication when the game starts.
mrdch & amnnon
SHAR_EOF
if test 498 -ne "`wc -c READ_ME`"
then
echo shar: error transmitting READ_ME '(should have been 498 characters)'
fi
echo shar: extracting constants.h '(3763 characters)'
cat << \SHAR_EOF > constants.h
/*
* %W% (mrdch&amnnon) %E%
*/
/*
* this file contains all the constants used by the game.
*/
# define HOME "/usr/games/lib/galaxy/"
# define LOCAL "/usr/games/lib/galaxy/local"
# define WIZFIL "/usr/games/lib/galaxy/wizards"
# define LOGFIL "/usr/games/lib/galaxy/galaxy.log"
# define SAVEFIL "/usr/games/lib/galaxy/galaxy.save"
# define SAVETMP "/usr/games/lib/galaxy/galaxy.tmp"
# define GALSCOR "/usr/games/lib/galaxy/galaxy.scor"
# define PAGER "/usr/games/lib/galaxy/pager"
# define ESPSIZ 8 /* max nesting of espionage */
# define MAXSHIPS 7 /* how many types of ships */
# define MAXPL 91 /* how many planets are there */
# define PLKINDS 5 /* how many kinds of planets */
# define MAXCHAN 2 /* maximum no. of chanels to open */
# define NCREW 64 /* no. of fighters in A-type HAWK */
# define VISITORS 128 /* no. of additional people */
# define MSGSIZ 150 /* max chars in a single masseg */
# define CLASES 6 /* how many clases of people */
# define FIGT 0 /* fighters */
# define CITI 1 /* citizens */
# define SCIE 2 /* scientists */
# define BUIL 3 /* builders */
# define MINE 4 /* miners */
# define SLAV 5 /* slaves */
# define ESPTYP 7 /* different types of espionage:*/
# define ESPKIND 0 /* what kind of planet is it */
# define ESPPOP 1 /* how many people are there */
# define ESPKNOW 2 /* what is the knowledge level */
# define ESPMTL 3 /* how much metal was digged out*/
# define ESPSHIP 4 /* what are the forces there */
# define ESPALM 5 /* how many ALM were installed */
# define ESPMSL 6 /* how many missiles are there */
# define BUILD_MONEY 0 /* MONEY given to build ships */
# define LEVEL 1 /* the LEVEL of ships ordered build */
# define NSHIPS 2 /* the NO. of ships ordered build */
# define N_PSI 20 /* max possible messages on screen */
# define ALMCOST 100 /* how much costs 1 ALM */
# define REMOVE_COST 50 /* to remove one if yours */
# define ALM_KILL_COST 200 /* to remove from the enemy's planet */
# define YEARLENGTH 180 /* a turn is 3 min. */
# define PERC_TRADE 10 /* the minimum % of profit in trade */
# define PERC_POPUL 10 /* the % of natural growth */
# define FEED_RATIO 100 /* no. people fed by 1 teller a year*/
# define MINING_FACTOR 100 /* years_manpower 1A metals */
# define KNOW_FACTOR 1000 /* years_manpower to raise 1 level */
# define SHIP_COST 100 /* basic cost factor to build ship */
# define MISSILE_COST 400 /* to put a A-type missile */
# define REDUCE_RATE 10 /* detecting lost effect % in a year */
# define FADE_RATE 25 /* undetection paint fading rate */
# define MIN_ESP 100 /* the minimum to report ANYTHING */
# define KIND_ESP MIN_ESP /* to find out the planet's type */
# define POPUL_ESP 5*MIN_ESP /* for it's population */
# define KNOW_ESP 3*MIN_ESP /* the level of knowledge there */
# define METAL_ESP 2*MIN_ESP /* how much metal has he */
# define FORCE_ESP 10*MIN_ESP /* what are his forces there */
# define ALM_ESP 2*MIN_ESP /* how many alms he's got */
# define MSL_ESP 8*MIN_ESP /* how many missiles he set there */
SHAR_EOF
if test 3763 -ne "`wc -c constants.h`"
then
echo shar: error transmitting constants.h '(should have been 3763 characters)'
fi
echo shar: extracting edscore.c '(1888 characters)'
cat << \SHAR_EOF > edscore.c
/*
* %W% (mrdch&amnnon) %E%
*/
# include <sys/types.h>
# include "constants.h"
# include "score.h"
# include <stdio.h>
char *tmpf = "/usr/games/lib/galaxy/scoreXXXXXX";
char *ctime ();
int tmp,
sc;
main () {
struct score s;
char c;
long time();
sc = open (GALSCOR, 0);
if (sc < 0) {
perror (GALSCOR);
exit (1);
}
tmp = creat (mktemp (tmpf), 0600);
if (tmp < 0) {
perror (tmpf);
exit (1);
}
while (read (sc, &s, sizeof (s)) == sizeof (s)) {
if (c != 'q') {
char *str,
*index ();
str = ctime (&s.played_at);
*index (str, '\n') = '\0';
printf ("%s,%s %d %s ", s.win, s.los, s.years, str);
c = getchar ();
if (c != '\n')
while (getchar () != '\n');
}
switch (c) {
case 'd':
break;
case 'q':
default:
write (tmp, &s, sizeof (s));
break;
case 'a':
write (tmp, &s, sizeof (s));
printf("winner ? ");
gets(s.win);
printf("looser ? ");
gets(s.los);
printf("years ? ");
rint(&s.years);
s.played_at = time(0);
write(tmp, &s, sizeof(s));
break;
}
}
if (unlink (GALSCOR) < 0) {
fprintf (stderr, "unlink ");
perror (GALSCOR);
exit (1);
}
if (link (tmpf, GALSCOR) < 0) {
fprintf (stderr, "link ");
perror (GALSCOR);
exit (1);
}
if (unlink (tmpf) < 0) {
fprintf (stderr, "unlink ");
perror (tmpf);
exit (1);
}
exit (0);
}
rint(i)
int *i;
{
char s[100];
gets(s);
*i = atoi(s);
}
SHAR_EOF
if test 1888 -ne "`wc -c edscore.c`"
then
echo shar: error transmitting edscore.c '(should have been 1888 characters)'
fi
echo shar: extracting galaxy.csh '(158 characters)'
cat << \SHAR_EOF > galaxy.csh
#! /bin/csh -f
#
# %W% (mrdch&amnnon) %E%
#
set motd = "/usr/games/lib/galaxy/galaxy.motd"
if ( -e $motd) cat $motd
/usr/games/lib/galaxy/galaxy.out $argv
SHAR_EOF
if test 158 -ne "`wc -c galaxy.csh`"
then
echo shar: error transmitting galaxy.csh '(should have been 158 characters)'
fi
echo shar: extracting galaxy.motd '(214 characters)'
cat << \SHAR_EOF > galaxy.motd
Wellcome to the Universe of Galaxies!!!
If that's your first time to try galaxy, I hope you have
read the manual first. If not, hit 'del' to exit and
then do 'man galaxy'.
Enjoy your journey!!!
SHAR_EOF
if test 214 -ne "`wc -c galaxy.motd`"
then
echo shar: error transmitting galaxy.motd '(should have been 214 characters)'
fi
echo shar: extracting local.c '(421 characters)'
cat << \SHAR_EOF > local.c
/*
* %W% (mrdch&amnnon) %E%
*/
# include <stdio.h>
struct chan
{
int ichan ;
char c ;
} ;
main(ac, av)
int ac ;
char **av ;
{
struct chan c ;
if(ac != 2)
exit(1) ;
c.ichan = atoi(av[1]) ;
while(!feof(stdin))
{
c.c = getchar() ;
write(1, (char *)&c, sizeof(c)) ;
}
exit(0) ;
}
SHAR_EOF
if test 421 -ne "`wc -c local.c`"
then
echo shar: error transmitting local.c '(should have been 421 characters)'
fi
echo shar: extracting okgalaxy.c '(804 characters)'
cat << \SHAR_EOF > okgalaxy.c
/*
* %W% (mrdch&amnnon) %E%
*/
# include <stdio.h>
# include <signal.h>
# include <sys/types.h>
# include <sys/stat.h>
struct stat stbuf ;
char *tty ;
main()
{
char *ttyname() ;
int doexit() ;
tty = ttyname(0) ;
if(tty == 0)
{
fprintf(stderr, "Don't know you.\n") ;
exit(1) ;
}
stat(tty, &stbuf) ;
signal(SIGINT, doexit) ;
signal(SIGQUIT, doexit) ;
signal(SIGTSTP, doexit) ;
if(chmod(tty, 0666) == -1)
{
fprintf(stderr, "Your tty ain't yours.\n") ;
exit(1) ;
}
printf("Please wait.....") ;
fflush(stdout) ;
pause() ;
}
doexit()
{
chmod(tty, stbuf.st_mode) ;
exit(0) ;
}
SHAR_EOF
if test 804 -ne "`wc -c okgalaxy.c`"
then
echo shar: error transmitting okgalaxy.c '(should have been 804 characters)'
fi
echo shar: extracting pager.c '(563 characters)'
cat << \SHAR_EOF > pager.c
/*
* %W% (mrdch&amnnon) %E%
*/
# include <stdio.h>
main(ac, av)
int ac ;
char **av ;
{
FILE *tty ;
if(ac != 3)
getout("arg count") ;
tty = fopen(av[1], "w") ;
if(tty == NULL)
getout("cannot open terminal") ;
fprintf(tty, "\07\07%s would like to play galaxy with you.\n\r",av[2]) ;
fprintf(tty, "\07\07If you wish to play exec /usr/games/okgalaxy\n\r") ;
exit(0) ;
}
getout(s)
char *s ;
{
fprintf(stderr, "pager: %s.\n", s) ;
exit(1) ;
}
SHAR_EOF
if test 563 -ne "`wc -c pager.c`"
then
echo shar: error transmitting pager.c '(should have been 563 characters)'
fi
echo shar: extracting score.h '(436 characters)'
cat << \SHAR_EOF > score.h
/*
* %W% (mrdch&amnnon) %E%
*/
/*
* this file defines the score information structure.
*/
struct score /* score log structure */
{
char win[20] ; /* winner name */
char los[20] ; /* looser name */
int years ; /* game years played */
time_t played_at ; /* date played at */
} ;
SHAR_EOF
if test 436 -ne "`wc -c score.h`"
then
echo shar: error transmitting score.h '(should have been 436 characters)'
fi
echo shar: done with directory safe
chdir ..
echo shar: extracting score.h '(436 characters)'
cat << \SHAR_EOF > score.h
/*
* %W% (mrdch&amnnon) %E%
*/
/*
* this file defines the score information structure.
*/
struct score /* score log structure */
{
char win[20] ; /* winner name */
char los[20] ; /* looser name */
int years ; /* game years played */
time_t played_at ; /* date played at */
} ;
SHAR_EOF
if test 436 -ne "`wc -c score.h`"
then
echo shar: error transmitting score.h '(should have been 436 characters)'
fi
# End of shell archive
exit 0MRDCH@TAURUS.BITNET (06/09/85)
From: Mordechai Chachamu <mrdch@taurus.BitNet>
Hello everybody!!!
This is part #3 out of 10. It containes many small files that are
to be available for on line review of the document. Place them in
~galaxy/online.
mrdch
# This is a shell archive.
# Remove everything above and including the cut line.
# Then run the rest of the file through sh.
-----cut here-----cut here-----cut here-----cut here-----
#!/bin/sh
# shar: Shell Archiver
# Run the following text with /bin/sh to create:
# READ_ME
# assign.doc
# battle.doc
# blackout.doc
# build.doc
# capture.doc
# chng_ply.doc
# cons1.doc
# cons2.doc
# cons3.doc
# cons4.doc
# detect.doc
# espionage.doc
# feedpop.doc
# give_up.doc
# help.doc
# init_dis.doc
# intro.doc
# killalm.doc
# leave_at.doc
# map.doc
# move_to.doc
# moving.doc
# next_year.doc
# overstat.doc
# paint.doc
# planenq.doc
# plansit.doc
# plnames.doc
# prices.doc
# putalm.doc
# quit.doc
# restor.doc
# retrieve.doc
# savegame.doc
# screen.doc
# set_missl.doc
# takefrom.doc
# time.doc
# trade.doc
# write.doc
# This archive created: Fri Jun 7 23:02:51 1985
echo shar: extracting READ_ME '(387 characters)'
cat << \SHAR_EOF > READ_ME
This directory containes sections that were cut from
the document, to enable on line consulting during the game.
For sake of effiency, the line length was increased to 77.
Minor changes were made to the original document.
If a change was introduced to the game,
( or any reason you might have) than adding:
.nr LL 77n
.ll 77n
as the first two lines, will produce the line length effect.
SHAR_EOF
if test 387 -ne "`wc -c READ_ME`"
then
echo shar: error transmitting READ_ME '(should have been 387 characters)'
fi
echo shar: extracting assign.doc '(819 characters)'
cat << \SHAR_EOF > assign.doc
As - Assign people from occupation to occupation.
If you want to change the balance of manpower among the various occupa-
tions on any of your planets, you can give the As command. You start with
Citizens and Fighters, but you can add Scientists, Miners and Builders as
need arises. If you have succeeded to take slaves- they can be assigned to
work ONLY in the mines. Remember, however, that they cannot be trusted even
with such simple work. In order for them to produce anything there must be at
least 1 miner from your population to supervise them.
Format and examples:
as 20 c f Assign from current planet 20 citizens to fighters.
as c50 20 c s Assign from c50 20 citizens to scientists.
as c50 20 m b Assign from c50 20 miners to builders.
SHAR_EOF
if test 819 -ne "`wc -c assign.doc`"
then
echo shar: error transmitting assign.doc '(should have been 819 characters)'
fi
echo shar: extracting battle.doc '(1490 characters)'
cat << \SHAR_EOF > battle.doc
The Battle
Any attempt to land upon an enemy-occupied planet will result in immedi-
ate battle. The balance between the fighting forces determines the outcome
of the battle. Usually any X-type HAWK equals another X-type HAWK, so that
when engaged in fighting the two ships will destroy each other. If the fight-
ing is between unequal levels, the (X+1)-type is twice stronger then X-type.
For example, if a B-type ship fights against an A-type ship, the A-type will
be destroyed and the B-type will remain intact. But if 2 A-type ships fight 1
B-type ship - the two forces will destroy each other. If a ship is hit in a
battle, it is totally destroyed, and whatever it carries is lost. The above
rules hold in cases that the base of the attacking ships is exactly 1 planet
apart from their target. If they had to travel a longer distance, their com-
bat efficiency decreases. There is a possibility that a defending ship will
destroy an attacking one, of the SAME level, without getting hurt. These
chances increase significantly at distances longer then 4. If you succeed in
conquering a planet, all its residents become your slaves. If there were any
slaves there, they are freed, for they are your citizens once captured. Any
metal digged now belongs to you. However, if it is a scientific planet, the
knowledge there will be A-level only. The scientists had enough time to des-
troy all the evidence for higher knowledge.
SHAR_EOF
if test 1490 -ne "`wc -c battle.doc`"
then
echo shar: error transmitting battle.doc '(should have been 1490 characters)'
fi
echo shar: extracting blackout.doc '(640 characters)'
cat << \SHAR_EOF > blackout.doc
Bo - Black out a planet.
This command enables you to make life harder for the enemy's spies and
detective devices. By blacking out a planet, the amount of time and money
needed to obtain information is increased. You can black out ANY planet, pro-
vided that you have landed on it. This includes planets on which you plan to
install ALMs when leaving. Note again that this command can be given only
while your forces are ON the planet.
Format and examples:
bo 20 Black out the current planet, investing 20 tellers.
bo c50 20 Black out planet c50, investing 20 tellers.
SHAR_EOF
if test 640 -ne "`wc -c blackout.doc`"
then
echo shar: error transmitting blackout.doc '(should have been 640 characters)'
fi
echo shar: extracting build.doc '(952 characters)'
cat << \SHAR_EOF > build.doc
Bs - Build ships.
With this command the builders will start working on the construction of
new ships. The command specifies the planet on which the construction will
take place, the level and no. of ships to be built and the money assigned for
that purpose. If any of prerequisites for ship construction is absent, the
work will not start. However, it is not necessary that the material and/or
the money needed to accomplish ALL the work be available at the time that the
command is given.
Format and examples:
bs 2a 20 Build on the current planet 2 A-type ships, investing 20
tellers.
bs c50 2a 20 Build on c50 2 A-type ships, investing 20 tellers.
bs t 20 Add 20 tellers to cover building ships expenses on the
current planet.
bs c50 t 20 Add 20 tellers to cover building ships expenses on planet
c50.
SHAR_EOF
if test 952 -ne "`wc -c build.doc`"
then
echo shar: error transmitting build.doc '(should have been 952 characters)'
fi
echo shar: extracting capture.doc '(587 characters)'
cat << \SHAR_EOF > capture.doc
Capturing a planet without violence.
To capture a planet you have to control ALL the planets that have DIRECT
access to that planet. That is, there is no route between the enemy's capital
and the to-be-captured planet that doesn't go through one of your planets.
If you succeed, all the goods that are on that planet (even knowledge) are
now yours. The planet's inhabitants, including soldiers, will become your
slaves - to labor as miners. (You cannot use the enemy's ships. Their body is
different, and all the survival means are totally alien to you).
SHAR_EOF
if test 587 -ne "`wc -c capture.doc`"
then
echo shar: error transmitting capture.doc '(should have been 587 characters)'
fi
echo shar: extracting chng_ply.doc '(436 characters)'
cat << \SHAR_EOF > chng_ply.doc
Cp - Change player.
This command is only permissible during practice sessions. Practice ses-
sions are designed to let one player get familiar with the game by playing
the roles of BOTH sides and thus to get acquainted with all the relevant
aspects of the game from both sides. See 'man galaxy' for specifications.
Format and examples:
cp Assume the role of the "other" side.
SHAR_EOF
if test 436 -ne "`wc -c chng_ply.doc`"
then
echo shar: error transmitting chng_ply.doc '(should have been 436 characters)'
fi
echo shar: extracting cons1.doc '(1136 characters)'
cat << \SHAR_EOF > cons1.doc
Key concepts - part 1
Tellers Teller is the official money used in the universe. One teller
equals 150 Uni-Kilos of gold. You currently have 100 Tellers. (The
coin is named after Hieronimus X. Teller, the man who discovered
the existence of Natural Plastic.)
Ships When you escaped, you had with you 15 A-type HAWKs (High Accelera-
tion War Kruisers). An A-type HAWK is equipped with 65 Mega Hertz
Laser Blasters , 4 H-bomb Launchers and a 100 Erg Shield. Laser
Blasters are used in ship to ship battle, H-bombs can hit stars.
The shield protects you from offensive weapons used by the enemy.
If knowledge is acquired, better ships can be built.
Missiles Missiles are stationary devices that have the capability to inter-
cept the landing (or the passage) of an enemy ship, and destroy it.
Their activation depends only on the detection of the approaching
ship(s). When detection is made, the missile steers itself towards
the ship and explodes it.
SHAR_EOF
if test 1136 -ne "`wc -c cons1.doc`"
then
echo shar: error transmitting cons1.doc '(should have been 1136 characters)'
fi
echo shar: extracting cons2.doc '(1025 characters)'
cat << \SHAR_EOF > cons2.doc
Key concepts - part 2
ALMs Anti-Landing-Mines (ALMs) are useful devices to be left on deserted
planets. After their installation they radiate in such a manner
that destroys human body. Anyone (even you) trying to land on such
planet without deactivating the ALMs will have the landing ships
destroyed. The ALMs are detectable and can be remotely deac-
tivated. If this is done, the planet is completely safe.
Fighters In each A-type HAWK there are 64 fighters, so you have 960 fighters
in combat position. You can recruit additional fighters from among
your citizens.
Citizens There are 100 citizens with you. They will work the fields and
labor in the factories, supplying all the life necessities to the
entire population. The number of citizens increases annually by
10%. Each citizen pays 1 Teller per GSY (Galactical Standard Year),
as tax.
SHAR_EOF
if test 1025 -ne "`wc -c cons2.doc`"
then
echo shar: error transmitting cons2.doc '(should have been 1025 characters)'
fi
echo shar: extracting cons3.doc '(725 characters)'
cat << \SHAR_EOF > cons3.doc
Key concepts - part 3
Planets' Properties.
All the planets in the galaxy are rich in natural resources. You can
establish one or more colonies on any of the planets. These colonies can
contribute to the war effort in several ways:
1: Providing nourishment and other life necessities.(Agricultural planet).
2: Providing mining metals needed to build additional war-ships.(Mining
planet).
3: Building new ships.(Industrial planet).
4: Developing faster, stronger and more efficient weapons.(Scientific
planet).
Naturally, each activity carried out in a colony requires manpower. You
will have to assign citizens or fighters for that purpose.
SHAR_EOF
if test 725 -ne "`wc -c cons3.doc`"
then
echo shar: error transmitting cons3.doc '(should have been 725 characters)'
fi
echo shar: extracting cons4.doc '(874 characters)'
cat << \SHAR_EOF > cons4.doc
Key concepts - part 4
Technological Development.
Assigning people to work as scientists and investing money in basic
research will lead to the development of better weapons. Better weapons mean
ships that need half the manpower to operate, carry twice the amount of
blasting power and their shield is twice heavier. When you posses enough
knowledge to build B-type ships, you can build both A-type and B-type ships.
More development will allow you to build C-type ships, etc. Of course, in
order to develop a more advanced technology, you need to invest more man-time
and money (for each successive level) .
Constructing ships.
When you have the knowledge, the material, the money, and the manpower
needed to build another HAWK and you wish to do so, you can build any type of
ship you wish.
SHAR_EOF
if test 874 -ne "`wc -c cons4.doc`"
then
echo shar: error transmitting cons4.doc '(should have been 874 characters)'
fi
echo shar: extracting detect.doc '(698 characters)'
cat << \SHAR_EOF > detect.doc
Dt - Install detect movement devices.
You cannot prevent the enemy from passing by one of your planets. How-
ever, you can be notified when it happens. Giving the Dt command will install
at a specified planet special Movement Detection devices. They cannot accu-
rately report WHAT had passed, but only that movement occurred. As time
passes, this devices have a tendency to deteriorate, and after several years
they will be completely ineffective, if maintenance (money) is not provided.
Format and examples:
dt 20 Invest at current planet 20 tellers to detect movement.
dt c50 20 Invest at c50 20 tellers to detect movement.
SHAR_EOF
if test 698 -ne "`wc -c detect.doc`"
then
echo shar: error transmitting detect.doc '(should have been 698 characters)'
fi
echo shar: extracting espionage.doc '(1470 characters)'
cat << \SHAR_EOF > espionage.doc
Espionage.
Information is a "survive or perish" factor. Knowing the enemy's bases,
war-potential, mines etc. is more than helpful to decide what to do next. Not
knowing it... well. You can send spies to any star in the galaxy. Be sure to
supply them with enough money to bribe or spend in any way necessary to soli-
cit the required information . Not surprisingly, the enemy knows the impor-
tance of knowledge too. You can defend yourself in two ways:
1: Passively, by tightening up security on the planet ("Black out"). This
will make it harder for the enemy's spies to reveal the truth about the
planet. They will have to spend more money, (and time) to get the informa-
tion. Nevertheless, no planet can be totally secured against information
leaks.
2: Actively, by investing money in counter-espionage. This will NOT prevent
the enemy's spies from getting the information, but as soon as he knows
something, you will be notified exactly what information fell into the
enemy's hands. Unfortunately, this counter-espionage is not spy-proof.
The enemy can discover that you know already about his hard-acquired
information by investing in counter-counter-espionage. This can go on and
on, but it seems that after a certain point, knowing that the enemy KNOWS
something is of little importance, for the facts are (possibly) much dif-
ferent by that time.
SHAR_EOF
if test 1470 -ne "`wc -c espionage.doc`"
then
echo shar: error transmitting espionage.doc '(should have been 1470 characters)'
fi
echo shar: extracting feedpop.doc '(603 characters)'
cat << \SHAR_EOF > feedpop.doc
Fd - Feed the population.
With this very general command you can make your people happy, content
and highly motivated, or ill-tempered good-for-nothing slobs. Not only food,
but all the necessities are acquired with the money you put aside with this
command. If the available money does not suffice to feed the entire popula-
tion, the priority is: Fighters(f), scientists(s), builders(b), miners(m) and
slaves(v). Citizens support themselves, so there is no need to feed them.
Format and examples:
fd 20 Invest 20 tellers to feed the population.
SHAR_EOF
if test 603 -ne "`wc -c feedpop.doc`"
then
echo shar: error transmitting feedpop.doc '(should have been 603 characters)'
fi
echo shar: extracting give_up.doc '(346 characters)'
cat << \SHAR_EOF > give_up.doc
Gu - Give up the game.
If you feel that all is lost, or you got tired of the game, you may
surrender. Naturally, this will be considered a loss, and your opponent will
be credited for that. There is no "back up" to that command, so make sure
that this is truly your intention.
Format and examples:
gu
SHAR_EOF
if test 346 -ne "`wc -c give_up.doc`"
then
echo shar: error transmitting give_up.doc '(should have been 346 characters)'
fi
echo shar: extracting help.doc '(1349 characters)'
cat << \SHAR_EOF > help.doc
GALAXY on_line HELP facilities
If you are a complete novice, the wisest thing to do is to give
the "qt" command, wait for your opponent to agree, and read the game's
documentation. It is found in /usr/doc under the name "galaxy"
As it often happens, you know the command, but the weird syntax
escaped you. The "menu" command provides you with a brief description
of the available commands and their syntax.
The part of the manual that describes fully a given command is
obtained by typing "help <command name>". The command name is the FIRST
field in the "menu" output. (The word "man" can be used instead of "help").
General information about various aspects of the game are obtained
by typing "help -<option>". The available options are:
"intro" - Gives the fairy tale introduction to the game.
"screen" - Explains the screen that you have first seen.
"plnames" - Gives the method by which names were assigned to planets.
"map" - Shows an example to it.
"moving" - Tells you how to move the cursor to any planet.
"cons1","cons2","cons3" and "cons4" - Explain basic concepts of the game.
"espionage","time","battle" and "capture" - Explain these issues.
"prices" - What it takes to achieve something.
GALAXY wishes you a pleasent journey in the void.
SHAR_EOF
if test 1349 -ne "`wc -c help.doc`"
then
echo shar: error transmitting help.doc '(should have been 1349 characters)'
fi
echo shar: extracting init_dis.doc '(288 characters)'
cat << \SHAR_EOF > init_dis.doc
Mp - Redraw the map of the game.
If your terminal gets messages from other users, and the galaxies look a
mess, you can rectify things easily by the "map" command. The original map
will be displayed, clearing everything else.
Format and examples:
mp
SHAR_EOF
if test 288 -ne "`wc -c init_dis.doc`"
then
echo shar: error transmitting init_dis.doc '(should have been 288 characters)'
fi
echo shar: extracting intro.doc '(1320 characters)'
cat << \SHAR_EOF > intro.doc
Galactical War - a new fascinating game for two
players.
Mrdch and Amnnon
You were a mighty king of a splendid galaxy, reigning your
kingdom in peace and abundance for hundreds of years. It all
ended suddenly (and sadly) when cruel and powerful villains
invaded your galaxy. You made a hasty retreat, managing to rescue
only a small party of your most loyal subjects. Not much of your
enormous treasure was saved, and you had only a few ships left at
your command. After years of wandering in the unimaginably large
universe, you stumble upon a galaxy which appears uninhabited,
yet suitable as a first move in attempting to regain your glory.
You install your Capital at the center of the galaxy. As a pre-
caution you send patrol ships to explore your surroundings. On
their return, they bring bad news. In a nearby galaxy, there is
another kingdom. You decide not to let another catastrophe happen
to you. This time, you are determined to destroy the enemy.
Feeding your computer with all the available information about
this part of the universe produces the result that you have just
seen.
SHAR_EOF
if test 1320 -ne "`wc -c intro.doc`"
then
echo shar: error transmitting intro.doc '(should have been 1320 characters)'
fi
echo shar: extracting killalm.doc '(681 characters)'
cat << \SHAR_EOF > killalm.doc
Dm - Deactivate Anti-Landing-Mines (ALM).
If you are at a short distance from a mined planet, (one traveling
planet apart in ANY direction), you can try and deactivate the ALMs. It is
better to know in advance HOW MANY of those devices were laid on that planet,
in order to deactivate them all. Remember that even one ALM can destroy a
whole armada, if it tries to land. If the mines were installed by yourself,
you know their exact number and location, so that the deactivating process is
less expensive.
Format and examples:
dm 2 Deactivate at current planet 2 ALMs.
dm c50 3 Deactivate at c50 3 ALMs.
SHAR_EOF
if test 681 -ne "`wc -c killalm.doc`"
then
echo shar: error transmitting killalm.doc '(should have been 681 characters)'
fi
echo shar: extracting leave_at.doc '(823 characters)'
cat << \SHAR_EOF > leave_at.doc
Lv - Leave people and/or material at location.
The Lv command enables you to leave on a planet anything that you have
taken with the Tk command. When leaving knowledge, it is possible that the
knowledge will still transportable by giving the `k' parameter. If the
knowledge is intended to be left on the planet without any intention to move
it furter, then `K' (upper case) should be specifyied.
Format and examples:
lv 20 s Leave on current planet 20 scientists.
lv c50 20 m Leave on c50 20 miners.
lv c50 k Leave on c50 the knowledge previously taken, enabling
it's movement to other planets.
lv c50 K Leave on c50 the knowledge previously taken.
lv c50 20 t Leave on c50 mining products for 20 A-type HAWKs.
SHAR_EOF
if test 823 -ne "`wc -c leave_at.doc`"
then
echo shar: error transmitting leave_at.doc '(should have been 823 characters)'
fi
echo shar: extracting map.doc '(1274 characters)'
cat << \SHAR_EOF > map.doc
Map with routes and planet's names
l30 c00 c02 r30
l3f * ---------_#-----#----#----#-----#_-------- @ r31
* *--^^ | | | ^^--@r3f @
l3e c11 | |
* * * ------#----#----#------ @r3e @ @
l3d l27 l21 | | |
* * * * ----#----#----#---- @ @ @ @
* | | | @ r11
l3c l17* * l34 | c32 | r26 @ @
* * * * * * * ---#----#----#--- @ @ @ @ @ @ @
* *l13 | | | @ @
l3b * | | c43 @
* * * * ----#----#----#---- @ @ @ @
l3a | | |
* * * -------#----#----#c53--- @ @ @
l24 | | | r39
l39* *---___ | | | ___--@ @
* ----------#-----#----#----#-----#--------- @
l38 c60 c64
SHAR_EOF
if test 1274 -ne "`wc -c map.doc`"
then
echo shar: error transmitting map.doc '(should have been 1274 characters)'
fi
echo shar: extracting move_to.doc '(1396 characters)'
cat << \SHAR_EOF > move_to.doc
Mv - Move forces from planet to planet.
This command enables you to move from planet to planet. For this end,
you specify the base planet, the destination planet, the direction and the
force to be moved. You can travel with a single command to any planet that
is on a "straight" line. For example, the following routes are possible:
From c64 to l38, from r31 to r39, from l27 to l36 etc.
If it is possible to move from a given planet to another via more than
one permissible route, the exact direction of movement may be specified. The
direction specification is done with the same character used to move the
current planet pointer on the screen, preceded by the '>' character.
If direction is not given, a straight line direction will be chosen,
whenever possible.
If any Tk commands were given to the base planet, the people and/or the
material specified will be moved with the force mentioned in the Mv command.
Note that the Mv command is in fact a LAND command on the destination planet.
Format and examples: (Assuming that the current planet is l00)
mv -c31 3A Move from current planet to c31 3 A-type HAWKs.
mv l3e - 3a Move from l3e to the current planet 3 A-type HAWKs.
mv l24 -l20 >8 6A 4B C Move from l24 to l20 6 A-type, 4 B-type and 1 C-type,
going "north".
SHAR_EOF
if test 1396 -ne "`wc -c move_to.doc`"
then
echo shar: error transmitting move_to.doc '(should have been 1396 characters)'
fi
echo shar: extracting moving.doc '(1450 characters)'
cat << \SHAR_EOF > moving.doc
Moving the cursor.
If the cursor is within one of the circles in a galaxy, you can either
move along the circle's radius, or along its perimeter. As a rule, the
numerical keypad is used as a direction indicator. For example the '8' points
north, the '6' east and the '1' south-west. The '.' will move you clockwise,
while the ',' counter-clockwise. The '5' key, which is in the middle, will
flip over the page (if the terminal has this capability) so that the informa-
tion on the other side can be reexamined. To visualize things better, here
is the representation of the keypad, as used by the program. If the terminal
lacks keypad - use imagination.
7 8 9
4 5 6
1 2 3
If the cursor is on one of the stars between the two galaxies, you can
move to all directions but usually not diagonally. (The allowed routes in
this area are marked on the map below). If a key other then numeric is
pressed, this is interpreted as a character belonging to a command. Thereupon
the cursor will move down to the line marked 'Command: '. If at any time you
wish to return to the Map section, press the 'esc' key. To return back you
can either press the 'esc' key again, or simply continue the command. (The
latter case holds only if the character typed is NOT numeric.)
SHAR_EOF
if test 1450 -ne "`wc -c moving.doc`"
then
echo shar: error transmitting moving.doc '(should have been 1450 characters)'
fi
echo shar: extracting next_year.doc '(893 characters)'
cat << \SHAR_EOF > next_year.doc
Nn - Ask for a break in game.
The galaxy game tends to be rather long. If a break is needed, then giv-
ing the "Nn" command (NO new year) the time will freeze. While break is
activated, all commands are executable except for "Mv". To resume playing,
use the "Ny" command.
Format and examples:
nn
Ny - Ask for a new year.
It may happen that you don't find anything useful to perform during a
current GSY, and all you do is wait for it to end. By giving the "Ny" command
you can shorten this interval. Of course, in order for the command to be
effective, BOTH players must agree by giving the same command. No report is
send to the enemy that you have given the command, so that each player
decides on his own. In addition, this commands resumes a stopped game (by
"Nn").
Format and examples:
ny
SHAR_EOF
if test 893 -ne "`wc -c next_year.doc`"
then
echo shar: error transmitting next_year.doc '(should have been 893 characters)'
fi
echo shar: extracting overstat.doc '(1370 characters)'
cat << \SHAR_EOF > overstat.doc
Os - Report an Overall Statistics.
At any time, you can ask for an overall evaluation of your situation.
You will receive the statistics concerning your financial, military and popu-
lation position. You can add 1 or more characters to the command (see exam-
ples below). As a result, the planets with the attribute specified in your
command will change their map representation so that they are easily dis-
tinguished from the rest. If the situation has changed since the last command
with the same parameters, the planet representation defaults to the original
one.
Note that the characters can be combined. Especially useful is the combina-
tion that starts with 'n'. This restores the whole map to the original
representation, so that any changes are easily noted.
Format and examples:
Os Report a numeric overview of the situation.
Os [option] Show visualy on the map the planets that have some property.
a - ALM ; b - "Blacked out" ; c - Construction of new ships
d - Detect-movement devices ; e -Espionage ; f - with forces (ships)
F - Fighters ; i - Information available ; k - Knowledge better then A.
m - Missiles ; n - Restore the map to it's original representation.
o - which planet you Own. ; p - anti-detection Paint
s - planet has special category.
SHAR_EOF
if test 1370 -ne "`wc -c overstat.doc`"
then
echo shar: error transmitting overstat.doc '(should have been 1370 characters)'
fi
echo shar: extracting paint.doc '(1003 characters)'
cat << \SHAR_EOF > paint.doc
Nd - Paint ship with anti detection paint.
There is something you can do to prevent the enemy from detecting your
movement in hyper space. You can paint your ships with an Anti-Magnetic-Glare
paint. The effectiveness of this paint is proportional to the no. of paint
layers. The only drawback (apart from the money involved), is that the paint
wears off when traveling in hyper space. To repaint the ships you have to
land first. The detection probability is proportional to the AMG paint con-
dition compared with the strength of the detection devices.
Note that with the money provided the paint is only purchased. The actual
painting will be done only after the "Mv" command was given, so that the
paint will have the maximum effect. There is no paint left after the "Mv"
command execution.
Format and examples:
nd 20 Buy AMG paint at current planet with 20 tellers.
nd c50 20 Buy AMG paint at c50 with 20 tellers .
SHAR_EOF
if test 1003 -ne "`wc -c paint.doc`"
then
echo shar: error transmitting paint.doc '(should have been 1003 characters)'
fi
echo shar: extracting planenq.doc '(1429 characters)'
cat << \SHAR_EOF > planenq.doc
En - Enquire about a planet.
Using this command you can invest money in espionage. You have to
specify the planet, the level of espionage, the specific issue of interest
and the amount of money dedicated to that purpose. Note that some espionage
assignments are easier to carry out, and thus will require less money than
others. The topics that can be subjects of enquiry are:
The kind of planet (s), planet's population (p), planet's knowledge
level (k), amount of metal (t), number and type of ships there (f), number of
ALMs installed (a), number and type of missiles (m).
As for the level. Sending spies to get information as per above is
called "zero level" (it need not be specified). Setting counter-espionage for
that level is ALSO "zero level". When the enemy wishes to establish a
counter-counter-espionage it will be called "first level". This level
represents for the defender the "counter-counter-counter-espionage" and so
on.
Format and examples:
en f 20 Set spies on current planet, level zero, check out the
forces there, investing 20 tellers.
en c50 s 20 Set spies on c50, level zero, report planet's status
investing 20 tellers.
en c50 1 p 20 Set spies on c50, first level, report the population
status investing 20 tellers.
SHAR_EOF
if test 1429 -ne "`wc -c planenq.doc`"
then
echo shar: error transmitting planenq.doc '(should have been 1429 characters)'
fi
echo shar: extracting plansit.doc '(777 characters)'
cat << \SHAR_EOF > plansit.doc
Ps - Report the Planet Situation.
Information about any particular planet is also always available, and
you can have its full description reported to you. The description will
include details on the properties of the planet, its military and economic
situation and its inhabitants. Of course, asking about a planet that doesn't
belong to you might result in very little information. If espionage reports
are needed, they should be explicitly requested.
Format and examples:
ps Report about the planet under cursor (called "current").
ps i Report espionage results in the current planet.
ps c50 Report about planet c50.
ps c50 i Report espionage results in planet c50.
SHAR_EOF
if test 777 -ne "`wc -c plansit.doc`"
then
echo shar: error transmitting plansit.doc '(should have been 777 characters)'
fi
echo shar: extracting plnames.doc '(1158 characters)'
cat << \SHAR_EOF > plnames.doc
How the planets are named
Many commands require the specification of a planet on which the
intended activity is to take place. By default, the planet that the cursor
is currently on - is the subject of the command. At any time you can have
it's name printed on the command line by pressing cntr/p . If you want to
specify another planet you can either move the cursor to it or give its coor-
dinates in Space:
The left galaxy is abbreviated L, the right R and the in-between region C. In
a galaxy the circles are numbered 0-3, with the center at 0. The planets are
numbered 0-7 in circles 1-2 and 0-9 and a-f in circle 3. The planet at the
hour-12 position is the 0 number, and the rest have consecutive numbers
CLOCKWISE. In the center part, there are 7 rows of planets, numbered 0-6 top
to bottom. In each row there are 3 or 5 planets, numbered 0-4 LEFT to RIGHT
in the first and the last row, and 1-3 in the rest.
To see an example of the map with some planets' names written next to them
give the "help -map" command. The allowed routes in the intergalaxy region
are marked there too.
SHAR_EOF
if test 1158 -ne "`wc -c plnames.doc`"
then
echo shar: error transmitting plnames.doc '(should have been 1158 characters)'
fi
echo shar: extracting prices.doc '(1226 characters)'
cat << \SHAR_EOF > prices.doc
What it takes to do what....
ALMCOST 100 --> To install 1 ALM.
REMOVE_COST 50 --> To remove one - if yours.
ALM_KILL_COST 200 --> To remove from the enemy's planet.
YEARLENGTH 180 --> A turn is 3 min.
PERC_TRADE 5 --> The minimum % of profit in trade.
PERC_POPUL 10 --> The % of natural growth.
FEED_RATIO 100 --> No. people fed by 1 teller a year.
MINING_FACTOR 100 --> Years_manpower to dig 1 A-type metal.
KNOW_FACTOR 2000 --> Years_manpower to raise to B level.
SHIP_COST 100 --> Basic cost (money and years_manpower) to build ship.
MISSILE_COST 400 --> To put an A-type missile.
REDUCE_RATE 10 --> Detecting lost effect % in year.
FADE_RATE 25 --> Undetection paint fading % rate.
MIN_ESP 100 --> The minimum to report ANYTHING.
KIND_ESP 500 --> To find out the planet's type.
POPUL_ESP 500 --> For it's population.
KNOW_ESP 300 --> The level of knowledge there.
METAL_ESP 200 --> How much metal has he.
FORCE_ESP 1000 --> What are his forces there.
ALM_ESP 200 --> How many alms he's got.
MSL_ESP 800 --> How many missiles he set there.
SHAR_EOF
if test 1226 -ne "`wc -c prices.doc`"
then
echo shar: error transmitting prices.doc '(should have been 1226 characters)'
fi
echo shar: extracting putalm.doc '(604 characters)'
cat << \SHAR_EOF > putalm.doc
Lm - Lay out Anti-Landing-Mines (ALM).
Any planet can be transformed into a deadly trap. Laying down the mines
is a costly action, not lesser then their deactivation. In order to lay the
mine, (or mines), you have to LAND on the planet. Only then can you install
the mines. These devices become active one year after their installation. So,
you must leave immediately. Any human form remaining longer then a year will
be totally disintegrated.
Format and examples:
lm 2 Install on current planet 2 ALMs.
lm c50 3 Install on c50 3 ALMs.
SHAR_EOF
if test 604 -ne "`wc -c putalm.doc`"
then
echo shar: error transmitting putalm.doc '(should have been 604 characters)'
fi
echo shar: extracting quit.doc '(403 characters)'
cat << \SHAR_EOF > quit.doc
Qt - Quit the game.
If you wish to discontinue the game without losing face, you can give
this command. However, your partner should feel the same and agree too by
giving the same command. Automatic canceling of this command takes place at
the beginning of new year. Giving the command AGAIN within the same year has
the same effect.
Format and examples:
qt
SHAR_EOF
if test 403 -ne "`wc -c quit.doc`"
then
echo shar: error transmitting quit.doc '(should have been 403 characters)'
fi
echo shar: extracting restor.doc '(302 characters)'
cat << \SHAR_EOF > restor.doc
Rs - Restore a saved game.
After lunch is over, and you wish to continue a saved game, give the
"restore" command, using the same file name that you used when saving it. As
with "save", both players must agree.
Format and examples:
rs ~john/games/john_vs_michel
SHAR_EOF
if test 302 -ne "`wc -c restor.doc`"
then
echo shar: error transmitting restor.doc '(should have been 302 characters)'
fi
echo shar: extracting retrieve.doc '(696 characters)'
cat << \SHAR_EOF > retrieve.doc
Rt - Retrieve money given.
Sometimes (too often) we all make typing mistakes. This command enables
a player to recover from SOME of them. If too much money was given to feed
the population(f), trade(t), blackout(b) or buiding ships(s), it may be
retrieved, with some lose. Note that these are the only instances that
recovery is possible.
Format and examples:
rt 1000 t
Retrieve 1000 Tellers from trade investment.
rt 1000 f
Retrieve 1000 Tellers from food given.
rt 1000 b c50
Retrieve 1000 Tellers from blackout investment at planet c50.
rt 1000 s
Retrieve 1000 Tellers from ship building investment on current planet.
SHAR_EOF
if test 696 -ne "`wc -c retrieve.doc`"
then
echo shar: error transmitting retrieve.doc '(should have been 696 characters)'
fi
echo shar: extracting savegame.doc '(645 characters)'
cat << \SHAR_EOF > savegame.doc
Sv - Save the game.
Since this is a game for two players, one session may not be enough for
finishing the game. If one partner wishes to save the game
and gives the "Sv" command, his opponent will be notified. If offer
accepted, the game will be saved. (You need two to Tango.) If a "year" had
passed and no positive answer was given, then the TWO players have to agree
on saving the game. If no parameter is given, the game will be saved under
the name "galaxy.save". If a file name was specified, the game will be saved
under this name.
Format and examples:
sv ~john/games/john_vs_michel
SHAR_EOF
if test 645 -ne "`wc -c savegame.doc`"
then
echo shar: error transmitting savegame.doc '(should have been 645 characters)'
fi
echo shar: extracting screen.doc '(1491 characters)'
cat << \SHAR_EOF > screen.doc
The screen.
The screen is divided into two areas. The upper area presents the map
shown before. You can see two galaxies. One is yours and the other is the
enemy's. Each galaxy consists of three nested circles of planets and the Cap-
ital in their center. Between them there are some stars which (at the begin-
ning of the game) don't belong to either of you. This area is called the
intergalactical area. The lower part of the screen is used for communication
between you and your faithful Head of Administration. All the commands are
given to him. He is the channel through which all the information to you is
reported, and all your commands properly delivered to your subjects scattered
throughout the galaxy. The information that is constantly kept updated
beneath the map is the name of the planet under cursor, the amount of money
left and the current year. Another line is dedicated to messages sent to you
by the enemy and other information that is reported to you. Usually this
information is independent of the last issued command. The messages are
displayed one after the other. It takes about three commands for the next
message to show up, but if the '-' key is pressed, the next message (if
existent) will be displayed immediately. You are prompted with '-More-'
whenever there is another message waiting. Also note that the terminal's
bell rings when a new message has arrived.
SHAR_EOF
if test 1491 -ne "`wc -c screen.doc`"
then
echo shar: error transmitting screen.doc '(should have been 1491 characters)'
fi
echo shar: extracting set_missl.doc '(1069 characters)'
cat << \SHAR_EOF > set_missl.doc
Sm - Set missiles.
Missiles are defense weapons. Once installed on a planet, they cannot be
transferred elsewhere. They can intercept and destroy any enemy ship that
tries to land on that planet, as well as passing by ships. An A-type missile
destroys A-type ship , B-type missile destroys B-type ship etc. B-type mis-
sile destroys 2 A-type ships, etc. As with ship construction, the knowledge
for better missiles should be available before any attempt at setting them.
Also, there must be enough soldiers to carry out the work.
Installing missiles does not ensure their operation. Their activation
depends on detecting the enemy's movement. If not enough money was invested
in detecting devices, the enemy can even land on the planet without interfer-
ence from the missiles ( see the "dt" command for details).
Format and examples:
sm 2a Set on the current planet 3 A-type missiles.
sm c51 2a Set on c51 2 A-type missiles.
sm c51 2a 4b Set on c51 2 A-type and 4 B-type missiles.
SHAR_EOF
if test 1069 -ne "`wc -c set_missl.doc`"
then
echo shar: error transmitting set_missl.doc '(should have been 1069 characters)'
fi
echo shar: extracting takefrom.doc '(1235 characters)'
cat << \SHAR_EOF > takefrom.doc
Tk - Take people or equipment.
The Tk command enables you to take people or equipment from a specified
planet and move them to another planet. If you intend to move people, you
specify their occupation and number. An A-type HAWK can carry 128 persons
(in addition to the regular crew) a B-type HAWK carries 256 etc. In addi-
tion, A-type HAWK can carry mining products sufficient to build another A-
type HAWK. To carry the material for a B-type HAWK, you need either 2 A-type
HAWKs or a B-type HAWK etc. The amount of mining material is specified by
A-type HAWKs quantities. The only commodity that doesn't raise any transpor-
tation problems is knowledge. Any type HAWK can carry any type of knowledge.
When a MOVE command is given (see Mv), the maximum amount of people and
material is loaded onto the departing ships. The priority when loading peo-
ple is given by the order specified in the Feed command. (see Fd) .
Format and examples:
tk 20 s Take from current planet 20 scientists.
tk c50 20 m Take from c50 20 miners.
tk c50 k Take from c50 it's knowledge.
tk c50 20 t Take from c50 mining products for 20 A-type HAWKs.
SHAR_EOF
if test 1235 -ne "`wc -c takefrom.doc`"
then
echo shar: error transmitting takefrom.doc '(should have been 1235 characters)'
fi
echo shar: extracting time.doc '(809 characters)'
cat << \SHAR_EOF > time.doc
Time
The GSY (Galactical Standard Year) is the time reference for you and
your enemy. Each GSY has 100 GSDs (Galactical Standard Day). The current time
is updated at the end of each command. Some commands are carried out immedi-
ately, while other take time to be completed. The following events are time
consuming, and their effect is only evident at the end of the year:
Tax payment, ALM activation, mining metals, buiding new ships, gathering
more knowledge, updating the population size and espionage reports.
A GSY equals about 3 minutes of Earth time. However, to enable the
players to speed up things if they so wish, a NEW YEAR will arrive also in
case that BOTH players have given the "Ny" command (see the "Ny" command sec-
tion).
SHAR_EOF
if test 809 -ne "`wc -c time.doc`"
then
echo shar: error transmitting time.doc '(should have been 809 characters)'
fi
echo shar: extracting trade.doc '(541 characters)'
cat << \SHAR_EOF > trade.doc
Tr - Invest in trade.
Investing money in trade can be of great help. A good trading year can
bring a 5-25 percent profit. The drawback is, of course, that the money will
be available only the NEXT year. The profit percent highly depends on the
number of planets under your control. If the number is higher than the ori-
ginal number, 0.5 percent is added per conquered planet. If not, you will
have the minimal profit only.
Format and examples:
tr 20 Invest 20 tellers in trade.
SHAR_EOF
if test 541 -ne "`wc -c trade.doc`"
then
echo shar: error transmitting trade.doc '(should have been 541 characters)'
fi
echo shar: extracting write.doc '(371 characters)'
cat << \SHAR_EOF > write.doc
Wr - Write a message to the enemy.
You can ask/blame/tell your opponent anything you want by writing him a
message. The message should be one line long. You can write as many as you
wish. If you intend to communicate with him, be patient until he answers
back.
Format and examples:
wr Shall we take a break and save the game??
SHAR_EOF
if test 371 -ne "`wc -c write.doc`"
then
echo shar: error transmitting write.doc '(should have been 371 characters)'
fi
# End of shell archive
exit 0MRDCH@TAURUS.BITNET (06/09/85)
From: Mordechai Chachamu <mrdch@taurus.BitNet>
Hello everybody!!!
This is part #6 out of 10. It contains some of the source files
for the game proper. They should be placed in ~galaxy/src.
mrdch
# This is a shell archive.
# Remove everything above and including the cut line.
# Then run the rest of the file through sh.
-----cut here-----cut here-----cut here-----cut here-----
#!/bin/sh
# shar: Shell Archiver
# Run the following text with /bin/sh to create:
# init_all.c
# kill_alm.c
# leave_at.c
# This archive created: Sat Jun 8 12:58:38 1985
echo shar: extracting init_all.c '(24401 characters)'
cat << \SHAR_EOF > init_all.c
/*
* %W% (mrdch&amnnon) %G%
*/
# include "header"
FILE * ttys[2];
planet * spntr = &pl[0]; /* the first planet to point to by * */
planet * apntr = &pl[33]; /* the first planet to point to by & */
planet * capitals[2];
info * info_head[2];
int iswiz[2];
/*
* The following are flags to indicate that one of the players
* wants to perform a specific action. If both flags are set,
* action is taken.
*/
int wants_save[2];
int wants_quit[2];
int wants_restor[2];
int wants_newy[2];
int wants_pause[2];
int Pause = 0; /* 0 indicates no cup of coffee */
/* initial money sum for each player */
int teller[2] = {
100, 100
};
/* initial money given for feeding each player */
int food[2] = {
11, 11
};
/* money invested in trade */
int trade[2] = TWOZERO;
/* the first year of the Galactical-Time */
int year = 0;
int skip;
int player;
/* initialization of various arrays */
char *ocup_name[CLASES] = {
"fighters", "citizens", "scientists",
"builders", "miners", "slaves"
};
int espcost[ESPTYP] = {
MIN_ESP,
POPUL_ESP,
KNOW_ESP,
METAL_ESP,
FORCE_ESP,
ALM_ESP,
MSL_ESP
};
char *inftypes[ESPTYP] =
{
"KIND", "POPUL", "KNOW", "METALS", "FORCES", "ALMs", "MISSL"
};
jmp_buf jparse;
init_disp () {
/* find out who is the current player */
if (!player)
curpln = spntr;
else
curpln = apntr;
init_disc ();
prteller ();
}
init_disc () {
clear ();
init_dis ();
}
init_dis () {
int i;
for (i = 0; i < MAXPL; i++) {
draw_map (&pl[i]);
}
so (22, 0, "Command:");
}
show_name () {
FILE * namefile;
char nwcm[200];
(void) sprintf (nwcm, "%sGname", ONLINE);
namefile = fopen (nwcm, "r");
if (namefile == NULL) {
say ("I think you have the wrong name, sir. Try \"help\".");
}
while (fgets (nwcm, 200, namefile) != NULL)
print ("%s\r", nwcm);
(void) fclose (namefile);
}
struct todif {
char ch;
int r, c;
};
struct todif moves[] = {
{ ' ', 0 ,6 },
{ ' ', 13 ,48 },
{ ' ', 0 ,75 },
{ ' ', 1 ,63 },
{ ' ', 13 ,32 },
{ ' ', 2 ,9 },
{ ' ', 7 ,60 },
{ ' ', 12 ,72 },
{ ' ', 8 ,10 },
{ ' ', 1 ,8 },
{ ' ', 8 ,20 },
{ ' ', 2 ,21 },
{ ' ', 7 ,57 },
{ ' ', 2 ,31 },
{ ' ', 11 ,29 },
{ ' ', 1 ,48 },
{ ' ', 11 ,31 },
{ ' ', 2 ,24 },
{ ' ', 11 ,49 },
{ ' ', 2 ,49 },
{ ' ', 3 ,49 },
{ ' ', 12 ,35 },
{ ' ', 2 ,57 },
{ ' ', 12 ,70 },
{ ' ', 3 ,75 },
{ ' ', 4 ,16 },
{ ' ', 0 ,55 },
{ ' ', 4 ,30 },
{ ' ', 5 ,62 },
{ ' ', 0 ,69 },
{ ' ', 5 ,67 },
{ ' ', 6 ,30 },
{ ' ', 12 ,31 },
{ ' ', 6 ,61 },
{ ' ', 2 ,67 },
{ ' ', 7 ,3 },
{ ' ', 4 ,57 },
{ ' ', 5 ,9 },
{ ' ', 7 ,23 },
{ ' ', 8 ,29 },
{ ' ', 5 ,24 },
{ ' ', 8 ,43 },
{ ' ', 1 ,17 },
{ ' ', 1 ,43 },
{ ' ', 8 ,50 },
{ ' ', 5 ,50 },
{ ' ', 8 ,68 },
{ ' ', 1 ,29 },
{ ' ', 8 ,75 },
{ ' ', 9 ,19 },
{ ' ', 9 ,47 },
{ ' ', 10 ,10 },
{ ' ', 1 ,21 },
{ ' ', 10 ,70 },
{ ' ', 12 ,55 },
{ ' ', 11 ,62 },
{ ' ', 0 ,20 },
{ ' ', 12 ,8 },
{ ' ', 11 ,11 },
{ ' ', 13 ,6 },
/* end of sname 1-2 */
{ ' ', 0 ,21 },
{ ' ', 1 ,31 },
{ ' ', 2 ,29 },
{ ' ', 3 ,67 },
{ ' ', 6 ,67 },
{ ' ', 7 ,30 },
{ ' ', 13 ,31 },
{ ' ', 0 ,7 },
{ ' ', 13 ,35 },
{ ' ', 7 ,49 },
{ ' ', 13 ,62 },
{ ' ', 7 ,56 },
{ ' ', 0 ,57 },
{ ' ', 7 ,50 },
{ ' ', 0 ,68 },
{ ' ', 1 ,6 },
{ ' ', 12 ,16 },
{ ' ', 1 ,45 },
{ ' ', 12 ,24 },
{ ' ', 1 ,18 },
{ ' ', 7 ,59 },
{ ' ', 8 ,22 },
{ ' ', 3 ,22 },
{ ' ', 2 ,55 },
{ ' ', 7 ,69 },
{ ' ', 8 ,42 },
{ ' ', 7 ,75 },
{ ' ', 8 ,18 },
{ ' ', 2 ,68 },
{ ' ', 3 ,3 },
{ ' ', 9 ,42 },
{ ' ', 10 ,31 },
{ ' ', 11 ,42 },
{ ' ', 8 ,19 },
{ ' ', 11 ,63 },
{ ' ', 8 ,56 },
{ ' ', 9 ,3 },
{ ' ', 5 ,22 },
{ ' ', 9 ,44 },
{ ' ', 10 ,22 },
{ ' ', 5 ,30 },
{ ' ', 9 ,7 },
{ ' ', 3 ,10 },
{ ' ', 11 ,70 },
{ ' ', 5 ,49 },
{ ' ', 11 ,71 },
{ ' ', 3 ,63 },
{ ' ', 9 ,10 },
{ ' ', 12 ,7 },
{ ' ', 1 ,46 },
{ ' ', 2 ,8 },
{ ' ', 12 ,30 },
{ ' ', 2 ,22 },
{ ' ', 12 ,33 },
{ ' ', 4 ,42 },
{ ' ', 9 ,63 },
{ ' ', 4 ,56 },
{ ' ', 6 ,60 },
{ ' ', 3 ,29 },
{ ' ', 9 ,31 },
{ ' ', 13 ,7 },
{ ' ', 9 ,70 },
{ ' ', 13 ,72 },
/* end of sname 2-3 */
{ ' ', 0 ,46 },
{ ' ', 1 ,30 },
{ ' ', 3 ,68 },
{ ' ', 9 ,11 },
{ ' ', 9 ,29 },
{ ' ', 3 ,69 },
{ ' ', 4 ,68 },
{ ' ', 9 ,16 },
{ ' ', 5 ,56 },
{ ' ', 13 ,55 },
{ ' ', 7 ,48 },
{ ' ', 8 ,7 },
{ ' ', 7 ,61 },
{ ' ', 9 ,17 },
{ ' ', 5 ,48 },
{ ' ', 9 ,9 },
{ ' ', 5 ,55 },
{ ' ', 9 ,30 },
{ ' ', 2 ,16 },
{ ' ', 2 ,75 },
{ ' ', 3 ,11 },
{ ' ', 13 ,63 },
{ ' ', 6 ,68 },
{ ' ', 13 ,70 },
{ ' ', 7 ,29 },
{ ' ', 9 ,43 },
{ ' ', 10 ,62 },
{ '@', 0 ,64 },
{ ' ', 9 ,46 },
{ ' ', 0 ,67 },
{ ' ', 1 ,7 },
{ ' ', 10 ,71 },
{ ' ', 11 ,9 },
{ ' ', 9 ,22 },
{ ' ', 1 ,10 },
{ ' ', 9 ,24 },
{ ' ', 5 ,11 },
{ ' ', 12 ,10 },
{ ' ', 5 ,29 },
{ '*', 12 ,16 },
{ ' ', 9 ,49 },
{ ' ', 10 ,50 },
{ ' ', 9 ,55 },
{ '@', 10 ,56 },
{ ' ', 12 ,32 },
{ ' ', 1 ,68 },
{ ' ', 12 ,36 },
{ ' ', 3 ,23 },
{ ' ', 3 ,57 },
{ ' ', 12 ,49 },
{ ' ', 3 ,31 },
{ ' ', 12 ,50 },
{ ' ', 3 ,48 },
{ ' ', 13 ,22 },
{ ' ', 8 ,16 },
{ ' ', 13 ,29 },
{ ' ', 8 ,63 },
{ ' ', 11 ,22 },
{ ' ', 11 ,23 },
{ ' ', 8 ,69 },
{ ' ', 11 ,61 },
{ ' ', 9 ,6 },
{ ' ', 13 ,37 },
/* end of sname 3-4 */
{ ' ', 0 ,5 },
{ ' ', 1 ,20 },
{ ' ', 0 ,8 },
{ ' ', 2 ,11 },
{ '@', 7 ,69 },
{ ' ', 8 ,3 },
{ '@', 7 ,75 },
{ ' ', 3 ,30 },
{ ' ', 4 ,9 },
{ '#', 3 ,31 },
{ ' ', 4 ,11 },
{ ' ', 12 ,22 },
{ ' ', 4 ,22 },
{ ' ', 12 ,23 },
{ ' ', 4 ,23 },
{ ' ', 0 ,9 },
{ ' ', 1 ,19 },
{ '*', 12 ,24 },
{ ' ', 1 ,22 },
{ ' ', 12 ,29 },
{ ' ', 1 ,44 },
{ '*', 8 ,4 },
{ ' ', 1 ,56 },
{ ' ', 8 ,6 },
{ '#', 2 ,46 },
{ ' ', 1 ,67 },
{ ' ', 2 ,47 },
{ ' ', 1 ,75 },
{ ' ', 2 ,3 },
{ '*', 2 ,6 },
{ ' ', 12 ,34 },
{ ' ', 2 ,48 },
{ '#', 2 ,49 },
{ ' ', 12 ,37 },
{ ' ', 2 ,50 },
{ ' ', 12 ,48 },
{ ' ', 1 ,69 },
{ ' ', 12 ,61 },
{ '@', 1 ,73 },
{ ' ', 12 ,63 },
{ '*', 2 ,12 },
{ ' ', 12 ,71 },
{ ' ', 2 ,30 },
{ ' ', 7 ,67 },
{ '@', 12 ,72 },
{ ' ', 7 ,68 },
{ ' ', 13 ,9 },
{ ' ', 4 ,31 },
{ ' ', 13 ,16 },
{ ' ', 4 ,69 },
{ ' ', 5 ,3 },
{ ' ', 4 ,75 },
{ ' ', 5 ,10 },
{ '#', 0 ,32 },
{ ' ', 2 ,56 },
{ '#', 0 ,43 },
{ ' ', 2 ,63 },
{ '*', 3 ,5 },
{ '#', 5 ,29 },
{ ' ', 3 ,16 },
{ ' ', 5 ,68 },
{ '@', 2 ,66 },
{ ' ', 2 ,69 },
{ ' ', 5 ,69 },
{ ' ', 0 ,31 },
{ '*', 3 ,17 },
{ ' ', 0 ,44 },
{ '@', 5 ,74 },
{ ' ', 5 ,75 },
{ ' ', 10 ,49 },
{ ' ', 4 ,24 },
{ '*', 4 ,25 },
{ ' ', 10 ,55 },
{ ' ', 4 ,29 },
{ ' ', 10 ,56 },
{ ' ', 4 ,49 },
{ ' ', 6 ,16 },
{ '@', 4 ,54 },
{ ' ', 10 ,61 },
{ '@', 4 ,68 },
{ '#', 0 ,46 },
{ ' ', 4 ,63 },
{ ' ', 0 ,47 },
{ '@', 10 ,62 },
{ ' ', 0 ,48 },
{ '*', 6 ,11 },
{ ' ', 4 ,67 },
{ ' ', 6 ,22 },
{ ' ', 10 ,63 },
{ ' ', 6 ,3 },
{ '@', 10 ,70 },
{ '*', 6 ,4 },
{ ' ', 6 ,23 },
{ ' ', 8 ,8 },
{ ' ', 5 ,31 },
{ '#', 5 ,33 },
{ '*', 8 ,10 },
{ ' ', 8 ,17 },
{ ' ', 6 ,24 },
{ '#', 6 ,32 },
{ '#', 6 ,41 },
{ ' ', 0 ,30 },
{ ' ', 1 ,4 },
{ '@', 0 ,67 },
{ ' ', 1 ,5 },
{ ' ', 6 ,42 },
{ '*', 1 ,10 },
{ ' ', 6 ,48 },
{ ' ', 5 ,57 },
{ ' ', 6 ,49 },
{ '@', 5 ,62 },
{ ' ', 8 ,9 },
{ '@', 5 ,66 },
{ '@', 6 ,55 },
{ ' ', 6 ,57 },
{ '#', 0 ,49 },
{ ' ', 6 ,59 },
{ ' ', 0 ,56 },
{ '#', 14 ,51 },
{ '@', 0 ,62 },
{ ' ', 6 ,56 },
{ ' ', 0 ,64 },
{ ' ', 6 ,62 },
{ ' ', 0 ,63 },
{ '@', 6 ,67 },
{ '@', 14 ,61 },
{ ' ', 6 ,69 },
{ '@', 14 ,69 },
{ ' ', 6 ,75 },
{ '*', 7 ,17 },
{ ' ', 13 ,42 },
{ ' ', 6 ,31 },
{ ' ', 13 ,50 },
{ '*', 5 ,13 },
{ ' ', 7 ,16 },
{ ' ', 5 ,16 },
{ '@', 13 ,60 },
{ '*', 5 ,18 },
{ '*', 5 ,22 },
{ ' ', 13 ,61 },
{ ' ', 6 ,29 },
{ ' ', 13 ,71 },
{ '*', 7 ,21 },
{ '*', 6 ,25 },
{ ' ', 7 ,22 },
{ ' ', 8 ,24 },
{ '*', 7 ,23 },
{ '*', 8 ,25 },
{ ' ', 9 ,23 },
{ '#', 9 ,44 },
{ ' ', 3 ,42 },
{ ' ', 9 ,48 },
{ '@', 3 ,74 },
{ ' ', 4 ,3 },
{ '*', 10 ,17 },
{ '@', 10 ,74 },
{ ' ', 11 ,3 },
{ '@', 9 ,54 },
{ '*', 4 ,8 },
{ '@', 9 ,60 },
{ ' ', 3 ,55 },
{ '@', 3 ,62 },
{ ' ', 9 ,61 },
{ '@', 3 ,68 },
{ ' ', 9 ,74 },
{ ' ', 10 ,3 },
{ '@', 8 ,67 },
{ ' ', 10 ,9 },
{ ' ', 8 ,70 },
{ ' ', 7 ,31 },
{ ' ', 8 ,55 },
{ '@', 7 ,60 },
{ '*', 8 ,7 },
{ ' ', 7 ,62 },
{ ' ', 8 ,23 },
{ '*', 10 ,10 },
{ ' ', 8 ,31 },
{ ' ', 10 ,11 },
{ '#', 8 ,32 },
{ ' ', 10 ,16 },
{ '*', 11 ,5 },
{ ' ', 12 ,9 },
{ '*', 11 ,25 },
{ ' ', 12 ,16 },
{ '@', 9 ,68 },
{ ' ', 13 ,30 },
{ ' ', 9 ,69 },
{ ' ', 13 ,34 },
{ ' ', 9 ,71 },
{ ' ', 13 ,36 },
{ '*', 14 ,10 },
{ ' ', 10 ,29 },
{ ' ', 11 ,30 },
{ '*', 14 ,18 },
{ '#', 11 ,41 },
{ ' ', 12 ,4 },
{ ' ', 10 ,30 },
{ '#', 10 ,31 },
{ ' ', 12 ,5 },
{ '#', 14 ,30 },
{ '#', 14 ,37 },
{ ' ', 11 ,10 },
{ '#', 7 ,47 },
{ '*', 11 ,15 },
{ ' ', 7 ,58 },
{ ' ', 8 ,45 },
{ '#', 14 ,35 },
{ ' ', 8 ,46 },
{ '@', 11 ,54 },
{ ' ', 11 ,72 },
{ ' ', 8 ,48 },
{ ' ', 11 ,16 },
{ ' ', 10 ,42 },
{ '#', 14 ,42 },
{ ' ', 10 ,72 },
/* end of sname 4-5 */
{ ' ', 6 ,58 },
{ ' ', 0 ,19 },
{ '@', 6 ,61 },
{ ' ', 0 ,22 },
{ ' ', 1 ,49 },
{ ' ', 2 ,6 },
{ ' ', 1 ,73 },
{ ' ', 2 ,10 },
{ ' ', 3 ,17 },
{ ' ', 12 ,24 },
{ ' ', 3 ,50 },
{ ' ', 12 ,42 },
{ '*', 13 ,7 },
{ ' ', 2 ,42 },
{ '*', 7 ,4 },
{ '@', 2 ,54 },
{ '@', 6 ,66 },
{ '@', 2 ,65 },
{ ' ', 7 ,17 },
{ ' ', 2 ,66 },
{ ' ', 3 ,5 },
{ '*', 3 ,7 },
{ ' ', 13 ,8 },
{ ' ', 1 ,55 },
{ ' ', 1 ,57 },
{ ' ', 6 ,67 },
{ '*', 7 ,12 },
{ '@', 1 ,71 },
{ ' ', 13 ,23 },
{ ' ', 3 ,56 },
{ ' ', 3 ,62 },
{ '*', 5 ,26 },
{ '@', 3 ,67 },
{ ' ', 5 ,42 },
{ ' ', 5 ,62 },
{ '@', 12 ,54 },
{ ' ', 3 ,68 },
{ '*', 4 ,9 },
{ ' ', 4 ,10 },
{ ' ', 12 ,62 },
{ ' ', 2 ,23 },
{ ' ', 3 ,9 },
{ ' ', 12 ,72 },
{ '*', 2 ,14 },
{ ' ', 13 ,5 },
{ '@', 5 ,65 },
{ ' ', 2 ,12 },
{ '@', 5 ,73 },
{ ' ', 6 ,4 },
{ ' ', 5 ,74 },
{ '*', 6 ,19 },
{ ' ', 5 ,66 },
{ ' ', 0 ,32 },
{ '@', 5 ,69 },
{ '#', 0 ,33 },
{ '*', 10 ,18 },
{ '@', 3 ,73 },
{ ' ', 6 ,11 },
{ ' ', 3 ,74 },
{ '*', 4 ,5 },
{ ' ', 10 ,23 },
{ ' ', 4 ,8 },
{ '*', 9 ,4 },
{ ' ', 3 ,24 },
{ ' ', 9 ,8 },
{ ' ', 9 ,18 },
{ ' ', 10 ,24 },
{ ' ', 7 ,21 },
{ ' ', 10 ,48 },
{ ' ', 7 ,23 },
{ '*', 3 ,19 },
{ '*', 9 ,11 },
{ '*', 3 ,26 },
{ '@', 10 ,53 },
{ ' ', 4 ,55 },
{ '*', 11 ,14 },
{ '@', 4 ,60 },
{ ' ', 11 ,15 },
{ ' ', 4 ,68 },
{ ' ', 5 ,18 },
{ '@', 10 ,68 },
{ '@', 7 ,53 },
{ '*', 5 ,14 },
{ ' ', 7 ,60 },
{ '*', 8 ,8 },
{ ' ', 10 ,70 },
{ '#', 0 ,41 },
{ ' ', 5 ,13 },
{ ' ', 0 ,43 },
{ '@', 8 ,74 },
{ ' ', 9 ,21 },
{ ' ', 0 ,46 },
{ ' ', 8 ,25 },
{ '*', 8 ,26 },
{ '@', 0 ,60 },
{ '@', 8 ,69 },
{ ' ', 0 ,62 },
{ '*', 6 ,23 },
{ ' ', 6 ,55 },
{ ' ', 7 ,24 },
{ ' ', 6 ,25 },
{ ' ', 7 ,42 },
{ ' ', 8 ,10 },
{ ' ', 8 ,44 },
{ ' ', 6 ,50 },
{ ' ', 8 ,49 },
{ ' ', 11 ,25 },
{ ' ', 7 ,69 },
{ ' ', 8 ,4 },
{ ' ', 7 ,75 },
{ ' ', 8 ,7 },
{ '*', 11 ,26 },
{ ' ', 8 ,30 },
{ ' ', 11 ,50 },
{ ' ', 8 ,56 },
{ '@', 8 ,59 },
{ '@', 0 ,65 },
{ ' ', 8 ,61 },
{ ' ', 0 ,67 },
{ ' ', 1 ,9 },
{ ' ', 11 ,55 },
{ ' ', 8 ,11 },
{ '@', 11 ,61 },
{ '*', 8 ,23 },
{ '@', 11 ,73 },
{ ' ', 13 ,24 },
{ '*', 8 ,18 },
{ '*', 13 ,25 },
{ ' ', 1 ,10 },
{ '*', 14 ,12 },
{ '*', 8 ,12 },
{ ' ', 14 ,69 },
{ '@', 15 ,62 },
{ ' ', 4 ,25 },
{ '@', 15 ,68 },
{ ' ', 4 ,50 },
{ '*', 1 ,11 },
{ '@', 8 ,66 },
{ ' ', 1 ,47 },
{ ' ', 8 ,67 },
{ ' ', 9 ,45 },
{ ' ', 11 ,24 },
{ ' ', 9 ,50 },
{ ' ', 11 ,54 },
{ ' ', 13 ,33 },
{ ' ', 9 ,54 },
{ ' ', 13 ,49 },
{ '@', 9 ,58 },
{ ' ', 10 ,17 },
{ ' ', 14 ,18 },
{ '@', 4 ,53 },
{ '*', 14 ,19 },
{ ' ', 4 ,54 },
{ ' ', 5 ,22 },
{ '', 14 ,59 },
{ ' ', 5 ,23 },
{ ' ', 14 ,61 },
{ ' ', 10 ,74 },
{ ' ', 11 ,5 },
{ '*', 11 ,22 },
{ ' ', 13 ,60 },
{ ' ', 9 ,62 },
{ ' ', 9 ,68 },
{ ' ', 10 ,10 },
{ '@', 13 ,71 },
{ '@', 9 ,67 },
{ ' ', 14 ,10 },
/* end of sname 5-6 */
{ '@', 0 ,63 },
{ ' ', 0 ,65 },
{ ' ', 1 ,11 },
{ '#', 5 ,31 },
{ '*', 1 ,12 },
{ ' ', 2 ,49 },
{ ' ', 5 ,33 },
{ '@', 2 ,63 },
{ ' ', 2 ,65 },
{ ' ', 4 ,5 },
{ ' ', 2 ,54 },
{ ' ', 4 ,9 },
{ ' ', 7 ,47 },
{ ' ', 5 ,26 },
{ '#', 7 ,40 },
{ '*', 5 ,27 },
{ '@', 7 ,51 },
{ ' ', 5 ,29 },
{ ' ', 7 ,53 },
{ '#', 5 ,49 },
{ ' ', 15 ,68 },
{ '@', 7 ,60 },
{ '@', 5 ,58 },
{ '@', 7 ,65 },
{ '*', 4 ,21 },
{ ' ', 4 ,48 },
{ '*', 5 ,16 },
{ '@', 4 ,52 },
{ '#', 5 ,35 },
{ '@', 15 ,67 },
{ ' ', 5 ,69 },
{ ' ', 6 ,19 },
{ ' ', 6 ,23 },
{ ' ', 4 ,53 },
{ ' ', 4 ,60 },
{ '*', 5 ,6 },
{ '@', 4 ,67 },
{ '*', 5 ,10 },
{ ' ', 5 ,14 },
{ ' ', 6 ,41 },
{ '@', 1 ,69 },
{ ' ', 3 ,19 },
{ ' ', 6 ,32 },
{ ' ', 3 ,26 },
{ ' ', 1 ,71 },
{ '*', 3 ,27 },
{ ' ', 2 ,14 },
{ '*', 2 ,16 },
{ '@', 6 ,70 },
{ ' ', 7 ,4 },
{ ' ', 3 ,7 },
{ '*', 3 ,8 },
{ '*', 7 ,5 },
{ ' ', 3 ,31 },
{ '*', 7 ,14 },
{ ' ', 8 ,12 },
{ ' ', 7 ,12 },
{ '*', 8 ,13 },
{ '#', 15 ,44 },
{ '#', 3 ,33 },
{ ' ', 15 ,62 },
{ '*', 9 ,13 },
{ '*', 15 ,14 },
{ '#', 9 ,47 },
{ '*', 15 ,21 },
{ '@', 9 ,56 },
{ ' ', 9 ,58 },
{ '#', 3 ,47 },
{ ' ', 9 ,44 },
{ ' ', 3 ,73 },
{ '#', 16 ,35 },
{ '#', 2 ,44 },
{ ' ', 6 ,61 },
{ ' ', 2 ,46 },
{ ' ', 6 ,66 },
{ '#', 16 ,51 },
{ ' ', 8 ,23 },
{ ' ', 0 ,33 },
{ ' ', 8 ,26 },
{ '#', 0 ,35 },
{ ' ', 14 ,59 },
{ '#', 0 ,40 },
{ '#', 15 ,29 },
{ ' ', 0 ,41 },
{ ' ', 14 ,35 },
{ ' ', 14 ,37 },
{ '*', 8 ,28 },
{ ' ', 0 ,49 },
{ ' ', 14 ,30 },
{ '#', 8 ,46 },
{ '#', 0 ,51 },
{ ' ', 8 ,47 },
{ '*', 10 ,23 },
{ ' ', 11 ,22 },
{ ' ', 10 ,31 },
{ ' ', 11 ,26 },
{ '@', 0 ,58 },
{ ' ', 9 ,11 },
{ ' ', 0 ,60 },
{ '@', 3 ,53 },
{ '@', 11 ,52 },
{ '*', 7 ,20 },
{ '*', 7 ,24 },
{ ' ', 8 ,8 },
{ '#', 7 ,33 },
{ '*', 8 ,10 },
{ '@', 11 ,59 },
{ ' ', 11 ,61 },
{ ' ', 12 ,6 },
{ '@', 11 ,66 },
{ '*', 12 ,21 },
{ ' ', 3 ,67 },
{ ' ', 14 ,51 },
{ '@', 3 ,71 },
{ '@', 14 ,57 },
{ '#', 15 ,39 },
{ '@', 9 ,65 },
{ ' ', 9 ,67 },
{ '*', 10 ,5 },
{ '*', 11 ,28 },
{ ' ', 12 ,54 },
{ '#', 11 ,33 },
{ ' ', 13 ,25 },
{ ' ', 14 ,19 },
{ '@', 8 ,65 },
{ '#', 10 ,43 },
{ '*', 13 ,26 },
{ ' ', 10 ,53 },
{ '@', 13 ,53 },
{ '*', 14 ,10 },
{ ' ', 10 ,68 },
{ ' ', 14 ,12 },
{ '@', 10 ,69 },
{ '*', 11 ,13 },
{ ' ', 8 ,66 },
{ ' ', 11 ,14 },
{ ' ', 8 ,69 },
{ ' ', 9 ,4 },
{ '@', 16 ,62 },
{ ' ', 14 ,42 },
/* end of sname 6-7 */
{ ' ', 2 ,16 },
{ '*', 5 ,7 },
{ '*', 15 ,16 },
{ '#', 3 ,34 },
{ ' ', 5 ,10 },
{ ' ', 11 ,33 },
{ '*', 5 ,29 },
{ ' ', 11 ,41 },
{ ' ', 5 ,31 },
{ ' ', 10 ,69 },
{ '#', 5 ,33 },
{ '*', 11 ,6 },
{ '*', 5 ,22 },
{ '*', 11 ,23 },
{ ' ', 5 ,27 },
{ ' ', 11 ,28 },
{ '@', 5 ,57 },
{ '*', 11 ,29 },
{ ' ', 5 ,58 },
{ '*', 13 ,27 },
{ ' ', 14 ,10 },
{ '#', 2 ,42 },
{ ' ', 5 ,49 },
{ '#', 10 ,46 },
{ '@', 5 ,51 },
{ ' ', 2 ,44 },
{ '*', 5 ,11 },
{ ' ', 5 ,16 },
{ ' ', 2 ,63 },
{ ' ', 3 ,8 },
{ '*', 3 ,9 },
{ ' ', 15 ,21 },
{ '*', 3 ,17 },
{ '*', 15 ,23 },
{ ' ', 3 ,33 },
{ '*', 14 ,12 },
{ ' ', 5 ,35 },
{ ' ', 14 ,57 },
{ '#', 3 ,45 },
{ ' ', 15 ,14 },
{ ' ', 3 ,47 },
{ '@', 3 ,62 },
{ ' ', 4 ,21 },
{ ' ', 10 ,23 },
{ ' ', 4 ,52 },
{ '#', 10 ,33 },
{ ' ', 4 ,67 },
{ ' ', 5 ,6 },
{ ' ', 15 ,29 },
{ ' ', 5 ,65 },
{ '@', 5 ,67 },
{ '*', 6 ,17 },
{ '@', 6 ,63 },
{ ' ', 7 ,5 },
{ ' ', 6 ,70 },
{ ' ', 7 ,40 },
{ '*', 8 ,25 },
{ '#', 10 ,41 },
{ '#', 8 ,35 },
{ ' ', 10 ,43 },
{ ' ', 0 ,58 },
{ ' ', 11 ,48 },
{ '#', 5 ,37 },
{ '#', 5 ,47 },
{ '@', 11 ,51 },
{ '@', 0 ,62 },
{ ' ', 1 ,12 },
{ ' ', 0 ,63 },
{ '*', 1 ,13 },
{ ' ', 12 ,21 },
{ ' ', 7 ,65 },
{ '@', 7 ,70 },
{ '*', 8 ,14 },
{ '#', 12 ,47 },
{ ' ', 13 ,7 },
{ '@', 12 ,64 },
{ '*', 8 ,6 },
{ '*', 13 ,9 },
{ ' ', 8 ,13 },
{ '@', 1 ,57 },
{ ' ', 13 ,26 },
{ ' ', 15 ,39 },
{ ' ', 7 ,24 },
{ ' ', 7 ,33 },
{ ' ', 15 ,44 },
{ '#', 12 ,34 },
{ ' ', 8 ,32 },
{ '#', 12 ,41 },
{ '@', 7 ,64 },
{ '@', 15 ,57 },
{ ' ', 7 ,51 },
{ '#', 16 ,29 },
{ '@', 1 ,68 },
{ '#', 16 ,40 },
{ ' ', 1 ,69 },
{ '#', 8 ,40 },
{ ' ', 7 ,14 },
{ ' ', 8 ,46 },
{ ' ', 9 ,47 },
{ '@', 11 ,58 },
{ ' ', 8 ,28 },
{ '*', 8 ,30 },
{ ' ', 11 ,59 },
{ ' ', 9 ,56 },
{ ' ', 9 ,65 },
{ ' ', 10 ,5 },
{ ' ', 11 ,52 },
{ '@', 8 ,50 },
{ '@', 8 ,55 },
{ ' ', 9 ,13 },
{ '*', 9 ,14 },
{ ' ', 11 ,66 },
{ '*', 7 ,15 },
{ '@', 9 ,64 },
{ '#', 8 ,45 },
{ '@', 11 ,68 },
{ '*', 12 ,19 },
{ '#', 16 ,45 },
/* end of sname 7-8 */
{ ' ', 2 ,42 },
{ '*', 5 ,13 },
{ '@', 1 ,67 },
{ ' ', 1 ,68 },
{ '#', 5 ,40 },
{ '#', 5 ,45 },
{ ' ', 12 ,47 },
{ '#', 11 ,35 },
{ '#', 11 ,40 },
{ ' ', 12 ,64 },
{ '*', 13 ,18 },
{ ' ', 5 ,47 },
{ ' ', 6 ,63 },
{ ' ', 7 ,15 },
{ ' ', 5 ,22 },
{ ' ', 5 ,33 },
{ '*', 7 ,16 },
{ ' ', 7 ,70 },
{ ' ', 8 ,14 },
{ ' ', 12 ,34 },
{ '*', 5 ,23 },
{ ' ', 12 ,41 },
{ '*', 8 ,15 },
{ '@', 6 ,62 },
{ ' ', 8 ,25 },
{ '*', 3 ,18 },
{ ' ', 8 ,55 },
{ '@', 8 ,70 },
{ ' ', 9 ,14 },
{ '*', 9 ,16 },
{ ' ', 10 ,33 },
{ ' ', 10 ,41 },
{ ' ', 11 ,6 },
{ ' ', 10 ,46 },
{ '*', 11 ,7 },
{ '#', 13 ,40 },
{ ' ', 6 ,17 },
{ '#', 13 ,45 },
{ '*', 6 ,18 },
{ '@', 13 ,62 },
{ ' ', 14 ,12 },
{ '*', 15 ,13 },
{ '#', 11 ,45 },
{ ' ', 15 ,16 },
{ '@', 11 ,57 },
{ ' ', 3 ,17 },
{ ' ', 11 ,58 },
{ '#', 3 ,40 },
{ ' ', 5 ,11 },
{ '@', 11 ,67 },
{ ' ', 3 ,34 },
{ '*', 8 ,26 },
{ '#', 3 ,35 },
{ '@', 8 ,54 },
{ ' ', 11 ,68 },
{ '#', 5 ,35 },
{ ' ', 12 ,19 },
{ ' ', 5 ,37 },
{ '#', 13 ,35 },
{ '*', 16 ,18 },
{ ' ', 23 , 0 },
{ '\0',0,0}
};
prologue() {
struct todif *tomoves = moves;
while ( (tomoves->ch != '\0' )) {
term0 () ;
pos(tomoves->r,tomoves->c) ;
xputchar(tomoves->ch) ;
fflush (tty) ;
term1 () ;
pos(tomoves->r,tomoves->c) ;
xputchar(tomoves->ch) ;
fflush (tty) ;
tomoves++ ;
}
}
SHAR_EOF
if test 24401 -ne "`wc -c init_all.c`"
then
echo shar: error transmitting init_all.c '(should have been 24401 characters)'
fi
echo shar: extracting kill_alm.c '(1629 characters)'
cat << \SHAR_EOF > kill_alm.c
/*
* %W% (mrdch&amnnon) %G%
*/
# include "header"
killalm (s)
char *s;
{
planet * pp;
int i,
j,
nalms;
pp = getpl (s); /* get planet id */
skipwhite (s); /* go to the no. of alms */
nalms = atoi (s); /* see how many he wants to kill */
if (nalms <= 0) {
say ("But sir, this will not change much !!");
return;
}
skipword (s); /* jump over that no. */
assert_end (s); /* see if it ending nicely */
if (pp -> whos == player) {
j = nalms * REMOVE_COST;
assert_money (j); /* see if he has that much */
j = (nalms > pp -> alms) ? pp -> alms : nalms;
teller[player] -= j * REMOVE_COST;/* take min. */
pp -> alms -= j;
if (pp -> alms < 0)
pp -> alms = 0;
if (pp -> alms) {
say ("The planet is not yet clean, sir!!");
return;
}
else {
say ("It is perfectly safe now, sir.");
return;
}
}
else { /* remove from the enemy teritory */
for (i = 0; i < 10; i++)
if (pp -> gate[i] -> whos == player)
break;
if (i == 10) {
say ("But sir, we don't have access to that planet!!");
return;
}
i = nalms * ALM_KILL_COST;
assert_money (i); /* see if he has that much */
teller[player] -= i; /* take money IN ANY CASE !! */
pp -> alms -= nalms;
if (pp -> alms < 0)
pp -> alms = 0;
}
}
SHAR_EOF
if test 1629 -ne "`wc -c kill_alm.c`"
then
echo shar: error transmitting kill_alm.c '(should have been 1629 characters)'
fi
echo shar: extracting leave_at.c '(1881 characters)'
cat << \SHAR_EOF > leave_at.c
/*
* %W% (mrdch&amnnon) %G%
*/
# include "header"
leaveat (s)
char *s;
{
planet * pp;
int i = 0,
spl;
char cc;
pp = getpl (s); /* get planet id. */
assert_player (pp); /* see if legal + owner */
skipwhite (s);
/* in case of knowledge, no parameter needed */
if (*s == 'k' || (*s == 'K')) {
if (pp -> inventar.know > pp -> to_take.know) {
say ("But sir !!! Why destroy the hard acquired knowledge??");
return ;
}
pp -> inventar.know = pp -> to_take.know;
if (*s == 'K') /* clear moving knowledge */
pp -> to_take.know = 0;
say ("%c-type knowledge was left, sir !!!", 'A' + pp -> inventar.know);
return;
}
i = atoi (s); /* in any other case- numeric parameter
needed */
assert_number (i); /* chek if legal no. */
skipword (s);
cc = *s++; /* take item he wants to leave on planet
*/
assert_end (s); /* does he end gracefully?? */
if (cc == 't') {
if (pp -> to_take.metals < i) {
say ("But you don't have that much metal there !!");
return;
}
/* perform metal transfer */
pp -> to_take.metals -= i;
pp -> inventar.metals += i;
say ("%d A-type material was transferred, sir !!", i);
return;
}
spl = which_class (cc);
assert_occup (spl); /* does it exist?? */
if (pp -> to_take.popul[spl] < i) {
say ("But sir, you don't have that many %s there!!!", ocup_name[spl]);
return;
}
/* perform human transfer */
pp -> to_take.popul[spl] -= i;
pp -> inventar.popul[spl] += i;
say ("%d %s were left on planet, sir.", i, ocup_name[spl]);
return;
}
SHAR_EOF
if test 1881 -ne "`wc -c leave_at.c`"
then
echo shar: error transmitting leave_at.c '(should have been 1881 characters)'
fi
# End of shell archive
exit 0MRDCH@TAURUS.BITNET (06/09/85)
From: Mordechai Chachamu <mrdch@taurus.BitNet>
Hello everybody!!!
This is part #7 out of 10. It contains some more of the source files
for the game proper. They should be placed in ~galaxy/src.
mrdch
# This is a shell archive.
# Remove everything above and including the cut line.
# Then run the rest of the file through sh.
-----cut here-----cut here-----cut here-----cut here-----
#!/bin/sh
# shar: Shell Archiver
# Run the following text with /bin/sh to create:
# move_to.c
# no_detect.c
# options.h
# over_stat.c
# parse.c
# This archive created: Sat Jun 8 13:01:36 1985
echo shar: extracting move_to.c '(21037 characters)'
cat << \SHAR_EOF > move_to.c
/*
* %W% (mrdch&amnnon) %G%
*/
# include "header"
# define ENEMY_FIGT sp->inventar.popul[FIGT]
int my_ships[MAXSHIPS]; /* # ships moved to attack */
movable taken; /* here we put all that we have taken */
int fighters; /* no. of attacking fighters */
planet * fp, *sp; /* the First and Second planets pointers */
int past_plan; /* how many planets did we pass */
int attack_fail[] = {
0, 0, 2, 8, 16, 25, 33, 37, 42, 44, 45, 46, 47, 48
};
int this_paint;
moveto (s)
char *s;
{
planet * tmp;
char s1[100];
int i,
j,
n,
ngate;
double dtct,
nodtct,
ftemp,
addfact;
char *spotted_ships (); /* procedure to transform vars of the * type
int[MAXSHIPS] to string */
for (j = 0; j < MAXSHIPS; j++)/* clean temp storage */
my_ships[j] = 0;
for (j = 0; j < CLASES; j++)
taken.popul[j] = 0;
taken.metals = 0;
fp = getpl (s); /* see where from */
assert_player (fp); /* is the first planet his own */
skipwhite (s); /* go to the second planet */
if (*s != '-') { /* the '-' needed to signify destination */
say ("Destination not clear, sir !!");
return;
}
else
*s = ' '; /* the function must have a ' ' at the start */
sp = getpl (s); /* identify the second planet */
if (fp == sp) {
say ("That will not change much, sir !!");
return;
}
skipwhite (s);
j = -1;
if (*s == '>') { /* a SPECIFIC direction was given */
s++;
skipwhite (s);
/* check if the direction is one allowed */
if ((j = find_direct (*s++)) < 0) {
say ("The direction specified is unclear, sir!!!");
return;
}
/* check if this direction brings us to the destination */
tmp = fp;
for (i = 0; i < 17; i++)/* can't be more than that */
if ((tmp = tmp -> gate[j]) == sp || tmp == NULL)
break;
if (tmp != sp) {
say ("In this direction we can never reach there, sir!!!");
return;
}
}
/*
* Search for the destination planet along the specified
* route. You either fall at the galaxy end, meet yourself
* again in the circle, or FIND it.
*/
if (j == -1) { /* no direction was specified */
ngate = 0;
for (i = 0; i < 10; i++) {
tmp = fp;
while ((tmp = tmp -> gate[i]))
if (tmp == sp) {
ngate++;
j = i;
break; /* see remark below */
}
else
if (tmp == fp)
break;
}
if (!ngate) {
say ("I don't see any direct route to %s, sir.", sp -> pid);
return;
}
/* If forcing the players to specify a route is desired. if (ngate > 1) {
say ("There is more then one way to get to %s, sir.", sp -> pid);
return; } */
}
ngate = j;
/* start collecting the aramade that was ordered to fly */
for (;;) {
skipwhite (s);
i = atoi (s); /* take the no. of ships */
assert_negative (i); /* see if not negative */
if (i) { /* if any was specified */
skipnum (s); /* go over it */
skipwhite (s); /* and get the type */
}
else
i = 1; /* if none given, assume 1 */
if (*s < 'a')
*s += ('a' - 'A'); /* transform them to lower */
if ((*s < 'a') || (*s > 'a' + MAXSHIPS - 1)) {
say ("The type of ship is not clear, sir!!");
return;
}
j = *s - 'a';
my_ships[j] += i;
s++;
skipwhite (s);
if (!*s) /* check if EOL reached */
break;
}
for (j = 0; j < MAXSHIPS; j++)
if (my_ships[j] > fp -> ships[j]) {
say ("But you don't have that many %c-type ships there, sir!!", j + 'A');
return;
}
n = 0; /* calculate no of fighters to fly them */
for (j = 0, i = 1; j < MAXSHIPS; j++, i *= 2)
n += NCREW / i * my_ships[j];
if (n > fp -> inventar.popul[FIGT]) {/* not enough */
say ("But sir, there are not enough fighters to fly these ships !!");
return;
}
/*
* At this point it is clear that movement is possible.
* Before doing anything else- put in a "movable"
* structure everything ordered to be moved. Update the
* source planet NOW, and the destination planet
* only after it's nature is known.
* Then check if the movement was discovered. If so-
* notify the enemy.
* If going to a friendly planet just do the house keeping.
* Else - it's WAR .
*/
/* update no. of fighters on the source planet */
fighters = n;
fp -> inventar.popul[FIGT] -= n;
/* update no. of ships */
for (j = 0; j < MAXSHIPS; j++)
fp -> ships[j] -= my_ships[j];
/* deal with the knowledge */
taken.know = fp -> to_take.know;
fp -> to_take.know = 0;
/* how much can he carry? */
n = 0;
for (j = 0; j < MAXSHIPS; j++)
n += (j + 1) * my_ships[j];
if (n >= fp -> to_take.metals) {/* enough room */
taken.metals += fp -> to_take.metals;
fp -> to_take.metals = 0;
}
else {
taken.metals += fp -> to_take.metals - n;
fp -> to_take.metals -= n;
}
/* see how many people wait */
i = 0;
for (j = 0; j < CLASES; j++)
i += fp -> to_take.popul[j];
/* and how many places */
n = 0;
for (j = 0; j < MAXSHIPS; j++)
n += VISITORS * (j + 1) * my_ships[j];
if (n >= i) /* if enough room */
for (j = 0; j < CLASES; j++) {
taken.popul[j] = fp -> to_take.popul[j];
fp -> to_take.popul[j] = 0;
}
/* NOT enough room. transfer by importance */
else
for (j = 0; n > 0; j++) {
if ((n - fp -> to_take.popul[j]) >= 0) {
n -= fp -> to_take.popul[j];
taken.popul[j] = fp -> to_take.popul[j];
fp -> to_take.popul[j] = 0;
}
else {
taken.popul[j] = n;
fp -> to_take.popul[j] -= n;
n = 0;
}
}
/* here check if the movement was discovered */
this_paint = fp -> paint; /* keep the paint. */
fp -> paint = 0; /* NONE was left at home */
/*
* Calculate effective painting.
* The rule when calculating the paint:
* More ships - easier to detect ;
* Better ships - harder to detect.
* The calculation is confined to the type of ship. i.e.
* each ship type has it's own no. indicating how
* difficult it is to detect it.
* As the ships start their voyage, the paint fades at
* the FADE_RATE per each planet past-by.
* A new factor is then calculated.
*/
addfact = 0;
for (i = 0, ftemp = 1; i < MAXSHIPS; i++, ftemp /= 2)
addfact += ftemp * my_ships[i];
nodtct = this_paint / addfact;
tmp = fp;
past_plan = 0;
do {
past_plan++; /* count the no. of planets we passed */
tmp = tmp -> gate[ngate];/* continue along the line */
this_paint = (double) this_paint * (100.- FADE_RATE) / 100.;
addfact = 0;
for (i = 0, ftemp = 1; i < MAXSHIPS; i++, ftemp /= 2)
addfact += ftemp * my_ships[i];
nodtct = this_paint / addfact;
if (tmp -> whos != fp -> whos) {
dtct = tmp -> detect;
if (dtct > nodtct) {
if (!any_force (tmp -> missile))
(void) sprintf (s1, "Sir!!! At %s we spotted %s enemy ships.", tmp -> pid, spotted_ships (my_ships));
else {
(void) sprintf (s1, "Sir!!! At %s our %s missiles encountered ", tmp -> pid, spotted_ships (tmp -> missile));
(void) sprintf (s1, "%s%s enemy ships.", s1, spotted_ships (my_ships));
}
dowrite_enemy (s1, !player);
missile_war (tmp);
if (!any_force (my_ships)) {
(void) sprintf (s1, "Sir!!! Our missiles defeated the enemy at %s!!!", tmp -> pid);
dowrite_enemy (s1, !player);
assert_loosing ();
}
}
}
} while (tmp != sp);
if (sp -> alms) /* are there any alms ? */
assert_loosing ();
/* ********************************************* */
if ((fp -> whos == sp -> whos) || (sp -> whos == 2)) {
/* forces remain in his domain or neutral captured */
/* first move the ships */
for (j = 0; j < MAXSHIPS; j++)
sp -> ships[j] += my_ships[j];
/* then the fighters */
sp -> inventar.popul[FIGT] += fighters;
/* is there knowledge to take? */
if (sp -> to_take.know < taken.know)
sp -> to_take.know = taken.know;
/* take the materials */
sp -> to_take.metals += taken.metals;
/* take the people */
for (j = 0; j < CLASES; j++)
sp -> to_take.popul[j] += taken.popul[j];
sp -> paint += this_paint;
if (sp -> whos != fp -> whos) {
say ("Congratulations, sir. We have captured that planet.");
sp -> whos = fp -> whos;
prepare_siege ();
chek_siege (sp);
return;
}
}
else {
if (ENEMY_FIGT) /* any FIGHTERS there? */
war ();
if (!any_force (my_ships)) {
(void) sprintf (s1, "Sir!!! Our forces have encountered and defeated the enemy at %s!!!", sp -> pid);
dowrite_enemy (s1, !player);
assert_loosing ();
}
capture (1, sp);
sp -> paint += this_paint;
prepare_siege ();
chek_siege (sp);
say ("Congratulations, sir!!. We have captured that planet.");
}
check_end ();
}
/* ********************************************* */
/*
* This is the WAR section.
* The results are determined by the no. and level of the
* ships involved in the battle, and also the distance
* that the attacking ships have traveled to their destination.
* The longer they traveled, the better are the chances for
* the defending forces to defeat their enemy with little
* or no lost to themselves.
*/
war () {
int i,
j,
k,
n;
int his_ships[MAXSHIPS];
int perc_fail = attack_fail[past_plan],
temp_fail;
char s1[100];
for (i = 0; i < MAXSHIPS; i++)
his_ships[i] = 0; /* clean temporary storage */
for (j = MAXSHIPS - 1, i = NCREW; j >= 0; j--, i /= 2)
while (sp -> ships[j] && ENEMY_FIGT >= NCREW / i) {
his_ships[j]++;
sp -> ships[j]--;
ENEMY_FIGT -= NCREW / i;
}
if (!any_force (his_ships))
return; /* he might not have enough soldiers */
for (j = 0; j < MAXSHIPS; j++)
while (my_ships[j] && his_ships[j]) {/* any ships */
my_ships[j]--; /* I ALWAYS loose one */
i = 100 - (rand () % 100);
if (i > perc_fail) /* if more then criterion */
his_ships[j]--; /* He looses too */
}
if (!any_force (his_ships))
return;
for (j = 1, k = 2; j < MAXSHIPS; j++, k *= 2) {
if (my_ships[j] > 0) {
i = 0;
n = k;
while (i < j) {
while (his_ships[i] >= n && my_ships[j]) {
my_ships[j]--;/* I loose */
temp_fail = 100 - (rand () % 100);
if (temp_fail > perc_fail)
his_ships[i] -= n;/* He too */
}
if (my_ships[j])
his_ships[i] = 0;
i++;
n /= 2;
}
}
else
if (his_ships[j] > 0) {
i = 0;
n = k;
while (i < j) {
while (my_ships[i] >= n && his_ships[j]) {
my_ships[i] -= n;
temp_fail = 100 - (rand () % 100);
if (temp_fail > perc_fail)
his_ships[j]--;
}
if (his_ships[j])
my_ships[i] = 0;
i++;
n /= 2;
}
}
}
if (!any_force (his_ships))
return;
/* none left from My forces. we're doomed */
n = 0; /* calculate no of fighters left to him */
for (j = 0, i = 1; j < MAXSHIPS; j++, i *= 2) {
sp -> ships[j] += his_ships[j];
n += NCREW / i * his_ships[j];
}
ENEMY_FIGT += n;
(void) sprintf (s1, "Sir!!! Our forces have encountered and defeated the enemy at %s!!!", sp -> pid);
dowrite_enemy (s1, !player);
assert_loosing ();
}
missile_war (pp)
planet * pp;
{
int i,
j,
k,
n;
char s1[100];
int destroyed[MAXSHIPS];/* # of ships destroyed */
if (!any_force (pp -> missile))
return; /* the defender has no missiles there */
for (j = 0; j < MAXSHIPS; j++)
destroyed[j] = 0; /* all ships are intact (so far...) */
for (j = 0; j < MAXSHIPS; j++)
while (my_ships[j] && pp -> missile[j]) {/* any ships */
my_ships[j]--; /* I ALWAYS loose one */
destroyed[j]++; /* remember what I lost */
pp -> missile[j]--; /* He looses too */
}
if (!any_force (pp -> missile)) {
/* The battle has been fought, tell the owner of the missiles */
(void) sprintf (s1, "Sir!!! Our missiles destroyed the enemy ships: %s.", spotted_ships (destroyed));
dowrite_enemy (s1, !player);
return;
}
for (j = 1, k = 2; j < MAXSHIPS; j++, k *= 2) {
if (my_ships[j] > 0) {
i = 0;
n = k;
while (i < j) {
while (pp -> missile[i] >= n && my_ships[j]) {
my_ships[j]--;
destroyed[j]++;
pp -> missile[i] -= n;
}
if (my_ships[j])
pp -> missile[i] = 0;
i++;
n /= 2;
}
}
else
if (pp -> missile[j] > 0) {
i = 0;
n = k;
while (i < j) {
while (my_ships[i] >= n && pp -> missile[j]) {
my_ships[i] -= n;
destroyed[j] += n;
pp -> missile[j]--;
}
if (pp -> missile[j]) {
destroyed[i] = my_ships[i];
my_ships[i] = 0;
}
i++;
n /= 2;
}
}
}
/* The battle has been fought, tell the owner of the missiles */
(void) sprintf (s1, "Sir!!! Our missiles destroyed the enemy ships: %s.", spotted_ships (destroyed));
dowrite_enemy (s1, !player);
}
/*
* Here when landing on a unarmed enemy's teritory
* or when winning a battle.
*/
capture (force, sp)
int force;
planet * sp;
{
int i,
j,
k,
m,
n,
n1,
n2;
sp -> whos = fp -> whos; /* now it is MINE */
free_reports (sp -> reports);/* the reports are not actual */
sp -> secur = 0; /* no security is valid */
if (force) {
sp -> paint = 0; /* if paint was left-destroy */
sp -> detect = 0; /* if detection left-destroy */
for (j = 0; j < MAXSHIPS; j++)
sp -> missile[j] = 0;
}
for (j = 0; j < ESPSIZ; j++)
for (m = 0; m < ESPTYP; m++)
for (k = 0; k < 2; k++)
sp -> espion[k][m][j] = 0;/* and no espionage yet */
/* first move the forces */
for (j = 0; j < MAXSHIPS; j++)
sp -> ships[j] = my_ships[j];
/* how much metal can he carry? */
n = 0;
for (j = 0; j < MAXSHIPS; j++)
n += (j + 1) * my_ships[j];
if (n >= taken.metals) /* enough room */
sp -> to_take.metals += taken.metals;
else
sp -> to_take.metals += n;
/* when dealing with knowledge, it is ALWAYS transfered */
if (force) {
sp -> to_take.know = taken.know;
sp -> inventar.know = taken.know;
}
/* now deal with the people */
n2 = sp -> to_take.popul[SLAV];/* keep them. they were yours */
sp -> to_take.popul[SLAV] = 0;
/* add all the to_be_transfered people */
for (j = 0, n1 = 0; j < CLASES; j++) {
n1 += sp -> to_take.popul[j];
sp -> to_take.popul[j] = 0;
}
sp -> to_take.popul[CITI] = n2;
sp -> to_take.popul[SLAV] = n1;/* put them correctly now */
/* see how many people wait */
i = 0;
for (j = 0; j < CLASES; j++)
i += taken.popul[j];
/* and how many places */
n = 0;
for (j = 0; j < MAXSHIPS; j++)
n += VISITORS * (j + 1) * my_ships[j];
if (n >= i) /* if enough room */
for (j = 0; j < CLASES; j++) {
sp -> to_take.popul[j] += taken.popul[j];
}
/* NOT enough room. transfer by importance */
else
for (j = 0; n > 0; j++) {
if ((n - taken.popul[j]) >= 0) {
n -= taken.popul[j];
sp -> to_take.popul[j] += taken.popul[j];
}
else {
sp -> to_take.popul[j] += n;
n = 0;
}
}
/* now deal with the people that are stationed on the planet */
n2 = sp -> inventar.popul[SLAV];/* keep them. they were yours */
sp -> inventar.popul[SLAV] = 0;
/* add all the to_be_transfered people */
for (j = 0, n1 = 0; j < CLASES; j++) {
n1 += sp -> inventar.popul[j];
sp -> inventar.popul[j] = 0;
}
sp -> to_take.popul[CITI] += n2;
sp -> inventar.popul[SLAV] = n1;/* put them correectly now */
n = 0; /* calculate no of fighters left to me */
for (j = 0, i = 1; j < MAXSHIPS; j++, i *= 2)
n += NCREW / i * my_ships[j];
ENEMY_FIGT = n;
}
/* this recursive functions frees all the information that
* was gathered about a captured planet. Naturly, it is not valid
* anymore. */
free_reports (prvinfo)
info * prvinfo;
{
if (prvinfo == 0)
return; /* end of list. */
free_reports (prvinfo -> next);
ifree (prvinfo);
}
/* check to see if any forces left */
any_force (ship)
int *ship;
{
int n,
j;
n = 0;
for (j = 0; j < MAXSHIPS; j++)
if (*ship++)
n++;
return (n);
}
/* this function prepares for the siege checking */
prepare_siege () {
int i;
fighters = 0;
taken.know = 0;
taken.metals = 0;
for (i = 0; i < CLASES; i++)
taken.popul[i] = 0;
for (i = 0; i < MAXSHIPS; i++)
my_ships[i] = 0;
}
/*
* This function checks to see if by capturing a planet
* a siege was completed around one of the enemy's planets.
* Each surrounding planet is scanned, and if it belongs to
* the enenmy, it's surroundings is scanned. If all the
* planets belong to the PLAYER, it is considered captured.
* In contrast to direct taking by force, all except the ships
* remain intact.
*/
chek_siege (pp)
planet * pp;
{
char s[100];
int i,
j,
np;
planet * tmp1, *tmp2;
for (i = 0; i < 10; i++)
if ((tmp1 = pp -> gate[i]) && (tmp1 -> whos == !player)) {
for (j = 0, np = 0; j < 10; j++)
if ((tmp2 = tmp1 -> gate[j]) && (tmp2 -> whos != player))
np++;
if (!np) { /* he is totaly surrounded */
capture (0, tmp1);
(void) sprintf (s, "Sir!!! we have taken %s planet too!!!", tmp1 -> pid);
dowrite_enemy (s, player);
}
}
}
/* This procedure transforms an integer array with ship counts in */
/* a string listing the amounts of the different ships */
/* The array [3,2,0,1,0,0,...,0] would be transformed to the */
/* string " 3A 2B 1D" . */
char *spotted_ships (ship)
int *ship;
{
static char s[100]; /* The list of ships; e.g. " 3A 2B 1D" */
int j;
s[0] = '\0';
for (j = 0; j < MAXSHIPS; j++) {
if (*ship)
(void) sprintf (s, "%s %d%c", s, *ship, 'A' + j);
ship++;
}
return (s);
}
SHAR_EOF
if test 21037 -ne "`wc -c move_to.c`"
then
echo shar: error transmitting move_to.c '(should have been 21037 characters)'
fi
echo shar: extracting no_detect.c '(726 characters)'
cat << \SHAR_EOF > no_detect.c
/*
* %W% (mrdch&amnnon) %G%
*/
# include "header"
nodetect (s)
char *s;
{
planet * pp;
int i;
pp = getpl (s); /* get planet id */
assert_player (pp); /* see if legal planet + owner */
skipwhite (s); /* go to the money part */
i = atoi (s); /* take the amount */
assert_money (i); /* see if there is enough of it */
skipword (s); /* skip that no. */
assert_end (s); /* does it end good?? */
pp -> paint += i; /* raise the paint */
teller[player] -= i; /* take his money */
}
SHAR_EOF
if test 726 -ne "`wc -c no_detect.c`"
then
echo shar: error transmitting no_detect.c '(should have been 726 characters)'
fi
echo shar: extracting options.h '(50 characters)'
cat << \SHAR_EOF > options.h
/*
* %W% (mrdch&amnnon) %G%
*/
# define ENQDBG
SHAR_EOF
if test 50 -ne "`wc -c options.h`"
then
echo shar: error transmitting options.h '(should have been 50 characters)'
fi
echo shar: extracting over_stat.c '(10506 characters)'
cat << \SHAR_EOF > over_stat.c
/*
* %W% (mrdch&amnnon) %G%
*/
# include "header"
overstat (s)
char *s;
{
planet * pp;
int i,
j;
int all_popul[CLASES]; /* to count the entire population */
int myships[MAXSHIPS]; /* to count the ships inventory */
int mymissile[MAXSHIPS];/* to count the missile inventory */
int nplanets[PLKINDS + 1];/* to count planet's situation */
int nalms = 0; /* to count the alms */
int nmetals = 0; /* to count the metal digged */
int maxknow = -1; /* the no. of planet with max know */
char cc;
static char owner = 'O';
static char black = '?';
static char force = '!';
static char specl = '+';
static char alms = '~';
static char fight = '^';
static char build = '&';
static char dinfo = 'I';
static char spies = 'S';
static char detec = 'T';
static char paint = '%';
static char missl = 'M';
skipwhite (s);
if (*s == '\0') {
flip ();
clear ();
for (i = 0; i < CLASES; i++)
all_popul[i] = 0;
for (i = 0; i < MAXSHIPS; i++) {
myships[i] = 0;
mymissile[i] = 0;
}
for (i = 0; i <= PLKINDS; i++)
nplanets[i] = 0;
for (i = 0, pp = &pl[0]; i < MAXPL; i++, pp = &pl[i])
if (pp -> whos == player) {
nplanets[PLKINDS]++;
nalms += pp -> alms;/* add total alms */
nmetals += pp -> inventar.metals;/* add total metals */
if (maxknow == -1)
maxknow = i;
if (pl[maxknow].inventar.know < pl[i].inventar.know)
maxknow = i;/* update max knowledge */
if (pp -> inventar.popul[FIGT])
nplanets[FIGT]++;
if (pp -> inventar.popul[CITI])
nplanets[CITI]++;
if (pp -> inventar.popul[MINE])
nplanets[MINE]++;
if (pp -> inventar.popul[BUIL])
nplanets[BUIL]++;
if (pp -> inventar.popul[SCIE])
nplanets[SCIE]++;
for (j = 0; j < CLASES; j++) {
all_popul[j] += pp -> inventar.popul[j];
all_popul[j] += pp -> to_take.popul[j];
}
for (j = 0; j < MAXSHIPS; j++) {
myships[j] += pp -> ships[j];
mymissile[j] += pp -> missile[j];
}
}
pos (0, 28);
print ("Overall situation report");
pos (1, 28);
print ("========================\r\n");
print ("Population: %d\r\n", count_popul (player));
for (j = 0; j < CLASES; j++)
if (all_popul[j])
print ("%6d %s\r\n", all_popul[j], ocup_name[j]);
pos (11, 0);
print ("Planets situation:\r\n");
print ("%6d controlled planets\r\n", nplanets[PLKINDS]);
print ("%6d Military bases.\r\n", nplanets[FIGT]);
print ("%6d Agricultural planets.\r\n", nplanets[CITI]);
print ("%6d Mining planets.\r\n", nplanets[MINE]);
print ("%6d Industrial planets. \r\n", nplanets[BUIL]);
print ("%6d Scientific planets.\r\n", nplanets[SCIE]);
j = 3;
pos (j++, 38);
print ("No. of ships and missiles:");
for (i = 0; i < MAXSHIPS; i++)
if (myships[i] || mymissile[i]) {
pos (j++, 35);
print ("%c-type %4d ships %4d missiles.",
i + 'A', myships[i], mymissile[i]);
}
j++;
pos (j++, 35);
print ("Invested in trade %d Tellers.", trade[player]);
pos (j++, 35);
print ("Feeding the population with %d Tellers.",
food[player]);
pos (j++, 35);
print ("Total of %d ALMs were laid.", nalms);
pos (j++, 35);
print ("Total of %d A-type metal quantities.", nmetals);
pos (j++, 35);
print ("The best knowledge is %c in planet %s.",
'A' + pl[maxknow].inventar.know, pl[maxknow].pid);
more ();
return;
}
/*
* owner = 'O' ;
* black = '?' ;
* force = '!' ;
* specl = '+' ;
* alms = '~' ;
* fight = '^' ;
* build = '&' ;
* dinfo = 'I' ;
* spies = 'S' ;
* detec = 'T' ;
* paint = '%' ;
* missl = 'M' ;
*
* The chars used are: n o a s b f F c k e i d p m
* Their attributes: O ~ + ? ! ^ & A-G S I T % M
*/
while ((cc = *s++)) {
switch (cc) {
case 'n': /* clean the screen from all attributes */
clean_attr ();
break;
case 'o': /* show in reverse planets he owns */
for (i = 0; i < MAXPL; i++)
if (pl[i].whos == player)
change_attr (owner, i);
else
check_attr (owner, i);
break;
case 'p': /* show where detecting devices exist */
for (i = 0; i < MAXPL; i++)
if (pl[i].whos == player)
if (pl[i].paint)
change_attr (paint, i);
else
check_attr (paint, i);
break;
case 'd': /* show where detecting devices exist */
for (i = 0; i < MAXPL; i++)
if (pl[i].whos == player)
if (pl[i].detect)
change_attr (detec, i);
else
check_attr (detec, i);
break;
case 'a': /* show planets he owns with alm */
for (i = 0; i < MAXPL; i++)
if (pl[i].whos == player)
if (pl[i].alms)
change_attr (alms, i);
else
check_attr (alms, i);
break;
case 's': /* show special planets */
for (i = 0; i < MAXPL; i++)
if (pl[i].whos == player) {
j = pl[i].inventar.popul[CITI] != 0;
j = j || (pl[i].inventar.popul[MINE] != 0);
j = j || (pl[i].inventar.popul[BUIL] != 0);
j = j || (pl[i].inventar.popul[SCIE] != 0);
if (j)
change_attr (specl, i);
else
check_attr (specl, i);
}
break;
case 'b': /* show blanked planets */
for (i = 0; i < MAXPL; i++)
if (pl[i].whos == player)
if (pl[i].secur)
change_attr (black, i);
else
check_attr (black, i);
break;
case 'f': /* show where his forces are */
for (i = 0; i < MAXPL; i++)
if (pl[i].whos == player) {
j = 0;
while (!pl[i].ships[j] && j < MAXSHIPS)
j++;
if (j < MAXSHIPS)
change_attr (force, i);
else
check_attr (force, i);
}
break;
case 'm': /* show where his missiles are */
for (i = 0; i < MAXPL; i++)
if (pl[i].whos == player) {
j = 0;
while (!pl[i].missile[j] && j < MAXSHIPS)
j++;
if (j < MAXSHIPS)
change_attr (missl, i);
}
break;
case 'F': /* show where he has fighters */
for (i = 0; i < MAXPL; i++)
if (pl[i].whos == player) {
if (pl[i].inventar.popul[FIGT])
change_attr (fight, i);
else
check_attr (fight, i);
}
break;
case 'c': /* show where building of ships is done */
for (i = 0; i < MAXPL; i++)
if (pl[i].whos == player) {
if (pl[i].to_build[BUILD_MONEY] || pl[i].to_build[NSHIPS])
change_attr (build, i);
else
check_attr (build, i);
}
break;
case 'k': /* show other then A level of knowledge */
for (i = 0; i < MAXPL; i++)
if (pl[i].whos == player) {
if (pl[i].inventar.know)
change_attr ('A' + pl[i].inventar.know, i);
else
if (pl[i].d_symbol[player] >= 'A' &&
pl[i].d_symbol[player] <= 'A' + MAXSHIPS)
change_attr (pl[i].symbol, i);
}
break;
case 'i': /* show where you have messages */
for (i = 0; i < MAXPL; i++)
if (count_msgs (pl[i].reports, player))
change_attr (dinfo, i);
else
check_attr (dinfo, i);
break;
case 'e': /* show to which planet you have send
spies */
for (i = 0; i < MAXPL; i++)
if (count_spies (&pl[i], player))
change_attr (spies, i);
else
check_attr (spies, i);
break;
default:
return;
}
}
}
clean_attr () {
int i;
for (i = 0; i < MAXPL; i++)
change_attr (pl[i].symbol, i);
}
change_attr (cc, i)
char cc;
int i;
{
if (pl[i].d_symbol[player] != cc) {
pl[i].d_symbol[player] = cc;
pos (pl[i].coord[0], pl[i].coord[1] + 1);
disch (cc);
}
}
check_attr (cc, i)
char cc;
{
if (pl[i].d_symbol[player] == cc)
change_attr (pl[i].symbol, i);
}
SHAR_EOF
if test 10506 -ne "`wc -c over_stat.c`"
then
echo shar: error transmitting over_stat.c '(should have been 10506 characters)'
fi
echo shar: extracting parse.c '(16496 characters)'
cat << \SHAR_EOF > parse.c
/*
* %W% (mrdch&amnnon) %G%
*/
# include "header"
/* if a restored game switched players i.d. */
extern SWITCH_FLAG;
extern nulluser;
extern int no_new_year;
char moreflg[2] = TWOZERO;
/* flag to indicate if player changed during game */
char didchange[2] = TWOZERO;
int changestat;
planet * curpln;
int overstat (), retrieve (), pversion (),
getoutofhere (), restorgame (), savegame (), takepl (),
endgame (), quit (), give_up (), planetsit (), planetenq (),
blackout (), assign (), feedpop (), takefrom (), moveto (),
detectmv (), nodetect (), leaveat (), trading (), putalm (),
init_disc (), killalm (), write_enemy (), build (),
set_missile (), help (), menu (), next_year (), wizwiz (),
no_new (), toggle_wizard (), changeplay ();
struct commands {
char *str; /* the command name */
int (*cfun) (); /* the function that executes it */
char *docname; /* the file name that documents it */
char *exp; /* a short explanation */
};
struct commands ctab[] = {
"os", overstat, "overstat",
"Overall Situation. os || os [abcdefFikmnops]",
"ps", planetsit, "plansit",
"Planet Situation. ps [plid] [i]",
"as", assign, "assign",
"Assign people. as [plid] N (cfmbs) (cfmbs)",
"en", planetenq, "planenq",
"Enquire Planet. en [plid] [level] (afkmpst) T",
"bo", blackout, "blackout",
"Blackout a Planet. bo [plid] T",
"tk", takefrom, "takefrom",
"Take from. tk [plid] (k) || (N (tcfmbsv) )",
"lv", leaveat, "leave_at",
"Leave at. lv [plid] (k || K) || (N (tcfmbsv) )",
"mv", moveto, "move_to",
"Move to. mv [plid] -[plid] [>dr] NH [NH NH ...]",
"bs", build, "build",
"Build new ships. bs [plid] NH T || bs [plid] t T",
"sm", set_missile, "set_missl",
"Set missiles. sm [plid] NH",
"dt", detectmv, "detect",
"Detect movement / Paint ships. dt/nd [plid] T",
"nd", nodetect, "paint", 0,
"lm", putalm, "putalm",
"Lay ALM. lm [plid] N",
"dm", killalm, "killalm",
"Deactivate ALM. dm [plid] N",
"fd", feedpop, "feedpop",
"Feed population. fd T",
"tr", trading, "trade",
"Trade. tr T",
"rt", retrieve, "retrieve",
"Retrieve invested money. rt T (tfbs) [plid]",
"wr", write_enemy, "write",
"Write to the enemy. wr [anything....+ return]",
"mp", init_disc, "init_dis",
"Refresh the screen. mp",
"ny", next_year, "next_year",
"Jump a year/Continue stoped game. ny",
"nn", no_new, "next_year",
"Stop game for a while. nn",
"sv", savegame, "savegame",
"Save / Restore Game. sv/rs (file name)",
"rs", restorgame, "restor", 0,
"gu", give_up, "give_up",
"Give up this game / Ask to quit. gu/qt",
"qt", quit, "quit", 0,
"menu", menu, 0, 0,
"help", help, "help", 0,
"man", help, "help", 0,
"version", pversion, 0, 0,
"cp", changeplay, "chng_ply", "# Change player",
"wz", wizwiz, 0, "# Get a lot of everything",
"capt", takepl, 0, "# Take any planet you wish",
"toggle", toggle_wizard, 0, "# Give up/regain wizardcy",
"getout", getoutofhere, 0, "# Exit the game neatly and QUICK!!",
0, 0, 0, 0
};
/*
* this funstion sets the active terminal to the required .
*/
termn (n) {
if (SWITCH_FLAG) /* in a restored game, player switched */
n = !n;
if (n == 0) {
term0 ();
}
else {
term1 ();
}
/* check if cp command was given */
if (didchange[n]) {
player = !player;
changestat = 1;
}
else
changestat = 0;
/* set the current planet to the active player */
if (!player)
curpln = spntr;
else
curpln = apntr;
}
#define GETSTRMODE 1
#define CURSORMODE 2
/* in these buffers the input from both players is gathered */
char bufs[2][100];
/* pointers into the buffers */
int bufsp[2] = TWOZERO;
/* flags to the current position of player */
int mode[2] = {
CURSORMODE, CURSORMODE
};
/*
* The main loop. Reads chars from the two processes, stores
* them in bufs, and interprets the command. When a legal
* command is found, the function associated with that command
* is invoked. The nature of this program requires that ALL
* the relevant information to a specific command to be known
* at the time of it's execution. (Any busy wait loop will cause
* stagnation for the SECOND player).
*/
parse () {
struct commands *c = ctab;
char *ch;
chan x;
/* initialize first terminal */
termn (0);
if (ctrlinit () == 0);
crmode ();
noecho ();
say ("Sir. If you feel somewhat lost, give the \"help\" command.");
cleol (22, 11);
/* initialize second terminal */
termn (1);
if (ctrlinit () == 0);
crmode ();
noecho ();
say ("Sir. If you feel somewhat lost, give the \"help\" command.");
cleol (22, 11);
/* enter main loop */
getcommand:
for (;;) {
c = ctab;
(void) fflush (ttys[0]);
(void) fflush (ttys[1]);
if (readc (&x) != sizeof (x))
bug ("read error on pipe.");
termn (x.ichan); /* set terminal to where it came from */
/*
* First check if it's in "more" mode .
* In that case, flip back on request.
*/
if (moreflg[player]) {
if (x.c != ' ' && x.c != '5')
goto getcommand;
endmore ();
putmsgs ('r'); /* regular printout */
prteller ();
goto getcommand;
}
/* esc char toggles the two stages */
if (x.c == '\033') { /* ascii esc */
if (mode[player] == GETSTRMODE) {
mode[player] = CURSORMODE;
curse_map (curpln);
}
else {
mode[player] = GETSTRMODE;
curse_com (curpln);
cleol (22, 11 + bufsp[player]);
}
goto getcommand;
}
/* in the map mode, movement and message command and given */
if (mode[player] == CURSORMODE) {
if (x.c == '-' || x.c == ' ') {/* delete messages stack */
putmsgs ('-'); /* to advance rapidly */
curse_map (curpln);
goto getcommand;
}
/* good for ascii only. */
if ((x.c > '9') || iscntrl (x.c)) {
curse_com (curpln);
mode[player] = GETSTRMODE;
cleol (22, 11 + bufsp[player]);
}
else {
changeloc (x.c);
goto getcommand;
}
}
if (mode[player] == GETSTRMODE) {
if (x.c == '\n' || x.c == '\r') {
mode[player] = CURSORMODE;
bufs[player][bufsp[player]] = '\0';
ch = bufs[player];
bufsp[player] = 0;
goto parse;
}
else /* collect the chars */
dogetstr (x.c);
}
}
/* find out which command was given */
parse:
if (*ch) {
if (Pause) {
/* were having a pause. Execute harmless commands (no movements) */
if (strncmp (ch, "mv", 2) == 0) {
say ("As we take a break, I cannot move a single ship, sir.");
cleol (22, 11);
goto getcommand;
}
}
while (c -> str != 0) {
cleol (23, 0);
if (strcmpn (ch, c -> str, strlen (c -> str)) == 0) {
/* enable quick return in case of error */
if (setjmp (jparse) == 0)
(*c -> cfun) (ch + strlen (c -> str));
/* update time */
if (!Pause)
softclock (0);
if (!moreflg[player]) {
cleol (22, 11);
putmsgs ('r');/* regular */
prteller ();
}
goto getcommand;
}
c++;
}
error ();
c = ctab;
goto getcommand;
}
goto getcommand;
}
extern int month; /* the x/100 of the year */
prteller () {
char s[10];
cleol (19, 0);
pr_at (19, 4, "Planet: %s", curpln -> pid);
pos (19, 25);
if (teller[player])
print ("You have %d Tellers left, sir.", teller[player]);
else
print ("No money left, sir. So sorry..");
if (month < 10)
(void) sprintf (s, "%c%d", '0', month);
else
(void) sprintf (s, "%d", month);
if (wants_newy[player])
pr_at (19, 62, "NY");
pr_at (19, 65, "Year : %d.%s", year, s);
curse_map (curpln);
}
changeloc (dir)
char dir;
{
int j;
/* if the terminal has the capability, flip the page over */
if (dir == '5')
if (ttyc -> t_fl != 0) {
flip ();
more ();
return;
}
if ((j = find_direct (dir)) < 0)
return; /* illegal direction */
if (curpln -> gate[j] == NULL)
return;
curpln = curpln -> gate[j];
if (!player)
spntr = curpln;
else
apntr = curpln;
pr_at (19, 12, "%s", curpln -> pid);
/* update position at screen */
curse_map (curpln);
}
/*
* This function prints a message and sleeps until a character
* is striked at the terminal which executed more.
*
* The problem is that we can't wait to a character here becaue
* we want to get a character from the other terminal.
*
* We can use the fact that all the functions
* using more() call it just before they return to parse.
* More will simply set a flag to tell parse that we are in
* more mode.
*/
more () {
so (23, 56, "Hit SPACE to continue");
(void) fflush (tty);
moreflg[player] = 1;
}
endmore () {
cleol (23, 0); /* clear the "more" message */
moreflg[player] = 0;
flip ();
}
/*
* Get online help. All the commands that are listed above
* have help files associated with them. In case that information
* is required about some general issues, the requested file is
* searced. Actually, all the manual can be obtained in that
* fashion.
*/
help (s)
char *s;
{
FILE * docfile;
char nwcm[200];
struct commands *c = ctab;
skipwhite (s);
if (*s == '\0') { /* no patrameters were given */
strcpy (nwcm, "help");
help (nwcm); /* call recursivly with arg */
return;
}
if (*s == '-') { /* a general information was requested */
(void) sprintf (nwcm, "%s%s.doc", ONLINE, ++s);
goto show_doc;
}
while (c -> str != 0) { /* didn't reach the last command */
if (strncmp (s, c -> str, strlen (c -> str)) == 0) {
if (c -> docname == 0)
break;
(void) sprintf (nwcm, "%s%s.doc", ONLINE, c -> docname);
show_doc: docfile = fopen (nwcm, "r");
if (docfile == NULL) {
say ("I think you have the wrong name, sir. Try \"help\".");
return;
}
flip ();
clear ();
while (fgets (nwcm, 200, docfile) != NULL)
print ("%s\r", nwcm);
(void) fclose (docfile);
more ();
return;
}
c++;
}
say ("But sir !!! I don't understand that command. Try \"menu\".");
}
/*
* Extract from the command structure the information concerning
* the syntax of the commands.
*/
menu (s)
char *s;
{
struct commands *c = ctab;
int wiz = 0;
skipwhite (s);
if (*s == 'w') {
assert_wizard ();
wiz = 1;
}
flip ();
clear ();
if (!wiz)
print ("<plid = planet id> <N = no.> <T = Tellers> <H = ship type> <dr = direction>");
else
print ("This commands are only yours to give, dear lord.\n\n\r\r");
while (c -> str != 0) {
if (c -> exp != 0) {
if (!wiz) {
if (*c -> exp != '#')
print ("\r\n%s", c -> exp);
}
else {
if (*c -> exp == '#')
print ("\r\n%s:\t\t%s", c -> str, c -> exp);
}
}
c++;
}
more ();
}
error () {
say ("Sorry sir, but I don't understand you!!");
curse_map (curpln);
}
/*
* This function terminates the game. If it is calles with
* a winner, the principal facts of the game will be recorded
* on the galaxy score file. If there is no winner, the game
* will just end gracefully.
*/
# include "score.h"
endgame (mode)
int mode;
{
int resf;
char *ctime ();
struct score sc;
time_t time ();
/* force the printout of games played -null */
if (nulluser && !iswiz[1])
mode = 1;
if (mode == -1)
goto noscore;
resf = open (GALSCOR, 1);
if (resf == -1)
goto noscore;
(void) lseek (resf, 0L, 2);
if (mode) {
strcpy (sc.win, ply1), strcpy (sc.los, ply0);
}
else {
strcpy (sc.win, ply0), strcpy (sc.los, ply1);
}
sc.played_at = time (0);
sc.years = year;
(void) write (resf, (char *) & sc, sizeof (sc));
(void) close (resf);
noscore:
term0 ();
doend (mode);
term1 ();
doend (mode);
if (mode != -1)
sleep (7);
(void) kill (0, 9);
}
doend (mode) {
static char *argv[] = {
"IGNORED",
"-t"
};
clear ();
if (mode != -1) {
glxscore (2, argv);
}
ctrlreset ();
(void) fflush (tty);
}
/* check if the capital was invaded */
check_end () {
int j = capitals[0] -> whos;
if (j == capitals[1] -> whos)
end_game (j);
}
/*
* A suicidal command. When all is lost.
*/
give_up () {
end_game (!player);
}
/*
* This function enables two players to discontinue the game
* withourt any of them loosing face. Of course, they both
* must agree.
*/
quit () {
if (wants_quit[player]) {
wants_quit[player] = 0;
say ("Canceling last quit request.");
return;
}
if (!wants_quit[!player]) {
wants_quit[player] = 1;
say ("Waiting for him to agree....");
dowrite_enemy ("I would like to quit. If offer accepted, give the \"qt\" command.", !player);
return;
}
endgame (-1);
}
pversion () {
extern char version[80];
say (version);
}
/* STOP the time */
no_new () {
if (nulluser || iswiz[player] == 1) {
no_new_year = 1;
return;
}
/* We want to have a break! */
if (wants_pause[player]) {
say ("Cancelling last pause request");
wants_pause[player] = 0;
return;
}
wants_pause[player] = 1;
if (wants_pause[!player]) {
Pause = 1;
no_new_year = 1;
dowrite_enemy ("Break activated, Sir!!!", player);
dowrite_enemy ("Break activated, Sir!!!", !player);
return;
}
say ("Waiting for him to agree.....");
dowrite_enemy ("Hey, let's take a break OK ?", !player);
}
/*
* If the two players ask for a new year - so it will happen.
* wizard may force one.
*/
next_year () {
if (nulluser || iswiz[player] == 1) {
no_new_year = 0;
Pause = 0;
softclock (1);
return;
}
if (wants_newy[player]) {
wants_newy[player] = 0;
if (Pause)
dowrite_enemy ("Sorry. I still need time.", !player);
say ("Canceling last new_year request.");
return;
}
if (!wants_newy[!player]) {
wants_newy[player] = 1;
if (Pause) {
dowrite_enemy ("Let's continue the game O.K. ?", !player);
say ("Waiting for him to agree...");
}
return;
}
wants_newy[player] = 0;
wants_newy[!player] = 0;
no_new_year = 0;
if (Pause) {
Pause = 0;
dowrite_enemy ("There we go again!!", player);
dowrite_enemy ("There we go again!!", !player);
softclock (2);
return;
}
softclock (1);
}
SHAR_EOF
if test 16496 -ne "`wc -c parse.c`"
then
echo shar: error transmitting parse.c '(should have been 16496 characters)'
fi
# End of shell archive
exit 0MRDCH@TAURUS.BITNET (06/09/85)
From: Mordechai Chachamu <mrdch@taurus.BitNet>
Hello everybody!!!
The END. (sigh)
This is part #10 out of 10. It contains the rest of the source files
for the game proper. Place them in ~galaxy/src.
Now it's in your hands. I do hope that this game will give you
some hours of excitement and thrill.
ENJOY!!!
mrdch
# This is a shell archive.
# Remove everything above and including the cut line.
# Then run the rest of the file through sh.
-----cut here-----cut here-----cut here-----cut here-----
#!/bin/sh
# shar: Shell Archiver
# Run the following text with /bin/sh to create:
# use_term.c
# wizard.c
# write.c
# This archive created: Sat Jun 8 13:07:16 1985
echo shar: extracting use_term.c '(4340 characters)'
cat << \SHAR_EOF > use_term.c
/*
* %W% (mrdch&amnnon) %G%
*/
# include "header"
# include <sgtty.h>
# include <signal.h>
/* LINTLIBRARY */
/**********************************************************************\
| Ctrl library. ctrlinit should be called before any of the |
| other functions is called. it returnes 0 for error, 1 when |
| everything is ok. FUNCTIONS : |
| ctrlinit initialize |
| ctrlreset reset tty state |
| echo select echo mode |
| noecho select noecho mode |
| crmode select cbreak mode |
| nocrmode select no cbreak mode |
| raw select raw mode |
| noraw select no raw mode |
| dogetstr get a string in raw | cbreak |
| |
| All function calls work on the current player's terminal |
| |
\**********************************************************************/
struct sgttyb oldsg[2];
struct sgttyb newsg[2];
struct ltchars oldch[2];
struct ltchars newltchars = {
-1, -1, -1, -1, -1, -1
};
struct tchars oldtch[2] ;
struct tchars newtchars = {
-1, -1, -1, -1, -1, -1
};
ctrlinit () {
if (gtty (fileno (tty), &oldsg[player]) == -1)
return (0);
newsg[player] = oldsg[player];
noecho ();
setchrs ();
return (1);
}
ctrlreset () {
newsg[player] = oldsg[player];
(void) stty (fileno (tty), &newsg[player]);
ioctl (fileno (tty), TIOCSLTC, &oldch[player]);
ioctl (fileno (tty), TIOCSETC, &oldtch[player]);
}
echo () {
newsg[player].sg_flags |= ECHO;
(void) stty (fileno (tty), &newsg[player]);
}
noecho () {
newsg[player].sg_flags &= ~ECHO;
(void) stty (fileno (tty), &newsg[player]);
}
crmode () {
newsg[player].sg_flags |= CBREAK;
(void) stty (fileno (tty), &newsg[player]);
}
nocrmode () {
newsg[player].sg_flags &= ~CBREAK;
(void) stty (fileno (tty), &newsg[player]);
}
raw () {
newsg[player].sg_flags |= RAW;
(void) stty (fileno (tty), &newsg[player]);
}
noraw () {
newsg[player].sg_flags &= ~RAW;
(void) stty (fileno (tty), &newsg[player]);
}
setchrs () {
ioctl (fileno (tty), TIOCGLTC, &oldch[player]);
ioctl (fileno (tty), TIOCGETC, &oldtch[player]);
newtchars.t_startc = oldtch[player].t_startc;
newtchars.t_stopc = oldtch[player].t_stopc;
ioctl (fileno (tty), TIOCSLTC, &newltchars);
ioctl (fileno (tty), TIOCSETC, &newtchars);
}
/*
* this function is used in order to read strings from a terminal.
* If it is back_space, it goes backwards in the buffer.
* If it is cntrl/p it outputes the name of the current planet
* by calling itself recursively.
* Any other cntr char is ignored, and the terminal's bell is ringed.
* Other char is echoed to the terminal, & inserted in the buffer.
*/
# define buf bufs[player]
# define bufp bufsp[player]
extern char bufs[2][100];
extern int bufsp[2];
dogetstr (c)
char c;
{
char *topid ;
if (c == '\b') {
if (bufp == 0)
ding ();
else {
fprintf (tty, "\b");
ceol ();
bufp--;
}
return ;
}
/* If a kill character is given, then remove entire input line */
/* kill characters are ^X and ^] */
if (c == '\030' || c == '\035') {
if (bufp == 0)
ding ();
else {
cleol (22, 11);
bufp = 0;
}
return ;
}
else {
if (c == '\020' ) { /* cntr/p */
topid = curpln -> pid ;
dogetstr(*topid++) ;
dogetstr(*topid++) ;
dogetstr(*topid) ;
dogetstr(' ');
return ;
}
if (iscntrl (c)) {
ding ();
return;
}
else
fprintf (tty, "%c", c);
buf[bufp++] = c;
}
}
ding () {
fprintf (tty, "\07");
}
SHAR_EOF
if test 4340 -ne "`wc -c use_term.c`"
then
echo shar: error transmitting use_term.c '(should have been 4340 characters)'
fi
echo shar: extracting wizard.c '(2678 characters)'
cat << \SHAR_EOF > wizard.c
/*
* %W% (mrdch&amnnon) %G%
*/
# include "header"
extern char didchange[2] ;
extern int changestat;
extern int nulluser;
int no_new_year = 0;
/*
* get a string. see if exists within the wizards file.
*/
iswizard (u)
char *u;
{
char s[BUFSIZ];
FILE * wizf = fopen (WIZFIL, "r");
if (wizf == NULL)
return (0);
while (xgets (s, wizf)) {
if (strcmp (s, u) == 0) {
(void) fclose (wizf);
return (1); /* oh, boy, i'm a wizard! */
}
}
(void) fclose (wizf);
return (0);
}
/* gather chars into string, return upon CR or EOF */
xgets (s, f)
FILE * f;
char *s;
{
int c;
for (;;) {
c = getc (f);
if (c == '\n' || c == EOF) {
*s = '\0';
return (c == EOF ? 0 : 1);
}
else
*s++ = c;
}
}
/*
* function that chakes if you're a wizard.
*/
assert_wizard () {
if ( (iswiz[player] != 1) && !changestat) {
say ("But sir, where is your wizard hat?");
longjmp (jparse, 1);
}
}
toggle_wizard () {
if (iswiz[player] == 1) {
iswiz[player]++ ;
say("Sir! You are no longer a wizard.") ;
return ;
}
if (iswiz[player] == 2) {
iswiz[player]-- ;
say ("Sir! You have been nominated wizard again.") ;
return ;
}
}
/*
* If playing agains oneself, or wizard, give the asking side
* the opportunity to become the other side.
*/
changeplay () {
if (!nulluser)
assert_wizard ();
curse_map (curpln);
if (changestat) {
player = !player;
curpln = apntr;
}
else
curpln = spntr;
curse_com (curpln);
didchange[player] = !didchange[player];
}
/*
* gives a lot. needs a wizard.
*/
wizwiz () {
int j;
assert_wizard ();
feedpop ("5000");
for (j = 0; j < CLASES; j++) {
curpln -> inventar.popul[j] += 1000;
}
curpln -> inventar.metals += 100;
curpln -> inventar.know = 5;
for (j = 1; j <= MAXSHIPS; j++) {
curpln -> ships[j - 1] += j * 11;
curpln -> missile[j - 1] += j * 11;
}
}
/*
* function that gives a planet to a player. Needs wizard to
* work.
*/
takepl (s)
char *s;
{
planet * pp;
assert_wizard ();
pp = getpl (s);
skipword (s);
assert_end (s);
pp -> whos = player;
say ("Planet %s surrenders.", pp -> pid);
check_end ();
}
/* A quick exit for those who are permitted */
getoutofhere ()
{
assert_wizard ();
endgame (-1);
}
debuggingmode() {
if(iswiz[0] || iswiz[1])
return(1);
else
return(0);
}
SHAR_EOF
if test 2678 -ne "`wc -c wizard.c`"
then
echo shar: error transmitting wizard.c '(should have been 2678 characters)'
fi
echo shar: extracting write.c '(5541 characters)'
cat << \SHAR_EOF > write.c
/*
* %W% (mrdch&amnnon) %G%
*/
# include "header"
# define TORETURN 3
/* times to press '-' for a message to vanish */
extern changestat;
/*
* This tiny function exists only for the menu "write"
* function. This fuction is called only with the
* command string.
*/
write_enemy (s)
char *s;
{
/* THIS SHOULD NOT BE HERE BUT THIS WAS THE ONLY EDITED FILE */
(void) chdir("/usr/games/lib/galaxy");
skipwhite (s);
dowrite_enemy (s, !player);
}
/*
* Here we link a new piece of information to the list of
* messages that apears on the status line beneath the map.
* If this information is the first, the bell on the terminal
* of the player that has received the message is ringed.
* Here is the structure definition.
*
* typedef struct _info info;
* struct _info {
* int owner;
* int nmsg ;
* char msg[MSGSIZ];
* info * next;
* };
*/
dowrite_enemy (s, p)
char *s;
int p;
{
FILE * newtty = tty; /* keep the current terminal */
info * head = info_head[p];
info * ialloc ();
info * inf = ialloc (); /* get a new chunk of space */
char * cp = s;
inf -> owner = player;
if ( !*s )
return ; /* return on empty lines */
if(*s < 15) {
s[MSGSIZ-1] = '\0'; /* truncate too long msgs */
flip();
print("WRITE BOGUS FOUND %d AT END OF STRING\n\r", s[MSGSIZ-1]);
print("string is %s\n", s);
print("s[0]=%d s[1]=%d s[2]=%d s[3]=%d s[4]=%d s[5]=%d\n\r",
s[0],s[1],s[2],s[3],s[4],s[5]);
while(*cp < 15)
cp++;
print("first knowledgable character begins at %d\n\r", cp-s);
flip();
}
(void) strcpy (inf -> msg, s);
if (head == 0) { /* NO -More- */
if (changestat)
tty = ttys[!p];
else
tty = ttys[p]; /* the correct terminal to ring */
disch ('\07'); /* ring it */
tty = newtty; /* restore the previous one */
}
dolink (&head, inf);
info_head[p] = head;
}
/* actively display the messages gathered on screen */
/* REWRITE */
putmsgs (cc)
char cc;
{
static int nreturns = TORETURN;
static int nid = 1; /* flag to indicate repeated request */
info * i = info_head[player];
if (cc == '-')
nreturns = TORETURN; /* he wants to see NOW */
if (nreturns++ < TORETURN)
return;
if (i == 0) { /* no msgs */
if (nid)
return; /* nothing there to show or clear */
nreturns = TORETURN;
cleol (21, 0); /* clear the last one */
nid = 1;
return;
}
nreturns = 0;
nid = 0;
cleol (21, 0); /* clear the last one */
msg ("%s", i -> msg); /* display that message */
if (i -> next != 0)
so (20, 5, "--More--"); /* show that more are pending */
else
cleol (20, 5); /* erase the -more- message */
info_head[player] = i -> next;/* advance to the next one */
ifree (i); /* and throw the last */
}
/*
* This part contains all functions dealing with linked lists.
* linked list of type `info' are used by : ps, en, wr, newyear.
*/
# define HEAD (*head)
/*
* perform linking of a new info structure.
* only the nmsg is updated here.
*/
dolink (head, inf)
info ** head;
info * inf;
{
info * i = HEAD;
inf -> next = 0; /* after it? nothing yet */
if (HEAD == 0) { /* if list empty- */
HEAD = inf; /* point to the first */
inf -> nmsg = 1; /* and declare it so */
return;
} else {
while (i -> next) /* search to it's end */
i = i -> next;
inf -> nmsg = i -> nmsg + 1;
i -> next = inf; /* and link it there */
}
}
spy_msg (msg, own, pl, lvl)
char *msg;
int own;
planet * pl;
int lvl;
{
info * ialloc ();
info * inf = ialloc ();
(void) sprintf (inf -> msg, "Y: %d L: %d %s", year,
lvl, msg);
inf -> owner = own;
dolink (&(pl -> reports), inf);
}
/*
* delete the first few msgs in order to scroll old msgs.
*/
scroll_msgs (head, player)
info ** head;
{
info * h = HEAD;
info * x, *x1;
int nmsgs = count_msgs (h, player);
if (nmsgs <= N_PSI)
return;
x1 = 0;
x = HEAD;
while (nmsgs > N_PSI && x -> next) {
if(x->owner == player) { /* remove it. */
if(x == HEAD) {
x = x->next;
ifree(HEAD);
HEAD = x;
nmsgs--;
} else {
x1 ->next = x->next;
ifree(x);
nmsgs--;
x = x1 -> next;
}
} else {
x1 = x;
x = x->next;
}
}
}
/*
* allocate space for info structure.
*/
info *
ialloc () {
char *malloc ();
char *p = malloc (sizeof (info));
if (p == 0)
(void) bug ("Unable to allocate space for messages.");
((info *) p) -> next = 0;
return ((info *) p);
}
ifree (i)
info * i;
{
# ifndef ENQDBG
# define ENQDBG 0
# else
# undef ENQDBG
# define ENQDBG 1
# endif
if(!(debuggingmode() || ENQDBG))
free ((char *) i);
}
SHAR_EOF
if test 5541 -ne "`wc -c write.c`"
then
echo shar: error transmitting write.c '(should have been 5541 characters)'
fi
# End of shell archive
exit 0MRDCH@TAURUS.BITNET (06/09/85)
From: Mordechai Chachamu <mrdch@taurus.BitNet>
Hello everybody!!!
This is part #8 out of 10. It contains some of the source files
for the game proper. They should be placed in ~galaxy/src.
mrdch
# This is a shell archive.
# Remove everything above and including the cut line.
# Then run the rest of the file through sh.
-----cut here-----cut here-----cut here-----cut here-----
#!/bin/sh
# shar: Shell Archiver
# Run the following text with /bin/sh to create:
# planet_enq.c
# planet_inf.c
# planet_sit.c
# play.c
# put_alm.c
# retrieve.c
# savegame.c
# This archive created: Sat Jun 8 13:03:30 1985
echo shar: extracting planet_enq.c '(1689 characters)'
cat << \SHAR_EOF > planet_enq.c
/*
* %W% (mrdch&amnnon) %G%
*/
# include "header"
planetenq (s)
char *s;
{
planet * pp;
int ntellers;
int enqtype;
int enqlvl = 0;
pp = getpl (s);
skipwhite (s);
if (isdigit (*s)) {
enqlvl = *s++ - '0';
/* calculate level of espionage */
if (enqlvl > ESPSIZ) {
say ("Sir, we don't have such level of spies!");
return;
}
skipwhite (s);
}
/* see what subject he wants to enquire */
switch (*s++) {
case 's':
enqtype = ESPKIND;
break;
case 'p':
enqtype = ESPPOP;
break;
case 'k':
enqtype = ESPKNOW;
break;
case 't':
enqtype = ESPMTL;
break;
case 'f':
enqtype = ESPSHIP;
break;
case 'a':
enqtype = ESPALM;
break;
case 'm':
enqtype = ESPMSL;
break;
default:
say ("Our spies don't recognize that kind of info, Sir. ");
return;
}
skipwhite (s);
ntellers = atoi (s);
assert_money (ntellers);
/* see if enough money is available */
teller[player] -= ntellers;
if (pp -> whos == 2) {
if (ntellers >= MIN_ESP) {
say ("The rumors has it that this planet is uninhabited.");
spy_msg ("An empty planet", player, pp, 0);
}
else
say ("But sir, that little money won't bring any information !!!");
return;
}
/* perform actual investment */
pp -> espion[player][enqtype][enqlvl] += ntellers;
say ("The spies are on their way, sir.");
}
SHAR_EOF
if test 1689 -ne "`wc -c planet_enq.c`"
then
echo shar: error transmitting planet_enq.c '(should have been 1689 characters)'
fi
echo shar: extracting planet_inf.c '(15087 characters)'
cat << \SHAR_EOF > planet_inf.c
/*
* %W% (mrdch&amnnon) %G%
*/
# include "header"
/*
* # define CLASES 6
* # define MAXSHIPS 7
* # define ESPTYP 10
* # define ESPSIZ 8
*
* struct _movable
* {
* int popul[CLASES] ;
* int metals ;
* int know ;
* };
*
* struct _planet
* {
* char symbol ;
* char d_symbol[2] ;
* char pid[4] ;
* int coord[2] ;
* planet *gate[10] ;
* int whos ;
* movable inventar ;
* movable to_take ;
* int secur ;
* int alms ;
* int paint ;
* int detect ;
* int to_build[3] ;
* info *reports ;
* int ships[MAXSHIPS] ;
* int espion[2][ESPTYP][ESPSIZ];
* };
*
* Some explanations about the planet structure :
*
* The first field is the char shown on the map: '*', '@' and '#'.
* The second is the char currently displayed at each player term.
* Next is the name . Always three characters + '\0'.
* Next two numbers are the planets' coordinates on the terminal.
* Ten pointers that show aloowed planets to go to.
* The order in which they are initialized is the order of the
* key-pad on the tvi-925.
* 7 8 9
* 4 * 6
* 1 2 3
* <- ->
* Int representing ownership. 0-"*" 1-"@" or 2 (for no-one).
* #### The next 3 items are movable, but belong to a planet. ######
* Next 6 numbers indicate the population, divided to occupation.
* One number shows the amount of metal digged out in A-type quan.
* One number indicating the knowledge level on the planet.
* #### The next 3 items are the storage location for transporting.
* Next 6 numbers indicate the population, divided to occupation.
* One number shows the amount of metal digged out in A-type quan.
* One number indicating the knowledge level on the planet.
* One number indicates black- out.
* One number indicates ALMs layed on that planet.
* One number indicating the sum dedicated to paint the ships.
* One number indicating sum dedicated to detect movement.
* one number indicating sum dedicated to build ships.
* Next 2 no. indicating how many ships to be build & their level.
* One poineter to reports about this planet.
* Next 7 no. show the ships and their level.
* Next 160 numbers indicate Espinage.
* Each player has a two dimension array that is comprised
* of 10 kinds of espionage and 8 levels of counter espionage.
* Each cell holds the money invested for obtaining information
* for that level and kind of information.
*/
planet pl[MAXPL] = {
{
'*', '*', '*', "l00", 8, 17, &pl[1], &pl[2], &pl[3], &pl[4], &pl[5], &pl[6], &pl[7], &pl[8], NULL, NULL, 0, 960, 100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, 15
},
{
'*', '*', '*', "l10", 6, 17, &pl[9], NULL, NULL, &pl[2], &pl[0], &pl[8], NULL, NULL, &pl[8], &pl[2]
},
{
'*', '*', '*', "l11", 7, 19, NULL, &pl[10], NULL, &pl[3], NULL, &pl[0], NULL, &pl[1], &pl[1], &pl[3]
},
{
'*', '*', '*', "l12", 8, 20, NULL, NULL, &pl[11], NULL, NULL, &pl[4], &pl[0], &pl[2], &pl[2], &pl[4]
},
{
'*', '*', '*', "l13", 9, 19, NULL, &pl[3], NULL, &pl[12], NULL, &pl[5], NULL, &pl[0], &pl[3], &pl[5]
}
,
{
'*', '*', '*', "l14", 10, 17, &pl[0], &pl[4], NULL, NULL, &pl[13], NULL, NULL, &pl[6], &pl[4], &pl[6]
}
,
{
'*', '*', '*', "l15", 9, 15, NULL, &pl[0], NULL, &pl[5], NULL, &pl[14], NULL, &pl[7], &pl[5], &pl[7]
}
,
{
'*', '*', '*', "l16", 8, 14, NULL, &pl[8], &pl[0], &pl[6], NULL, NULL, &pl[15], NULL, &pl[6], &pl[8]
}
,
{
'*', '*', '*', "l17", 7, 15, NULL, &pl[1], NULL, &pl[0], NULL, &pl[7], NULL, &pl[16], &pl[7], &pl[1]
}
,
{
'*', '*', '*', "l20", 3, 17, &pl[17], NULL, NULL, &pl[10], &pl[1], &pl[16], NULL, NULL, &pl[16], &pl[10]
}
,
{
'*', '*', '*', "l21", 5, 22, NULL, &pl[19], NULL, &pl[11], NULL, &pl[2], NULL, &pl[9], &pl[9], &pl[11]
}
,
{
'*', '*', '*', "l22", 8, 25, NULL, NULL, &pl[21], NULL, NULL, &pl[12], &pl[3], &pl[10], &pl[10], &pl[12]
}
,
{
'*', '*', '*', "l23", 11, 22, NULL, &pl[11], NULL, &pl[23], NULL, &pl[13], NULL, &pl[4], &pl[11], &pl[13]
}
,
{
'*', '*', '*', "l24", 13, 17, &pl[5], &pl[12], NULL, NULL, &pl[25], NULL, NULL, &pl[14], &pl[12], &pl[14]
}
,
{
'*', '*', '*', "l25", 11, 12, NULL, &pl[6], NULL, &pl[13], NULL, &pl[27], NULL, &pl[15], &pl[13], &pl[15]
}
,
{
'*', '*', '*', "l26", 8, 9, NULL, &pl[16], &pl[7], &pl[14], NULL, NULL, &pl[29], NULL, &pl[14], &pl[16]
}
,
{
'*', '*', '*', "l27", 5, 12, NULL, &pl[9], NULL, &pl[8], NULL, &pl[15], NULL, &pl[31], &pl[15], &pl[9]
}
,
{
'*', '*', '*', "l30", 0, 17, NULL, NULL, &pl[66], &pl[18], &pl[9], &pl[32], NULL, NULL, &pl[32], &pl[18]
}
,
{
'*', '*', '*', "l31", 1, 22, NULL, &pl[66], NULL, &pl[19], NULL, NULL, NULL, &pl[17], &pl[17], &pl[19]
}
,
{
'*', '*', '*', "l32", 3, 26, NULL, NULL, &pl[71], &pl[20], NULL, &pl[10], NULL, &pl[18], &pl[18], &pl[20]
}
,
{
'*', '*', '*', "l33", 5, 28, NULL, NULL, &pl[74], &pl[21], NULL, NULL, NULL, &pl[19], &pl[19], &pl[21]
}
,
{
'*', '*', '*', "l34", 8, 29, NULL, NULL, &pl[77], NULL, NULL, &pl[22], &pl[11], &pl[20], &pl[20], &pl[22]
}
,
{
'*', '*', '*', "l35", 11, 28, NULL, &pl[21], &pl[80], NULL, NULL, &pl[23], NULL, NULL, &pl[21], &pl[23]
}
,
{
'*', '*', '*', "l36", 13, 26, NULL, &pl[22], &pl[83], NULL, NULL, &pl[24], NULL, &pl[12], &pl[22], &pl[24]
}
,
{
'*', '*', '*', "l37", 15, 22, NULL, &pl[23], NULL, &pl[86], NULL, &pl[25], NULL, NULL, &pl[23], &pl[25]
}
,
{
'*', '*', '*', "l38", 16, 17, &pl[13], &pl[24], &pl[86], NULL, NULL, NULL, NULL, &pl[26], &pl[24], &pl[26]
}
,
{
'*', '*', '*', "l39", 15, 12, NULL, NULL, NULL, &pl[25], NULL, NULL, NULL, &pl[27], &pl[25], &pl[27]
}
,
{
'*', '*', '*', "l3a", 13, 8, NULL, &pl[14], NULL, &pl[26], NULL, NULL, NULL, &pl[28], &pl[26], &pl[28]
}
,
{
'*', '*', '*', "l3b", 11, 6, NULL, NULL, NULL, &pl[27], NULL, NULL, NULL, &pl[29], &pl[27], &pl[29]
}
,
{
'*', '*', '*', "l3c", 8, 5, NULL, &pl[30], &pl[15], &pl[28], NULL, NULL, NULL, NULL, &pl[28], &pl[30]
}
,
{
'*', '*', '*', "l3d", 5, 6, NULL, &pl[31], NULL, NULL, NULL, &pl[29], NULL, NULL, &pl[29], &pl[31]
}
,
{
'*', '*', '*', "l3e", 3, 8, NULL, &pl[32], NULL, &pl[16], NULL, &pl[30], NULL, NULL, &pl[30], &pl[32]
}
,
{
'*', '*', '*', "l3f", 1, 12, NULL, &pl[17], NULL, NULL, NULL, &pl[31], NULL, NULL, &pl[31], &pl[17]
}
,
{
'@', '@', '@', "r00", 8, 61, &pl[34], &pl[35], &pl[36], &pl[37], &pl[38], &pl[39], &pl[40], &pl[41], NULL, NULL, 1, 960, 100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, 15
}
,
{
'@', '@', '@', "r10", 6, 61, &pl[42], NULL, NULL, &pl[35], &pl[33], &pl[41], NULL, NULL, &pl[41], &pl[35], 1
}
,
{
'@', '@', '@', "r11", 7, 63, NULL, &pl[43], NULL, &pl[36], NULL, &pl[33], NULL, &pl[34], &pl[34], &pl[36], 1
}
,
{
'@', '@', '@', "r12", 8, 64, NULL, NULL, &pl[44], NULL, NULL, &pl[37], &pl[33], &pl[35], &pl[35], &pl[37], 1
}
,
{
'@', '@', '@', "r13", 9, 63, NULL, &pl[36], NULL, &pl[45], NULL, &pl[38], NULL, &pl[33], &pl[36], &pl[38], 1
}
,
{
'@', '@', '@', "r14", 10, 61, &pl[33], &pl[37], NULL, NULL, &pl[46], NULL, NULL, &pl[39], &pl[37], &pl[39], 1
}
,
{
'@', '@', '@', "r15", 9, 59, NULL, &pl[33], NULL, &pl[38], NULL, &pl[47], NULL, &pl[40], &pl[38], &pl[40], 1
}
,
{
'@', '@', '@', "r16", 8, 58, NULL, &pl[41], &pl[33], &pl[39], NULL, NULL, &pl[48], NULL, &pl[39], &pl[41], 1
}
,
{
'@', '@', '@', "r17", 7, 59, NULL, &pl[34], NULL, &pl[33], NULL, &pl[40], NULL, &pl[49], &pl[40], &pl[34], 1
}
,
{
'@', '@', '@', "r20", 3, 61, &pl[50], NULL, NULL, &pl[43], &pl[34], &pl[49], NULL, NULL, &pl[49], &pl[43], 1
}
,
{
'@', '@', '@', "r21", 5, 66, NULL, &pl[52], NULL, &pl[44], NULL, &pl[35], NULL, &pl[42], &pl[42], &pl[44], 1
}
,
{
'@', '@', '@', "r22", 8, 69, NULL, NULL, &pl[54], NULL, NULL, &pl[45], &pl[36], &pl[43], &pl[43], &pl[45], 1
}
,
{
'@', '@', '@', "r23", 11, 66, NULL, &pl[44], NULL, &pl[56], NULL, &pl[46], NULL, &pl[37], &pl[44], &pl[46], 1
}
,
{
'@', '@', '@', "r24", 13, 61, &pl[38], &pl[45], NULL, NULL, &pl[58], NULL, NULL, &pl[47], &pl[45], &pl[47], 1
}
,
{
'@', '@', '@', "r25", 11, 56, NULL, &pl[39], NULL, &pl[46], NULL, &pl[60], NULL, &pl[48], &pl[46], &pl[48], 1
}
,
{
'@', '@', '@', "r26", 8, 53, NULL, &pl[49], &pl[40], &pl[47], NULL, NULL, &pl[62], NULL, &pl[47], &pl[49], 1
}
,
{
'@', '@', '@', "r27", 5, 56, NULL, &pl[42], NULL, &pl[41], NULL, &pl[48], NULL, &pl[64], &pl[48], &pl[42], 1
}
,
{
'@', '@', '@', "r30", 0, 61, NULL, NULL, NULL, &pl[51], &pl[42], &pl[65], &pl[70], NULL, &pl[65], &pl[51], 1
}
,
{
'@', '@', '@', "r31", 1, 66, NULL, NULL, NULL, &pl[52], NULL, NULL, NULL, &pl[50], &pl[50], &pl[52], 1
}
,
{
'@', '@', '@', "r32", 3, 70, NULL, NULL, NULL, &pl[53], NULL, &pl[43], NULL, &pl[51], &pl[51], &pl[53], 1
}
,
{
'@', '@', '@', "r33", 5, 72, NULL, NULL, NULL, &pl[54], NULL, NULL, NULL, &pl[52], &pl[52], &pl[54], 1
}
,
{
'@', '@', '@', "r34", 8, 73, NULL, NULL, NULL, NULL, NULL, &pl[55], &pl[44], &pl[53], &pl[53], &pl[55], 1
}
,
{
'@', '@', '@', "r35", 11, 72, NULL, &pl[54], NULL, NULL, NULL, &pl[56], NULL, NULL, &pl[54], &pl[56], 1
}
,
{
'@', '@', '@', "r36", 13, 70, NULL, &pl[55], NULL, NULL, NULL, &pl[57], NULL, &pl[45], &pl[55], &pl[57], 1
}
,
{
'@', '@', '@', "r37", 15, 66, NULL, &pl[56], NULL, NULL, NULL, &pl[58], NULL, NULL, &pl[56], &pl[58], 1
}
,
{
'@', '@', '@', "r38", 16, 61, &pl[46], &pl[57], NULL, NULL, NULL, NULL, &pl[90], &pl[59], &pl[57], &pl[59], 1
}
,
{
'@', '@', '@', "r39", 15, 56, NULL, NULL, NULL, &pl[58], NULL, &pl[90], NULL, &pl[60], &pl[58], &pl[60], 1
}
,
{
'@', '@', '@', "r3a", 13, 52, NULL, &pl[47], NULL, &pl[59], NULL, NULL, &pl[85], &pl[61], &pl[59], &pl[61], 1
}
,
{
'@', '@', '@', "r3b", 11, 50, NULL, NULL, NULL, &pl[60], NULL, NULL, &pl[82], &pl[62], &pl[60], &pl[62], 1
}
,
{
'@', '@', '@', "r3c", 8, 49, NULL, &pl[63], &pl[48], &pl[61], NULL, NULL, &pl[79], NULL, &pl[61], &pl[63], 1
}
,
{
'@', '@', '@', "r3d", 5, 50, NULL, &pl[64], NULL, NULL, NULL, &pl[62], &pl[76], NULL, &pl[62], &pl[64], 1
}
,
{
'@', '@', '@', "r3e", 3, 52, NULL, &pl[65], NULL, &pl[49], NULL, &pl[63], &pl[73], NULL, &pl[63], &pl[65], 1
}
,
{
'@', '@', '@', "r3f", 1, 56, NULL, &pl[50], NULL, NULL, NULL, &pl[64], NULL, &pl[70], &pl[64], &pl[50], 1
}
,
{
'#', '#', '#', "c00", 0, 28, NULL, NULL, &pl[67], NULL, NULL, &pl[18], &pl[17], NULL, NULL, NULL, 2
}
,
{
'#', '#', '#', "c01", 0, 34, NULL, NULL, &pl[68], NULL, &pl[71], NULL, &pl[66], NULL, NULL, NULL, 2
}
,
{
'#', '#', '#', "c02", 0, 39, NULL, NULL, &pl[69], NULL, &pl[72], NULL, &pl[67], NULL, NULL, NULL, 2
}
,
{
'#', '#', '#', "c03", 0, 44, NULL, NULL, &pl[70], NULL, &pl[73], NULL, &pl[68], NULL, NULL, NULL, 2
}
,
{
'#', '#', '#', "c04", 0, 50, NULL, NULL, &pl[50], &pl[65], NULL, NULL, &pl[69], NULL, NULL, NULL, 2
}
,
{
'#', '#', '#', "c11", 3, 34, &pl[67], NULL, &pl[72], NULL, &pl[74], NULL, &pl[19], NULL, NULL, NULL, 2
}
,
{
'#', '#', '#', "c12", 3, 39, &pl[68], NULL, &pl[73], NULL, &pl[75], NULL, &pl[71], NULL, NULL, NULL, 2
}
,
{
'#', '#', '#', "c13", 3, 44, &pl[69], NULL, &pl[64], NULL, &pl[76], NULL, &pl[72], NULL, NULL, NULL, 2
}
,
{
'#', '#', '#', "c21", 5, 34, &pl[71], NULL, &pl[75], NULL, &pl[77], NULL, &pl[20], NULL, NULL, NULL, 2
}
,
{
'#', '#', '#', "c22", 5, 39, &pl[72], NULL, &pl[76], NULL, &pl[78], NULL, &pl[74], NULL, NULL, NULL, 2
}
,
{
'#', '#', '#', "c23", 5, 44, &pl[73], NULL, &pl[63], NULL, &pl[79], NULL, &pl[75], NULL, NULL, NULL, 2
}
,
{
'#', '#', '#', "c31", 8, 34, &pl[74], NULL, &pl[78], NULL, &pl[80], NULL, &pl[21], NULL, NULL, NULL, 2
}
,
{
'#', '#', '#', "c32", 8, 39, &pl[75], NULL, &pl[79], NULL, &pl[81], NULL, &pl[77], NULL, NULL, NULL, 2
}
,
{
'#', '#', '#', "c33", 8, 44, &pl[76], NULL, &pl[62], NULL, &pl[82], NULL, &pl[78], NULL, NULL, NULL, 2
}
,
{
'#', '#', '#', "c41", 11, 34, &pl[77], NULL, &pl[81], NULL, &pl[83], NULL, &pl[22], NULL, NULL, NULL, 2
}
,
{
'#', '#', '#', "c42", 11, 39, &pl[78], NULL, &pl[82], NULL, &pl[84], NULL, &pl[80], NULL, NULL, NULL, 2
}
,
{
'#', '#', '#', "c43", 11, 44, &pl[79], NULL, &pl[61], NULL, &pl[85], NULL, &pl[81], NULL, NULL, NULL, 2
}
,
{
'#', '#', '#', "c51", 13, 34, &pl[80], NULL, &pl[84], NULL, &pl[87], NULL, &pl[23], NULL, NULL, NULL, 2
}
,
{
'#', '#', '#', "c52", 13, 39, &pl[81], NULL, &pl[85], NULL, &pl[88], NULL, &pl[83], NULL, NULL, NULL, 2
}
,
{
'#', '#', '#', "c53", 13, 44, &pl[82], NULL, &pl[60], NULL, &pl[89], NULL, &pl[84], NULL, NULL, NULL, 2
}
,
{
'#', '#', '#', "c60", 16, 28, NULL, NULL, &pl[87], NULL, NULL, NULL, &pl[25], &pl[24], NULL, NULL, 2
}
,
{
'#', '#', '#', "c61", 16, 34, &pl[83], NULL, &pl[88], NULL, NULL, NULL, &pl[86], NULL, NULL, NULL, 2
}
,
{
'#', '#', '#', "c62", 16, 39, &pl[84], NULL, &pl[89], NULL, NULL, NULL, &pl[87], NULL, NULL, NULL, 2
}
,
{
'#', '#', '#', "c63", 16, 44, &pl[85], NULL, &pl[90], NULL, NULL, NULL, &pl[88], NULL, NULL, NULL, 2
}
,
{
'#', '#', '#', "c64", 16, 50, NULL, &pl[59], &pl[58], NULL, NULL, NULL, &pl[89], NULL, NULL, NULL, 2
}
};
SHAR_EOF
if test 15087 -ne "`wc -c planet_inf.c`"
then
echo shar: error transmitting planet_inf.c '(should have been 15087 characters)'
fi
echo shar: extracting planet_sit.c '(5473 characters)'
cat << \SHAR_EOF > planet_sit.c
/*
* %W% (mrdch&amnnon) %G%
*/
# include "header"
planetsit (s)
char *s;
{
planet * pp;
pp = getpl (s);
skipwhite (s); /* find the first non-white */
if (*s == 'i') {
skipword (s);
assert_end (s);
ps_i (pp);
return;
}
flip ();
clear ();
pos (0, 20);
print ("Information available about: %s \r\n\n", pp -> pid);
/* give full information to wizards or owner */
if (pp -> whos == player || iswiz[player])
if (chek_empty (pp))
print_info (pp);
else
print ("\r\n\n This planet is empty.");
else {
if (!count_spies (pp, player))
print ("Sorry sir, no information.");
else {
print ("Your spies are assigned to:\r\n");
dis_spies (pp, player, 3, 0);
}
}
more ();
}
/* gives all the information about a given planet */
print_info (pp)
planet * pp;
{
int i,
j,
ps,
cc,
col;
if (j = pp -> inventar.popul[FIGT])
print ("There are %d Fighters ready.\r\n", j);
if (j = pp -> inventar.popul[CITI])
print ("Agricultural with %6d Citizens \r\n", j);
if (j = pp -> inventar.popul[MINE])
print ("Mining-planet with %6d Miners.\r\n", j);
if (j = pp -> inventar.popul[BUIL])
print ("Industrial with %6d Builders.\r\n", j);
if (j = pp -> inventar.popul[SCIE])
print ("Scientific with %6d Scientists.\r\n", j);
if (j = pp -> inventar.popul[SLAV])
print (" It has %6d Slaves. \r\n", j);
print ("\r\n");
i = 0;
for (j = 0; j < CLASES; j++)
if (pp -> to_take.popul[j])
i++;
if (pp -> to_take.metals)
i++;
if (pp -> to_take.know)
i++;
if (i) {
print ("Ready to be moved\r\n");
for (j = 0; j < CLASES; j++)
if ((i = pp -> to_take.popul[j]))
print ("%6d %s.\r\n", i, ocup_name[j]);
if ((i = pp -> to_take.metals))
print ("%6d A-type material.\r\n", i);
if ((cc = pp -> to_take.know))
print (" %c-type knowledge.", 'A' + cc);
}
ps = 2;
col = 45;
i = 0;
for (j = 0; j < MAXSHIPS; j++)
if (pp -> ships[j] || pp -> missile[j])
i++;
if (i) {
pos (ps++, col + 3);
print ("No. of ships and missiles:");
for (i = 0; i < MAXSHIPS; i++) {
if ((j = pp -> ships[i]) || pp -> missile[i]) {
pos (ps++, col);
print ("%c-type %4d ships %4d missiles.", i + 'A', j, pp -> missile[i]);
}
}
}
ps++;
if (j = pp -> secur) {
pos (ps++, col);
print ("Blacked out with %d Tellers.", j);
}
if (j = pp -> detect) {
pos (ps++, col);
print ("Detect moves with %d Tellers.", j);
}
if (j = pp -> paint) {
pos (ps++, col);
print ("No detection paint %d Tellers.", j);
}
if (j = pp -> inventar.metals) {
pos (ps++, col);
print ("Metal for %d A-type HAWKs ready.", j);
}
if (j = pp -> inventar.know) {
pos (ps++, col);
print ("Knowledge of %c-type available.", j + 'A');
}
if (j = pp -> alms) {
pos (ps++, col);
print ("%d of ALMs installed.", j);
}
if (j = pp -> to_build[BUILD_MONEY]) {
pos (ps++, col);
print ("Building ships with %d tellers.", j);
}
if (j = pp -> to_build[NSHIPS]) {
pos (ps++, col);
print (" %d %c-type ships ordered.",
j , pp -> to_build[LEVEL] + 'A');
}
if (count_spies (pp, player)) {
ps++;
pr_at (ps++, 30, "Your spies are assigned to:");
dis_spies (pp, player, ps, 30);
}
}
/*
* gives the information about spies reports, gathered so far.
*/
ps_i (pp)
planet * pp;
{
info * x;
int nmgs = 1;
/* count how many messages are on the line */
if (count_msgs (pp -> reports, player) == 0) {
say ("No messages, sir.");
return;
}
/* leave up to 24 message */
scroll_msgs (&pp -> reports, player);
flip ();
clear ();
pr_at (0, 20, "Information available about: %s\r\n ", pp -> pid);
x = pp -> reports;
while (x) {
pos (nmgs, 0);
if (x -> owner == player) {
print ("%s.", x -> msg);
nmgs++;
}
x = x -> next;
}
more ();
}
/* returns the no. of messages awaitaing */
count_msgs (hd, ply)
info * hd;
int ply;
{
int ac = 0;
while (hd) {
if (hd -> owner == ply)
ac++;
hd = hd -> next;
}
return (ac);
}
count_spies (pp, ply)
planet * pp;
{
int i,
j;
for (i = 0; i < ESPTYP; i++)
for (j = 0; j < ESPSIZ; j++)
if (pp -> espion[ply][i][j])
return (1);
return (0);
}
extern char *inftypes[];
dis_spies (pp, ply, line, col)
planet * pp;
{
int i,
j,
flg;
for (i = 0; i < ESPTYP; i++) {
flg = 0;
for (j = 0; j < ESPSIZ; j++)
if (pp -> espion[ply][i][j])
flg++;
if (flg) {
pr_at (line++, col, "%s:\t", inftypes[i]);
for (j = 0; j < ESPSIZ; j++) {
if (pp -> espion[ply][i][j])
print ("%d %d\t", j, pp -> espion[ply][i][j]);
}
}
}
}
SHAR_EOF
if test 5473 -ne "`wc -c planet_sit.c`"
then
echo shar: error transmitting planet_sit.c '(should have been 5473 characters)'
fi
echo shar: extracting play.c '(1969 characters)'
cat << \SHAR_EOF > play.c
/*
* %W% (mrdch&amnnon) %G%
*/
# include "header"
char buffer1[BUFSIZ];
char buffer2[BUFSIZ];
main (argc, argv)
int argc;
char *argv[];
{
/* If any argument present, go to score analysis */
if (argc > 1){
tty = stdout;
glxscore (argc, argv);
exit(0) ;
}
init_getid ();
term2init ();
/* Get the terminal from the player enviroment */
fillterm (getenv ("TERM"), &ttycs[1]);
/* Now go and start playing */
play ();
/*
* And when it's all over, return the terminal to the
* original state. then kill the two reading processes
*/
term1 ();
ctrlreset ();
term0 ();
ctrlreset ();
(void) kill (getpid (), 9);
}
play () {
/* Open the chanels for writing */
ttys[0] = fdopen (chand[0], "w");
ttys[1] = fdopen (chand[1], "w");
setbuf (ttys[0], buffer1);
setbuf (ttys[1], buffer2);
/* Initial the first terminal */
term0 ();
cap_set (ttyc);
clear ();
if (!iswiz[player])
show_name ();
fflush(tty) ;
/* Initial the second terminal */
term1 ();
cap_set (ttyc);
clear ();
if (!iswiz[player])
show_name ();
fflush(tty) ;
/* transform the name of the game to it's map */
if (!iswiz[player]) {
sleep (5) ;
prologue ();
sleep (3) ;
}
/* redraw the map, enabling inverse video */
termn (0);
init_dis();
cleol(18,0) ;
cleol(19,0) ;
cleol(20,0) ;
cleol(21,0) ;
cleol(22,20) ;
cleol(23,0) ;
prteller () ;
fflush(tty) ;
termn (1);
init_dis();
cleol(18,0) ;
cleol(19,0) ;
cleol(20,0) ;
cleol(21,0) ;
cleol(22,20) ;
cleol(23,0) ;
prteller () ;
fflush(tty) ;
/* Go and start reading what the players are writing */
parse ();
}
/* Functions to set the active terminal and the current player */
term0 () {
tty = ttys[0];
ttyc = &ttycs[0];
player = 0;
}
term1 () {
tty = ttys[1];
ttyc = &ttycs[1];
player = 1;
}
SHAR_EOF
if test 1969 -ne "`wc -c play.c`"
then
echo shar: error transmitting play.c '(should have been 1969 characters)'
fi
echo shar: extracting put_alm.c '(694 characters)'
cat << \SHAR_EOF > put_alm.c
/*
* %W% (mrdch&amnnon) %G%
*/
# include "header"
putalm (s)
char *s;
{
planet * pp;
int i,
nalms;
pp = getpl (s);
assert_player (pp); /* check valid planet and owner */
if (planet_popul (pp) == 0) {
say ("But sir, there is nobody there to do it.");
return;
}
nalms = atoi (s);
assert_number (nalms); /* valid no.? */
skipword (s);
assert_end (s); /* ends gracefully? */
i = ALMCOST * nalms;
assert_money (i); /* hase enough money? */
pp -> alms += nalms;
teller[player] -= i;
say ("Beware, sir, we'll better get the hell out of here!!");
}
SHAR_EOF
if test 694 -ne "`wc -c put_alm.c`"
then
echo shar: error transmitting put_alm.c '(should have been 694 characters)'
fi
echo shar: extracting retrieve.c '(3078 characters)'
cat << \SHAR_EOF > retrieve.c
/*
* %W% (mrdch&amnnon) %G%
*/
# include "header"
/*
* This function enables recovering from real stupid typing
* mistakes. It could happen that when giving a command
* involving money, too many '000...' will be typed.
* Retrieving that money ( or part of it ) is made possible.
* To avoid as much as possible the influence of such command
* on the tactics one employs, it is NOT general, and it costs
* some percentenge of the money asked to be retrieved.
*/
# define PERC_LOST 15
retrieve (s)
char *s;
{
planet * pp;
int i,
money;
double d;
skipwhite (s);
money = atoi (s);
assert_number (money);
skipword (s);
skipwhite (s);
switch (*s++) {
case 'f': /* food */
assert_end (s);
if (food[player] < money) {
say ("But you don't have that much there, sir!!!");
return;
}
i = count_popul (player) - count_class (player, CITI);
i = i / FEED_RATIO; /* that much they consume */
money -= i;
if (money <= 0) {
say ("This much was consumed already, sir.");
return;
}
food[player] -= money;
d = (double) money * ((double) PERC_LOST + (rand () % 5)) / 100.;
money -= (int) d;
break;
case 't': /* trade */
assert_end (s);
if (trade[player] < money) {
say ("But you don't have that much there, sir!!!");
return;
}
trade[player] -= money;
d = (double) money * ((double) PERC_LOST + (rand () % 5)) / 100.;
money -= (int) d;
break;
case 's': /* ships */
pp = getpl (s); /* get planet id */
assert_end (s);
assert_player (pp); /* verify existence + owner */
if (pp -> to_build[BUILD_MONEY] < money) {
say ("But you don't have that much there, sir!!!");
return;
}
pp -> to_build[BUILD_MONEY] -= money;
d = (double) money * ((double) PERC_LOST + (rand () % 5)) / 100.;
money -= (int) d;
break;
case 'b': /* blackout */
pp = getpl (s); /* get planet id */
assert_end (s);
assert_player (pp); /* verify existence + owner */
if (pp -> secur < money) {
say ("But you don't have that much there, sir!!!");
return;
}
pp -> secur -= money;
d = (double) money * ((double) PERC_LOST + (rand () % 5)) / 100.;
money -= (int) d;
break;
default:
say ("Source of retrivel is not clear, sir.");
return;
}
if (money == 0) {
say ("Sorry sir. Couldn't get anything out of it.");
return;
}
teller[player] += money;
say ("Menaged to retrieve only %d Tellers, sir.", money);
}
SHAR_EOF
if test 3078 -ne "`wc -c retrieve.c`"
then
echo shar: error transmitting retrieve.c '(should have been 3078 characters)'
fi
echo shar: extracting savegame.c '(6284 characters)'
cat << \SHAR_EOF > savegame.c
/*
* %W% (mrdch&amnnon) %G%
*/
# include "header"
# include <signal.h>
# include <pwd.h>
extern char *sys_errlist[];
char errmsg[511];
extern errno;
movedir (saver)
char *saver;
{
struct passwd *p;
struct passwd *getpwnam ();
p = getpwnam (saver);
if (p == 0)
return;
else
if (chdir (p -> pw_dir) != -1)
return;
else
return;
}
# include "table.h"
# define TABSIZ 100
# define K 1024
int SWITCH_FLAG;
char version[80] = "Galaxy: version 1 6/9/84";
/*
* A few helpfull hints about galaxy's save file structure:
* The save file is made of three parts:
* 1. Galaxy version.
* 2. The program break.
* 3. global information.
*
* save should read the version, and compare it to the current.
* if they don't match, save must abort.
* after reading the program break, it should be re-set using
* brk(1).
* Now, save is prepared to read back all global data.
*/
char *
save (f)
char *f;
{
extern end;
extern edata;
extern etext;
char *sbrk ();
char *sbrk0;
int savef;
int nwrite;
char *realetext;
umask (0);
realetext = (char *) & etext;
realetext = (char *) ((int) (realetext + K - 1) & ~(K - 1));
savef = creat (f, 0600);
if (savef == -1) {
(void) sprintf(errmsg, "%s: %s", f, sys_errlist[errno]);
return(errmsg);
}
sbrk0 = sbrk (0);
enc_write (savef, version, 80);
if (enc_write (savef, (char *) & sbrk0, sizeof (sbrk0)) != sizeof (sbrk0)) {
(void) close (savef);
unlink (f);
return ("read error");
}
nwrite = (int) sbrk0 - (int) realetext;
if (enc_write (savef, realetext, nwrite) != nwrite) {
(void) close (savef);
unlink (f);
return ("read error");
}
(void) close (savef);
return (0);
}
char *
restor (f)
char *f;
{
extern etext;
extern edata;
extern end;
int savef;
char *brk ();
char *sbrk0;
int nread;
char *realetext;
char vers[81];
realetext = (char *) & etext;
realetext = (char *) ((int) (realetext + K - 1) & ~(K - 1));
savef = open (f, 0);
if (savef == -1) {
(void) sprintf(errmsg, "%s: %s", f, sys_errlist[errno]);
return(errmsg);
}
enc_read (savef, vers, 80);
if (strcmp (vers, version) != 0) {
close (savef);
/* don't unlink here! */
return ("ill formated save file");
}
if (enc_read (savef, (char *) & sbrk0, sizeof (sbrk0)) != sizeof (sbrk0)) {
perror ("read sbrk0");
(void) close (savef);
return ("read error");
}
if (brk (sbrk0) == (char *) - 1) {
perror ("brk");
(void) close (savef);
return ("not enough memory");
}
nread = (int) sbrk0 - (int) realetext;
if (enc_read (savef, realetext, nread) != nread) {
perror ("read etext");
(void) close (savef);
return ("read error");
}
return (0);
}
enc_write (fd, buf, nwrite)
int fd,
nwrite;
char *buf;
{
char buf2[TABSIZ + 1];
char *cp;
char *bp = buf;
int i;
int nw = nwrite;
while (nwrite > 0) {
cp = buf2;
for (i = 0; i < TABSIZ && nwrite > 0; i++, nwrite--) {
*cp++ = crypt_tab[i] ^ *bp++;
}
if (write (fd, buf2, i) != i)
return (-1);
}
return (nw);
}
enc_read (fd, buf, nread)
int fd,
nread;
char *buf;
{
char buf2[TABSIZ + 1];
char *cp;
char *bp = buf;
int i;
int cc;
int nr = nread;
while (nread > 0) {
cp = buf2;
cc = read (fd, cp, nread > TABSIZ ? TABSIZ : nread);
if (cc != (nread > TABSIZ ? TABSIZ : nread))
return (nr - nread);
for (i = 0; i < TABSIZ && nread > 0; i++, nread--)
*bp++ = crypt_tab[i] ^ *cp++;
}
return (nr);
}
savegame (fn)
char *fn;
{
static char fn1[100];
char *c;
skipwhite (fn);
if (wants_save[player]) {
say ("save canceled");
wants_save[player] = 0;
return;
}
wants_save[player] = 1;
if (wants_save[!player])
goto saveit;
strcpy (fn1, fn);
dowrite_enemy ("Lets save the game, O.K ?", !player);
say ("Ok, saving when he agrees...");
if (player == 0)
movedir (ply0);
else
movedir (ply1);
return;
saveit:
if (nullstr (fn) && nullstr (fn1))
strcpy (fn, "galaxy.save");
if (nullstr (fn1))
strcpy (fn1, fn);
if (nullstr (fn))
strcpy (fn, fn1);
if (strcmp (fn, fn1) != 0) {
say ("Hey, he wants to save on \"%s\"!", fn1);
wants_save[0] = wants_save[1] = 0;
return;
}
wants_save[0] = wants_save[1] = 0;
c = save (fn);
if (c != 0)
say (c);
if (iswiz[1] || iswiz[2])
return;
endgame (-1);
}
restorgame (fn)
char *fn;
{
char *c;
static char fn1[100];
char pl[100];
skipwhite (fn);
if (wants_restor[player]) {
say ("restor canceled");
wants_restor[player] = 0;
return;
}
wants_restor[player] = 1;
if (wants_restor[!player])
goto restorit;
strcpy (fn1, fn);
dowrite_enemy ("Lets restor, O.K ?", !player);
if (player == 0)
movedir (ply0);
else
movedir (ply1);
return;
restorit:
if (nullstr (fn) && nullstr (fn1))
strcpy (fn, "galaxy.save");
if (nullstr (fn1))
strcpy (fn1, fn);
if (nullstr (fn))
strcpy (fn, fn1);
if (strcmp (fn, fn1) != 0) {
say ("Hey, he wants to restore on \"%s\"!", fn1);
wants_restor[0] = wants_restor[1] = 0;
return;
}
/*
* save player0's name.
*/
strcpy (pl, ply0);
c = restor (fn);
if (c != 0)
say (c);
/*
* This is the hard part. When restoring a game, the users
* may have switched terminals. in this case, we have to
* switch the terminals.
*/
if (strcmp (ply0, pl) == 0) /* it's ok. */
return;
/* else o o, switched */
SWITCH_FLAG = 1;
}
nullstr (s)
char *s;
{
return (*s == '\0');
}
SHAR_EOF
if test 6284 -ne "`wc -c savegame.c`"
then
echo shar: error transmitting savegame.c '(should have been 6284 characters)'
fi
# End of shell archive
exit 0MRDCH@TAURUS.BITNET (06/09/85)
From: Mordechai Chachamu <mrdch@taurus.BitNet>
Hello everybody!!!
Sorry about that. I have forgotten a file, and already found some
(minor) bugs in "install.sh". The file "differ" shows what should
be changed in it. The file "Gname" belongs to the ~galaxy/online
directory.
BTW. All the directories mentioned as the "proper" place for galaxy
files are BEFORE installing the game. They may be left there
for updates, of course.
mrdch
# This is a shell archive.
# Remove everything above and including the cut line.
# Then run the rest of the file through sh.
-----cut here-----cut here-----cut here-----cut here-----
#!/bin/sh
# shar: Shell Archiver
# Run the following text with /bin/sh to create:
# differ
# Gname
# This archive created: Sun Jun 9 01:04:03 1985
echo shar: extracting differ '(225 characters)'
cat << \SHAR_EOF > differ
40c40
< cd $SOURCES1; make all
---
> cd ../$SOURCES1; make all
60a61
> chmod 600 galaxy.scor
65c66
< cp $DOC/galaxy.doc /usr/doc/galaxy # document
---
> cp $DOC/Galaxy.doc /usr/doc/galaxy # document
SHAR_EOF
if test 225 -ne "`wc -c differ`"
then
echo shar: error transmitting differ '(should have been 225 characters)'
fi
echo shar: extracting Gname '(1339 characters)'
cat << \SHAR_EOF > Gname
***** ***** ### ##### @@@ @ @@@ @
******* ******* ### ####### @@@ @ @@@ @
* **** * **** ### # #### @@@ @ @@@ @
* *** * *** ### # ### @@@ @ @@@ @
* *** * *** ### # ### @@@ @ @@@ @
* *** * *** ### # ### @@@ @ @@@ @
* * *** ### # ### @@@@@@@ @@@ @
* * *** ### # ### @@@@@@@ @@@ @
* ****** ********* ### ######### @ @@@ @@@ @
* ****** ********* ### ######### @ @@@ @@@ @
* *** * *** ### # ### @ @@@ @@@
* *** * *** ### # ### @ @@@ @@@
******* * *** ######### # ### @ @@@ @@@
***** * *** ######### # ### @ @@@ @@@
A duel in space
by
Mordechai Chachamu and Amnnon Horowits
Written 1984-1985 at T.A.U. Israel
SHAR_EOF
if test 1339 -ne "`wc -c Gname`"
then
echo shar: error transmitting Gname '(should have been 1339 characters)'
fi
# End of shell archive
exit 0MRDCH@TAURUS.BITNET (06/09/85)
From: Mordechai Chachamu <mrdch@taurus.BitNet>
Hello everybody!!!
We are almost done. This is part #9 out of 10.
It contains yet some more of the source files for the game proper.
They should be placed in ~galaxy/src.
mrdch
# This is a shell archive.
# Remove everything above and including the cut line.
# Then run the rest of the file through sh.
-----cut here-----cut here-----cut here-----cut here-----
#!/bin/sh
# shar: Shell Archiver
# Run the following text with /bin/sh to create:
# score.h
# set_missle.c
# softclock.c
# table.h
# take_from.c
# term2init.c
# terminal.c
# trade.c
# typedefs.h
# This archive created: Sat Jun 8 13:05:52 1985
echo shar: extracting score.h '(436 characters)'
cat << \SHAR_EOF > score.h
/*
* %W% (mrdch&amnnon) %G%
*/
/*
* this file defines the score information structure.
*/
struct score /* score log structure */
{
char win[20] ; /* winner name */
char los[20] ; /* looser name */
int years ; /* game years played */
time_t played_at ; /* date played at */
} ;
SHAR_EOF
if test 436 -ne "`wc -c score.h`"
then
echo shar: error transmitting score.h '(should have been 436 characters)'
fi
echo shar: extracting set_missle.c '(1874 characters)'
cat << \SHAR_EOF > set_missle.c
/*
* %W% (mrdch&amnnon) %G%
*/
# include "header"
/*
* In order to set new missiles, several requirements have to be met.
* The planet on which it is to be build must have enough soldiers
* on it.
* The knowledge level on that planet has to be at least equal to the
* level of missiles to be build.
*/
set_missile (s)
char *s;
{
planet * pp;
int j,
factor,
nmissiles,
missile_type,
money;
pp = getpl (s); /* get planet id */
assert_player (pp); /* verify existence + owner */
skipwhite (s);
nmissiles = atoi (s); /* see how many missiles to build */
assert_negative (nmissiles);
if (nmissiles) { /* skip the no. chars */
skipnum (s); /* go to the missile type */
skipwhite (s);
}
else
nmissiles = 1; /* if none given, assume 1 */
if (*s < 'a')
*s += ('a' - 'A'); /* transform type to l.c. */
if ((*s < 'a') || (*s > 'a' + MAXSHIPS - 1)) {
say ("The type of missile is not clear, sir!!");
return;
}
missile_type = *s - 'a';
if (pp -> inventar.know < missile_type) {
say ("The knowledge there is insufficient, sir.");
return;
}
s++;
assert_end (s);
factor = 1;
j = missile_type;
while (j-- > 0)
factor *= 2; /* calculate money for X type missile. */
j = factor * NCREW ;
if (pp -> inventar.popul[FIGT] < j ) {
say ("But sir, no fighters there to carry out this work!!");
return;
}
money = factor * nmissiles * MISSILE_COST;
assert_money (money); /* see if he owns that much */
teller[player] -= money; /* take player's money */
pp -> missile[missile_type] += nmissiles;
say ("The missiles are ready. Prepare detection, sir!!");
}
SHAR_EOF
if test 1874 -ne "`wc -c set_missle.c`"
then
echo shar: error transmitting set_missle.c '(should have been 1874 characters)'
fi
echo shar: extracting softclock.c '(17034 characters)'
cat << \SHAR_EOF > softclock.c
/*
* %W% (mrdch&amnnon) %G%
*/
# include "header"
# define SOULS pp->inventar.popul /* shorter */
# define M_SOULS pp->to_take.popul /* shorter */
int month = 0;
int work_p[MAXPL][CLASES]; /* how many EFFECIVE people are */
extern int no_new_year;
/*
* This routine is called whenever a command finishes
* execution. If time past is longer then defined, or
* if explicitly asked for, a new year arrives.
*/
softclock (force)
int force;
{
static time_t todays_time = 0;
static time_t last_year;
if (no_new_year)
/* wizard asked that TIME will freeze */
return;
/* This is the first time we call soft clock. */
if (todays_time == 0) {
(void) time (&todays_time);
last_year = todays_time;
return;
}
(void) time (&todays_time);
if ( force == 2 ) { /* We took a break! Restore time */
last_year = todays_time - (time_t) ((float) month * (float) YEARLENGTH/100.);
return;
}
if (last_year + YEARLENGTH <= todays_time || force) {
last_year = todays_time;
newyear ();
}
month = (todays_time - last_year) * 100 / YEARLENGTH;
}
/*
* A NEW YEAR is defined as one of the following situations :
* 1- The allocated time had passed.
* 2- When the TWO players have agreed to it.
*/
int ncitizens[3],
npopul[3];
static int plan_own[MAXPL];
newyear () {
int i,
j;
planet * pp;
dowrite_enemy ("Happy new year, dear sir.", 0);
dowrite_enemy ("Happy new year, dear sir.", 1);
/* only in the FIRST year */
if (year == 0)
for (i = 0; i < MAXPL; i++) {
pp = &pl[i];
plan_own[i] = pl[i].whos;
for (j = 0; j < CLASES; j++)
work_p[i][j] = SOULS[j];
}
year++; /* this is a NEW year */
/* update EFFECTIVE no of people if planet changed hands */
for (i = 0; i < MAXPL; i++) {
pp = &pl[i];
for (j = 0; j < CLASES; j++) {
if (plan_own[i] != pl[i].whos)
work_p[i][j] = 0;
/* update EFFECTIVE no of people if less then before. */
if (SOULS[j] < work_p[i][j])
work_p[i][j] = SOULS[j];
}
}
for (i = 0; i < MAXPL; i++) {
pp = &pl[i];
/* see if any active alm was left */
if (pl[i].alms)
check_alm (i, pp);
/* raise the popul. of citizens */
if (work_p[i][CITI])
inc_popul (i, pp);
/* see if any knwledge gained */
if (work_p[i][SCIE])
check_know (i);
/* see if mining was done */
if (work_p[i][MINE] || work_p[i][SLAV])
check_mining (i);
/* see if building is in progress */
if (pl[i].to_build[NSHIPS])
check_build (i);
/* see to it that detection devices loose effectiveness */
if (pl[i].detect)
reduce_detect (pp);
/* see if it is espionaged. */
check_esp (pp);
}
for (i = 0; i < MAXPL; i++)
plan_own[i] = pl[i].whos;
for (j = 0; j < 2; j++) {
npopul[j] = count_popul (j);
ncitizens[j] = count_citi (j);
teller[j] += ncitizens[j];
if (trade[j])
do_trade (j); /* add the money for trade */
check_food (j); /* see if enough food was given */
clr_svqt (j); /* clear all two players flags */
}
/* update the population to the new situation */
for (i = 0; i < MAXPL; i++) {
pp = &pl[i];
for (j = 0; j < CLASES; j++)
work_p[i][j] = SOULS[j];
}
}
/* count the effective citizenes */
count_citi (j) {
int i,
nciti = 0;
for (i = 0; i < MAXPL; i++)
if (pl[i].whos == j)
nciti += work_p[i][CITI];
return (nciti);
}
/* clear save and quit flags */
clr_svqt (j) {
wants_quit[j] = 0;
wants_save[j] = 0;
wants_restor[j] = 0;
wants_newy[j] = 0;
}
/* increment the citizens population */
inc_popul (i, pp)
planet * pp;
{
double d;
d = (double) work_p[i][CITI];
d *= (PERC_POPUL) / 100.;
SOULS[CITI] += (int) d;
}
/*
* Chek for alm presence. If found and the the flag for this
* planet is 0- raise it to 1 to indicate that it was just
* now installed. If it is 1- destroy whatever is found there.
* If there is none- put 0 in the corresponding flag.
*/
check_alm (i, pp)
planet * pp;
{
static int alm_flg[MAXPL]; /* flags to indicate alm presence */
int j;
if (year == 1)
for (j = 0; j < MAXPL; j++)
alm_flg[j] = 0;
if (pl[i].alms) {
if (!alm_flg[i])
alm_flg[i]++;
else {
for (j = 0; j < CLASES; j++) {
SOULS[j] = 0;
M_SOULS[j] = 0;
work_p[i][j] = 0;
}
}
}
else
alm_flg[i] = 0;
}
/* reduce the effectiveness of detection devices */
reduce_detect (pp)
planet * pp;
{
pp -> detect = pp -> detect * (100 - REDUCE_RATE) / 100;
}
/* update the mining materials in the given planet */
check_mining (i)
int i;
{
static int some_metal[MAXPL];/* accumulates metal */
int nminers;
nminers = work_p[i][MINE] + work_p[i][SLAV];
while (nminers >= MINING_FACTOR) {
pl[i].inventar.metals++;
nminers -= MINING_FACTOR;
}
if (nminers)
some_metal[i] += nminers;
if (some_metal[i] >= MINING_FACTOR) {
some_metal[i] -= MINING_FACTOR;
pl[i].inventar.metals++;
}
}
/* see if building is in progress */
check_build (i)
int i;
{
char s[450],
s1[450];
int factor = 1,
nbuild = 0,
j = 0;
int shipcost;
int level = pl[i].to_build[LEVEL];
int nbuilders = work_p[i][BUIL];
s[0] = s1[0] = '\0' ;
while (level > j++)
factor *= 2;
shipcost = factor * SHIP_COST;
/* BEFORE starting to build- is there still knowledge ?? */
if (pl[i].inventar.know < level) {
(void) sprintf (s, "The knowledge at %s is not enough, sir.", pl[i].pid);
dowrite_enemy (s, pl[i].whos);
return;
}
while (pl[i].to_build[NSHIPS]) {
if (!(pl[i].inventar.metals >= factor)) {
(void) sprintf (s, "The metal in %s was not enough to complete the work, sir.", pl[i].pid);
break;
}
if (!(nbuilders >= shipcost)) {
(void) sprintf (s, "There were not enough builders in %s to complete the work, sir.", pl[i].pid);
break;
}
if (!(pl[i].to_build[BUILD_MONEY] >= shipcost)) {
(void) sprintf (s, "We run out of building ships money in %s, sir.", pl[i].pid);
break;
}
pl[i].inventar.metals -= factor;
nbuilders -= shipcost;
pl[i].to_build[BUILD_MONEY] -= shipcost;
pl[i].to_build[NSHIPS]--;
pl[i].ships[level]++;
nbuild++;
}
if (nbuild) {
(void) sprintf (s1, "At %s %d %c-type ships were build !!!", pl[i].pid, nbuild, 'A' + level);
dowrite_enemy (s1, pl[i].whos);
}
if (*s)
dowrite_enemy (s, pl[i].whos);
}
/* see if any knowledge gained */
check_know (i)
int i;
{
char s[100];
int factor = 1,
nscience = 0,
j = 0;
int know_cost;
int level = pl[i].inventar.know + 1;
static int know_points[MAXPL];
if (pl[i].inventar.know == MAXSHIPS -1 ) {
(void) sprintf (s, "Sir!!! Your scintists at %s are unable to advance further." , pl[i].pid) ;
dowrite_enemy (s, pl[i].whos) ;
return;
}
if (plan_own[i] != pl[i].whos) {
know_points[i] = 0;
}
while (level > ++j)
factor *= 2;
know_cost = factor * KNOW_FACTOR;
nscience = work_p[i][SCIE];
know_points[i] += nscience;
if (know_points[i] >= know_cost) {
pl[i].inventar.know++;
(void) sprintf (s, "Sir!!! Your scientists at %s have gained %c-level knowledge!!!", pl[i].pid, level + 'A');
dowrite_enemy (s, pl[i].whos);
know_points[i] = 0;
}
}
do_trade (j) /* add the results of last year trade */
int j;
{
int i,
temp;
char s[100];
double perc ;
for ( i = 0 , temp = 0 ; i < MAXPL ; i++)
if (pl[i].whos == j)
temp++ ; /* count the planets he controls */
if ( (perc = (temp - 33) / 2) < 0 )
perc = 0 ;
perc += PERC_TRADE;
perc += rand () % 5;
temp = (int) ((double) trade[j] * (100.+ perc) / 100.);
(void) sprintf (s, "We had %d trade profit last year, sir.",
temp - trade[j]);
dowrite_enemy (s, j);
teller[j] += temp;
trade[j] = 0;
}
/* check if enough food was provided */
check_food (j)
int j;
{
char s[100];
int i,
k,
kind;
planet * pp;
npopul[j] -= ncitizens[j];
k = food[j] * FEED_RATIO; /* check how much was given */
if (k >= npopul[j]) {
food[j] -= npopul[j] / FEED_RATIO;
k -= npopul[j];
if (k < npopul[j]) { /* next time they might die */
(void) sprintf (s, "Sir, we are in danger that %d of our people will starve to death!!!", npopul[j] - k);
dowrite_enemy (s, j);
}
return;
}
food[j] = 0;
npopul[j] -= k; /* that many we'll have to kill */
(void) sprintf (s, "%d people died from lack of food, sir.", npopul[j]);
dowrite_enemy (s, j);
for (kind = SLAV; kind > CITI; kind--) {
for (i = MAXPL - 1; i >= 0; --i) {
pp = &pl[i];
if (pp -> whos == j) {
if (npopul[j] - SOULS[kind] > 0) {
npopul[j] -= SOULS[kind];
SOULS[kind] = 0;
}
else {
SOULS[kind] -= npopul[j];
npopul[j] = 0;
}
if (npopul[j] - M_SOULS[kind] > 0) {
npopul[j] -= M_SOULS[kind];
M_SOULS[kind] = 0;
}
else {
SOULS[kind] -= npopul[j];
npopul[j] = 0;
}
}
}
}
if (npopul[j]) { /* still to kill */
kind = FIGT;
for (i = MAXPL; i >= 0; --i) {
pp = &pl[i];
if (pp -> whos == j) {
if (npopul[j] - SOULS[kind] > 0) {
npopul[j] -= SOULS[kind];
SOULS[kind] = 0;
}
else {
SOULS[kind] -= npopul[j];
npopul[j] = 0;
}
if (npopul[j] - M_SOULS[kind] > 0) {
npopul[j] -= M_SOULS[kind];
M_SOULS[kind] = 0;
}
else {
SOULS[kind] -= npopul[j];
npopul[j] = 0;
}
}
}
}
}
int last_esp_cost;
check_esp (pp)
planet * pp;
{
int etype;
if (pp -> whos == 2) /* uninhabited planet! */
return;
/* check all types of espionage */
for (etype = 0; etype < ESPTYP; etype++)
do_check_esp (pp, etype);
}
do_check_esp (pp, etype)
planet * pp;
{
int cpl = pp -> whos;
int tl1;
int elvl;
tl1 = pp -> espion[!cpl][etype][0];
/* if no money was invested in this kind by the enemy */
if (tl1 == 0)
return;
/* if the investment wasn't succesfull, do not check further */
if (!gave_info (pp, etype, tl1))
return;
/* for each consecutive level, check if information was obtained */
for (elvl = 1; elvl < ESPSIZ; elvl++) {
if (!counter_esp (pp, etype, elvl - 1, cpl))
return;
if (!counter_esp (pp, etype, elvl, !cpl))
return;
}
}
counter_esp (pp, etype, lvl, ply)
planet * pp;
{
char s[100];
/* that's how much was invested in this counter espionage */
int tl = pp -> espion[ply][etype][lvl];
/* no money, no information */
if (tl == 0)
return (0);
/* reduce the money required by half */
last_esp_cost /= 2;
/* not enough money, no information */
if (tl < last_esp_cost)
return (0);
/* in counter espionage, only USED money are lost */
pp -> espion[ply][etype][lvl] -= last_esp_cost;
(void) sprintf (s,
"Level %d information at planet's %s obtained by the enemy.\r\n"
,lvl, inftypes[etype]);
/* finally give the information */
spy_msg (s, ply, pp, lvl);
return (1);
}
/*
* the main espionage routine, it only check for first
* level espionage.
*/
gave_info (pp, etype, tlrs)
planet * pp;
{
int secur = pp -> secur;
/* the sum invested */
last_esp_cost = tlrs;
/* the black_out factor, if present */
last_esp_cost -= pp -> secur;
/* ALL the money is lost */
pp -> espion[!pp -> whos][etype][0] = 0;
/* reduce black out */
secur -= tlrs;
/* add the SPECIFIC cost */
secur += espcost[etype];
/*
* Each planet has an MIN_ESP initial blackout
* without investing any money in blackout!
*/
if (secur < 0) {
/*
* We have to give him the info since the
* blackout is less then the money invested in
* espionage.
*/
pp -> secur = 0;
give_info (pp, etype);
return (1); /* info given */
}
pp -> secur -= tlrs;
if (pp -> secur < 0)
pp -> secur = 0;
pp -> espion[!pp -> whos][etype][0] = 0;
return (0);
}
/*
* when deserving it, give the information required.
*/
give_info (pp, esptype)
planet * pp;
{
char *ptos ();
char *do_esp_pop ();
char *do_esp_force ();
char *do_esp_missile ();
char s[100];
switch (esptype) {
case ESPKIND:
(void) sprintf (s, "Category: %s\r\n", ptos (pp));
break;
case ESPPOP:
(void) sprintf (s, "Popul: %s\r\n", do_esp_pop (pp));
break;
case ESPKNOW:
(void) sprintf (s, "Knowledge level is %c\r\n", pp -> inventar.know + 'A');
break;
case ESPMTL:
(void) sprintf (s, "Metal: %d\r\n", pp -> inventar.metals);
break;
case ESPSHIP:
(void) sprintf (s, "Force: %s\r\n", do_esp_force (pp));
break;
case ESPALM:
(void) sprintf (s, "ALM installed: %d\r\n", pp -> alms);
break;
case ESPMSL:
(void) sprintf (s, "Missile: %s\r\n", do_esp_missile (pp));
break;
}
spy_msg (s, !pp -> whos, pp, 0);
}
/* returns a string with the kind of planet information */
char *
ptos (pp)
planet * pp;
{
char *rindex ();
char *x;
static char s[100];
(void) strcpy (s, "");
if (SOULS[FIGT])
(void) strcat (s, "military/");
if (SOULS[CITI])
(void) strcat (s, "agricultural/");
if (SOULS[MINE])
(void) strcat (s, "mining/");
if (SOULS[BUIL])
(void) strcat (s, "industrial/");
if (SOULS[SCIE])
(void) strcat (s, "scientific/");
x = rindex (s, '/');
if (x != 0)
*x = '\0';
if (strcmp (s, "") == 0)
(void) strcpy (s, "none");
return (s);
}
char *people[] = {
"fight", "citizen", "scien", "build",
"miner", "slave", 0
};
/* returns a string with the population information */
char *
do_esp_pop (pp)
planet * pp;
{
char *rindex ();
char *x;
int i,
j;
static char s[100];
static char s1[100];
(void) strcpy (s, "");
for (i = 0; i < CLASES; i++) {
j = pp -> inventar.popul[i];
if (j) {
(void) sprintf (s1, "%d %s/", j, people[i]);
(void) strcat (s, s1);
}
}
x = rindex (s, '/');
if (x != 0)
*x = '\0';
if (strcmp (s, "") == 0)
(void) strcpy (s, "no population");
return (s);
}
/* returns a string with the force information */
char *
do_esp_force (pp)
planet * pp;
{
int i,
j;
static char s[100];
static char s1[100];
(void) strcpy (s, "");
for (i = 0; i < MAXSHIPS; i++) {
j = pp -> ships[i];
if (j) {
(void) sprintf (s1, "%c-%d ", i + 'A', j);
(void) strcat (s, s1);
}
}
if (strcmp (s, "") == 0)
(void) strcpy (s, "no forces");
return (s);
}
/* returns a string with the missile information */
char *
do_esp_missile (pp)
planet * pp;
{
int i,
j;
static char s[100];
static char s1[100];
(void) strcpy (s, "");
for (i = 0; i < MAXSHIPS; i++) {
j = pp -> missile[i];
if (j) {
(void) sprintf (s1, "%c-%d ", i + 'A', j);
(void) strcat (s, s1);
}
}
if (strcmp (s, "") == 0)
(void) strcpy (s, "no missiles");
return (s);
}
SHAR_EOF
if test 17034 -ne "`wc -c softclock.c`"
then
echo shar: error transmitting softclock.c '(should have been 17034 characters)'
fi
echo shar: extracting table.h '(953 characters)'
cat << \SHAR_EOF > table.h
/*
* %W% (mrdch&amnnon) %G%
*/
/* Table seed : 1858 */
char crypt_tab[] = {
83,
144,
137,
142,
175,
188,
69,
154,
203,
168,
193,
102,
167,
84,
253,
242,
67,
192,
249,
62,
159,
236,
181,
74,
187,
216,
49,
22,
151,
132,
109,
162,
51,
240,
105,
238,
143,
28,
37,
250,
171,
8,
161,
198,
135,
180,
221,
82,
35,
32,
217,
158,
127,
76,
149,
170,
155,
56,
17,
118,
119,
228,
77,
2,
19,
80,
73,
78,
111,
124,
5,
90,
139,
104,
129,
38,
103,
20,
189,
178,
3,
128,
185,
254,
95,
172,
117,
10,
123,
152,
241,
214,
87,
68,
45,
98,
243,
176,
41,
174,
-1
};
SHAR_EOF
if test 953 -ne "`wc -c table.h`"
then
echo shar: error transmitting table.h '(should have been 953 characters)'
fi
echo shar: extracting take_from.c '(1781 characters)'
cat << \SHAR_EOF > take_from.c
/*
* %W% (mrdch&amnnon) %G%
*/
# include "header"
takefrom (s)
char *s;
{
planet * pp;
int i = 0,
spl;
char cc;
pp = getpl (s);
assert_player (pp);
skipwhite (s);
if (*s == 'k') { /* in case of knowledge, no parameter
needed */
if (pp -> inventar.know) {/* only if above A type */
pp -> to_take.know = pp -> inventar.know;
pp -> inventar.know = 0;
/* DONT leave the knowledge there */
say ("%c-type knowledge ready to be moved, sir !!!",
'A' + pp -> to_take.know);
return;
}
say ("Planet blessed with little knowledge, sir.");
return;
}
i = atoi (s); /* in any other case- numeric parameter
needed */
assert_number (i);
skipword (s);
cc = *s++;
assert_end (s);
/*
* for each of the following:
* first check if enough available to be taken.
* if not- print error massege and exit ;
* if so- make the transportation to the wharehouse
*/
if (cc == 't') {
if (pp -> inventar.metals < i) {
say ("But you don't have that much metal there !!");
return;
}
pp -> inventar.metals -= i;
pp -> to_take.metals += i;
say ("%d A-type material ready to move, sir !!", i);
return;
}
spl = which_class (cc);
assert_occup (spl);
if (pp -> inventar.popul[spl] < i) {
say ("But sir, you don't have that much %s there !!", ocup_name[spl]);
return;
}
pp -> inventar.popul[spl] -= i;
pp -> to_take.popul[spl] += i;
say ("%d %s are ready to move, sir !!", i, ocup_name[spl]);
return;
}
SHAR_EOF
if test 1781 -ne "`wc -c take_from.c`"
then
echo shar: error transmitting take_from.c '(should have been 1781 characters)'
fi
echo shar: extracting term2init.c '(6335 characters)'
cat << \SHAR_EOF > term2init.c
/*
* %W% (mrdch&amnnon) %G%
*/
# include "header"
# include <utmp.h>
# include <sys/stat.h>
# include <signal.h>
# define PATHSIZ 150
# define MAXDUPS 100
# define TIMEOUT 120
# define fd1 chand[0]
# define fd2 chand[1]
int nulluser;
char ply0[100],
*ply1;
term2init ()
{
char *t1[PATHSIZ],
*t2;
char *getuser ();
char *getlogin ();
ply1 = getlogin ();
if (ply1 == 0) {
fprintf (stderr, "Don't know who you are.\n");
exit (1);
}
for (;;) {
printf ("Who would you like to play with ? ");
gets (ply0);
if (*ply0 != '\0')
break;
}
iswiz[0] = iswizard (ply0);
iswiz[1] = iswizard (ply1);
if (strcmp (ply0, "-null") == 0)
/* enter only if change_player command is to be
reserved for wizards only. */
/*
if(!iswiz[1])
{
fprintf(stderr, "You are not a wizard.\n") ;
exit(1) ;
} else
*/
nulluser = 1;
if (nulluser)
(void) strcpy (t1, "/dev/null");
else
(void) sprintf (t1, "/dev/%s", getuser (ply0));
t2 = "/dev/tty";
if (strcmp (t1, t2) == 0) {
fprintf (stderr, "You can't expect to play with yourself!\n");
exit (1);
}
page (t1, ply0, ply1);
printf ("Response....\n\r");
do2term (t1, t2);
geterm (t1);
}
geterm (t)
char *t;
{
char *s,
c,
termbuf[100],
pscmd[100];
FILE * psfp, *popen ();
if (strcmp (t, "/dev/null") == 0) {
char *getenv () ;
fillterm (getenv ("TERM"), &ttycs[0]);
return;
}
if (!strcmp (t, "/dev/console"))
s = "co";
else /* /dev/ttyxx */
if (strncmp (t, "/dev/tty", 8) || strlen (t) != 10) {
fprintf (stderr, "unrecognized tty name %s\n", t);
exit (1);
}
else
s = &t[8];
(void) sprintf (pscmd, "ps wwet%s", s);
psfp = popen (pscmd, "r");
if (psfp == NULL) {
fprintf (stderr, "can't execute %s\n", pscmd);
(void) kill (getpid (), 9);
}
if (strfind (psfp, "okgalaxy", 0)) {
fprintf (stderr, "can't find okgalaxy in %s\n", pscmd);
(void) kill (getpid (), 9);
}
if (strfind (psfp, " TERM=", 1)) {
fprintf (stderr, "can't find TERM type\n");
(void) kill (getpid (), 9);
}
s = termbuf;
while ((c = getc (psfp)) != ' ' && c != '\n')
if (c == EOF) {
fprintf (stderr, "ps output format error\n");
(void) kill (getpid (), 9);
}
else
*s++ = c;
*s = '\0';
while (getc (psfp) != EOF);
(void) fclose (psfp);
fillterm (termbuf, &ttycs[0]);
}
strfind (Xfp, s, Xflag)
FILE * Xfp;
char *s;
{
char *p,
*e,
c;
p = s;
for (;;) {
if ((c = getc (Xfp)) == EOF || c == '\n' && Xflag)
return - 1;
if (c == *p) {
if (*++p == '\0')
return 0;
}
else
if (p != s) {
for (e = s; e < p; e++)
if (c == s[p - e] && !strncmp (e, s, p - e))
break;
if (e < p || c == *s)
p = &s[p - e + 1];
else
p = s;
}
}
}
struct utmp dups[MAXDUPS];
int lastdup = 0;
char *
getuser (s)
char *s;
{
static int utmpf = -1;
static struct utmp utmp;
char p[100];
int i;
lastdup = 0;
if (utmpf == -1)
utmpf = open ("/etc/utmp", 0);
else
(void) lseek (utmpf, 0L, 0);
if (utmpf == -1)
return (0);
while (read (utmpf, (char *) & utmp, sizeof utmp) == sizeof utmp)
if (strncmp (utmp.ut_name, s, 8) == 0)
dups[lastdup++] = utmp;
if (lastdup == 1)
return (dups[0].ut_line);
if (lastdup == 0) {
writes (2, "not logged in.\n\r");
exit (1);
}
printf ("%s logged in more then once.\n", s);
for (i = 0; i < lastdup; i++) {
printf ("%s on %s ? ", s, dups[i].ut_line);
gets (p);
if (p[0] == 'y')
return (dups[i].ut_line);
if (p[0] == 'q')
return (0);
}
writes (2, "no more ttys\n\r");
exit (1);
/* NOTREACHED */
}
int xpipe[2];
int chand[MAXCHAN];
do2term (t1, t2)
char *t1,
*t2;
{
fd1 = open (t1, 2);
fd2 = open (t2, 2);
if (fd1 == -1)
pout (t1);
if (fd2 == -1)
pout (t2);
if (pipe (xpipe) == -1)
pout ("pipe");
(void) dochan (fd1);
(void) dochan (fd2);
}
pout (s)
char *s;
{
perror (s);
exit (1);
}
dochan (fd)
int fd;
{
static lastchan = 0;
char s[50];
(void) sprintf (s, "%d", lastchan++);
switch (fork ()) {
case -1:
pout ("fork");
default: /* parent */
return (lastchan - 1);
case 0:
if (dup2 (fd, 0) == -1)
pout ("dup2 1");
if (dup2 (xpipe[1], 1) == -1)
pout ("dup2 2");
execl (LOCAL, "local", s, 0);
pout ("local");
}
/* NOTREACHED */
}
readc (x)
chan * x;
{
return (read (xpipe[0], (char *) x, sizeof (*x)));
}
page (s, nm, iam)
char *nm;
char *s;
char *iam;
{
int onalrm ();
if (nulluser)
return;
if (!okterm (s)) {
fprintf (stderr,
"%s's terminal,%s, mode is bad for galaxy\n",
nm, s);
exit (1);
}
if (access (s, 2) == -1) {
fprintf (stderr, "Can't write %s.\n", nm);
exit (1);
}
if (vfork () == 0) {
execl (PAGER, "pager", s,
iam, 0);
exit (1);
}
writes (1, "Please wait.....\n");
(void) alarm (TIMEOUT);
signal (SIGALRM, onalrm);
printf ("Sleeping on %s\n", s);
while (okterm (s));
signal (SIGALRM, SIG_IGN);
return;
}
okterm (s)
char *s;
{
struct stat stbuf;
(void) stat (s, &stbuf);
if (stbuf.st_mode & S_IREAD >> 3 || stbuf.st_mode & S_IREAD >> 6)
return (0);
else
return (1);
}
onalrm () {
writes (1, "Timeout.\r\n");
exit (1);
}
SHAR_EOF
if test 6335 -ne "`wc -c term2init.c`"
then
echo shar: error transmitting term2init.c '(should have been 6335 characters)'
fi
echo shar: extracting terminal.c '(5195 characters)'
cat << \SHAR_EOF > terminal.c
/*
* %W% (mrdch&amnnon) %G%
*/
# include "header"
/*
* This file contains all termcap-using functions. The game uses
* these function in order to move the cursor, enter standout mode,
* etc.
*/
FILE * tty;
struct terminal ttycs[2];
struct terminal *ttyc;
char capbuf[1024];
char *xxxx = capbuf;
char **cbuf = &xxxx;
/*
* This function tries to fill the buffer with the termcap
* entry of the player's terminal.
*/
fillterm (s, t)
char *s;
struct terminal *t;
{
char *SO,
*SE,
*CM,
*CE,
*CL,
*FL,
*FB,
*IS,
*KS,
*TE,
*KE,
*TI;
int SG;
char *buf;
char *malloc ();
char *tgetstr ();
buf = malloc (1024);
if (buf == 0) {
writes (2, "OUT OF MEMORY IN FILLTERM.\r\n");
exit (126);
}
t -> t_name = s;
if (tgetent (buf, s) != 1) {
fprintf (stderr, "Sorry: Cannot get termcap entry for %s\n",
s);
exit (-1);
}
SO = tgetstr ("so", cbuf);
SE = tgetstr ("se", cbuf);
CM = tgetstr ("cm", cbuf);
CE = tgetstr ("ce", cbuf);
CL = tgetstr ("cl", cbuf);
FL = tgetstr ("fl", cbuf);
FB = tgetstr ("fb", cbuf);
IS = tgetstr ("is", cbuf);
KS = tgetstr ("ks", cbuf);
TE = tgetstr ("te", cbuf);
KE = tgetstr ("ke", cbuf);
TI = tgetstr ("ti", cbuf);
SG = tgetnum ("sg");
if (SG == -1)
SG = 0;
if (!CM || !SO || !SE || !CL) {
fprintf (stderr, "The %s terminal lacks basic capabilities. Sorry.\n", s) ;
exit(1) ;
}
t -> t_so = SO;
t -> t_se = SE;
t -> t_cm = CM;
t -> t_ce = CE;
t -> t_cl = CL;
t -> t_fl = FL;
t -> t_fb = FB;
t -> t_sg = SG;
t -> t_is = IS;
t -> t_ks = KS;
t -> t_te = TE;
t -> t_ke = KE;
t -> t_ti = TI;
free(buf);
}
/* put a single char to a given terminal */
int xputchar (c)
int c;
{
putc (c, tty);
}
/* The initialization for the terminal */
cap_set (t)
struct terminal *t;
{
tputs (t -> t_is, 1, xputchar);
tputs (t -> t_ks, 1, xputchar);
tputs (t -> t_ke, 1, xputchar);
}
/* put the cursor in a x,y position on the screen */
pos (x, y)
int x,
y;
{
/*
* We use only CM. No CM means no galaxy....
*/
char *s;
char *tgoto ();
s = tgoto (ttyc -> t_cm, y, x);
tputs (s, 1, xputchar);
}
/* output a string, encountering it with end of standout */
se (x, y, s)
char *s;
{
pos (x, y);
tputs (ttyc -> t_se, 1, xputchar);
print (s);
tputs (ttyc -> t_se, 1, xputchar);
}
/* output a string, in the standout mode */
so (x, y, s)
char *s;
{
pos (x, y);
tputs (ttyc -> t_so, 1, xputchar);
print (s);
tputs (ttyc -> t_se, 1, xputchar);
}
/* clear the whole screen */
clear () {
pos (1, 1);
tputs (ttyc -> t_cl, 1, xputchar);
}
/*
* If the termcap entry was suitably modified, and the terminal
* has more than one display page, this game benefits greatly
* from such cases.
* In short, `fl' entry contains the string that will cause the
* terminal to "flip" forward , and `fb' entry holds the string
* that will flip it backward.
* Whenever any of this are missing, the "flip" is simulated
* simply by clearing the screen, and writing the relevant
* information on it.
*/
flip () {
if (ttyc -> t_fl != 0) {
if (ttyc -> t_curpage == 0) {
tputs (ttyc -> t_fl, 1, xputchar);
ttyc -> t_curpage = 1;
}
else {
tputs (ttyc -> t_fb, 1, xputchar);
ttyc -> t_curpage = 0;
}
return;
}
else {
if (ttyc -> t_curpage == 0)
ttyc -> t_curpage = 1;
else {
init_dis ();
ttyc -> t_curpage = 0;
}
}
}
/* clear to end of line from current cursor position */
ceol () {
tputs (ttyc -> t_ce, 1, xputchar);
}
/* clear to end of line from given cursor position */
cleol (x, y) {
pos (x, y);
tputs (ttyc -> t_ce, 1, xputchar);
}
writes (fd, s)
char *s;
{
(void) write (fd, s, strlen (s));
}
/*
* this function brings the cursor to the current planet.
* It will restor the video attribute to NORMAL .
* Care must be taken to consider the effect of video attribute
* that takes a place on the screen (tvi 925...) and also
* that if not ended properly, it might extend to the end-of-line
* or to the end-of-page.
*/
curse_map (pp)
planet * pp;
{
int x = pp -> coord[0];
int y = pp -> coord[1] + 1;
draw_map (pp);
pos (x, y);
}
draw_map (pp)
planet * pp;
{
char s[10];
int x = pp -> coord[0];
int y = pp -> coord[1] + 1;
s[0] = pp -> d_symbol[player];
s[1] = 0;
se (x, y - ttyc -> t_sg, s);
}
/*
* In this case we LEAVE the map, and go with the cursor to the
* Command line. Thus we leave a mark at the current planet
* so reference to it will be easy.
*/
curse_com (pp)
planet * pp;
{
char s[10];
int x = pp -> coord[0];
int y = pp -> coord[1] + 1;
s[0] = pp -> d_symbol[player];
s[1] = 0;
so (x, y - ttyc -> t_sg, s);
}
SHAR_EOF
if test 5195 -ne "`wc -c terminal.c`"
then
echo shar: error transmitting terminal.c '(should have been 5195 characters)'
fi
echo shar: extracting trade.c '(503 characters)'
cat << \SHAR_EOF > trade.c
/*
* %W% (mrdch&amnnon) %G%
*/
# include "header"
trading (s)
char *s;
{
int i;
i = atoi (s); /* take the amount specified */
assert_money (i); /* see if legal and available */
skipword (s); /* skip over it */
assert_end (s); /* see if it ends well */
say ("I pray for a good trading year, my lord.");
teller[player] -= i; /* take his money */
trade[player] += i; /* and invest it in trade */
}
SHAR_EOF
if test 503 -ne "`wc -c trade.c`"
then
echo shar: error transmitting trade.c '(should have been 503 characters)'
fi
echo shar: extracting typedefs.h '(3194 characters)'
cat << \SHAR_EOF > typedefs.h
/*
* %W% (mrdch&amnnon) %G%
*/
/*
* this include file describes the differnet types used
* by the game.
*/
typedef struct _movable movable;
typedef struct _info info;
typedef struct _planet planet;
typedef struct _chan chan;
struct _info {
int owner; /* who owns that massege */
int nmsg; /* the current massege no. */
char msg[MSGSIZ]; /* max chars in one massesge */
info * next; /* and here comes another one.. */
};
struct _movable { /* what can be taken planet */
int popul[CLASES]; /* population */
int metals; /* how much metal was digged */
int know; /* knowledge level on */
};
struct _planet { /* describe a planet */
char symbol; /* the planet original symbol */
char d_symbol[2]; /* the planet displayed symbol */
char pid[4]; /* planet id */
int coord[2]; /* planet's cooridinates */
planet * gate[10]; /* where can we go from it? */
int whos; /* who owns it */
movable inventar; /* what is actually there */
movable to_take; /* what ordered to be moved */
int secur; /* security - Black-Out */
int alms; /* how many alm's were left */
int paint; /* how much money for paint */
int detect; /* how much money to detect */
int to_build[3]; /* money level & no. to build */
info * reports; /* reportes gathered */
int ships[MAXSHIPS]; /* no. of ships on planet */
int missile[MAXSHIPS]; /* how many missiles are there */
int espion[2][ESPTYP][ESPSIZ];/* espionage */
};
/*
* the following structure is used to communicate between terminals.
* Since galaxy can't read both terminals, it reads a pipe. The pipe
* is written on by two local processes, one for each terminal.
* Each write on the pipe, writes this structure.
*/
struct _chan {
int ichan; /* terminal number */
char c; /* character */
};
struct terminal { /* terminal information */
char *t_name; /* terminal name */
char *t_ke; /* end keypad transmit */
char *t_so; /* begin standout mode */
char *t_se; /* end standout mode */
char *t_cm; /* cursor motion */
char *t_ce; /* clear to end of line */
char *t_ks; /* keypad transmit mode */
char *t_cl; /* clear screen */
char *t_fl; /* move to page 0 */
char *t_fb; /* move to page 1 */
char *t_is; /* initialisation string */
char *t_te; /* program begin use cm */
char *t_ti; /* program end using cm */
int t_sg; /* # spaces left by so */
int t_curpage; /* current page */
};
SHAR_EOF
if test 3194 -ne "`wc -c typedefs.h`"
then
echo shar: error transmitting typedefs.h '(should have been 3194 characters)'
fi
# End of shell archive
exit 0MRDCH@TAURUS.BITNET (06/09/85)
From: Mordechai Chachamu <mrdch@taurus.BitNet>
Hello everybody!!!
This is part #5 out of 10. The remaining parts, (including this one)
contain all the source files for the game proper. They should be placed
in ~galaxy/src.
mrdch
# This is a shell archive.
# Remove everything above and including the cut line.
# Then run the rest of the file through sh.
-----cut here-----cut here-----cut here-----cut here-----
#!/bin/sh
# shar: Shell Archiver
# Run the following text with /bin/sh to create:
# Makefile
# assign.c
# best_score.c
# blackout.c
# build.c
# constants.h
# detect_mv.c
# end_game.c
# feed_pop.c
# funcdef.h
# global.c
# global.h
# header
# This archive created: Sat Jun 8 12:55:14 1985
echo shar: extracting Makefile '(2103 characters)'
cat << \SHAR_EOF > Makefile
# Galaxy Makefile.
# SccsId %W% (mrdch&amnnon) %G%
#
LIBDIR = /usr/games/lib/galaxy
CFILES = assign.c blackout.c build.c detect_mv.c feed_pop.c \
global.c init_all.c kill_alm.c leave_at.c \
move_to.c no_detect.c over_stat.c parse.c planet_enq.c \
planet_inf.c planet_sit.c play.c put_alm.c \
retrieve.c softclock.c take_from.c term2init.c trade.c \
use_term.c wizard.c write.c end_game.c \
savegame.c terminal.c set_missle.c best_score.c
OFILES = assign.o blackout.o build.o detect_mv.o feed_pop.o \
global.o init_all.o kill_alm.o leave_at.o \
move_to.o no_detect.o over_stat.o parse.o planet_enq.o \
planet_inf.o planet_sit.o play.o put_alm.o \
retrieve.o softclock.o take_from.o term2init.o trade.o \
use_term.o wizard.o write.o end_game.o \
savegame.o terminal.o set_missle.o best_score.o
HEADERS = header constants.h funcdef.h global.h typedefs.h options.h \
score.h table.h
SOURCEDIR = .
LDFLAGS =
CC = /bin/cc
RM = /bin/rm
CTAGS = /usr/ucb/ctags
GET = /usr/bin/sccs get -s
PR = /bin/pr
LPR = /usr/bin/lpr
ECHO = /bin/echo
MV = /bin/mv
TAR = /bin/tar
all : galaxy
@${ECHO} Galaxy is up to date.
galaxy : ${OFILES}
${CC} ${LDFLAGS} ${OFILES} -ltermlib
@${MV} a.out galaxy
tags : ${CFILES} ${HEADERS}
${CTAGS} ${CFILES} ${HEADERS}
clean :
sccs info
${RM} -f ${OFILES}
lpr :
${PR} ${HEADERS} ${CFILES} | ${LPR}
${OFILES} : ${HEADERS}
.PRECIOUS: ${CFILES} ${HEADERS}
.DEFAULT: ${CFILES} ${HEADERS}
${GET} $@
install:
cp galaxy ${LIBDIR}
mv ${LIBDIR}/galaxy ${LIBDIR}/galaxy.out
chmod 700 ${LIBDIR}/galaxy.out ${LIBDIR}/okgalaxy
chmod 4111 ${LIBDIR}/galaxy.out ${LIBDIR}/okgalaxy
liblock:
chmod 700 ${LIBDIR}/galaxy.out ${LIBDIR}/okgalaxy
libok:
chmod 4111 ${LIBDIR}/galaxy.out ${LIBDIR}/okgalaxy
tar :
${TAR} cv ${SOURCEDIR}
backup :
${TAR} cv /users/guest/galaxy
SHAR_EOF
if test 2103 -ne "`wc -c Makefile`"
then
echo shar: error transmitting Makefile '(should have been 2103 characters)'
fi
echo shar: extracting assign.c '(1760 characters)'
cat << \SHAR_EOF > assign.c
/*
* %W% (mrdch&amnnon) %G%
*/
# include "header"
extern int work_p[MAXPL][CLASES];/* change actual working class */
assign (s)
char *s;
{
planet * pp;
int i,
focup,
socup;
char fc,
sc;
pp = getpl (s); /* identify planet */
assert_player (pp); /* justify planet & owner */
i = atoi (s); /* how many people are concerned */
assert_number (i); /* justify no. */
skipword (s); /* go to the first occupation */
fc = *s++; /* take the first char */
skipwhite (s); /* go to the second */
sc = *s++; /* take the second */
assert_end (s); /* see if end is clear */
if (fc == sc) {
say ("It will not change much, my lord !!");
return;
}
focup = which_class (fc);
assert_occup (focup); /* does it exist?? */
if (pp -> inventar.popul[focup] < i) {
say ("But sir, you don't have that many %s at %s!!!", ocup_name[focup], pp -> pid);
return;
}
socup = which_class (sc);
assert_occup (socup); /* does the second exist?? */
if (focup == SLAV || socup == SLAV) {
say ("Slaves cannot be assigned or reassigned, my lord!!");
return;
}
/* here perform the actual assignment */
pp -> inventar.popul[focup] -= i;
pp -> inventar.popul[socup] += i;
say ("The people are reassigned and ready, my lord.");
for (i = 0; i < MAXPL; i++)
if (pp -> pid == pl[i].pid)/* find the corresponding no. */
break;
work_p[i][focup] = pp -> inventar.popul[focup];
return;
}
SHAR_EOF
if test 1760 -ne "`wc -c assign.c`"
then
echo shar: error transmitting assign.c '(should have been 1760 characters)'
fi
echo shar: extracting best_score.c '(7505 characters)'
cat << \SHAR_EOF > best_score.c
/*
* %W% (mrdch&amnnon) %G%
*/
/*
* this program displays best scores ( optional all ) from the score
* file.
* options:
* -t 10 best winners and related stat.
* -a all scores sorted by time.
* -m only my games.
* user only `user''s games.
*/
# include <sys/types.h>
# include <sys/stat.h>
# include "score.h"
# include "constants.h"
struct reslts
{
char namepl[20] ;
int nwon ;
int nlost ;
int nyears ;
};
int n_entries ;
struct score *entries ;
struct reslts *uprslts ;
glxscore(ac, av)
int ac ;
char **av ;
{
struct stat stbuf ;
char *malloc() ;
int fd ;
register int i ;
struct reslts *scrpn ;
char *getlogin();
if(stat(GALSCOR, &stbuf) == -1) {
print("No score file.\n\r") ;
return;
}
n_entries = stbuf.st_size / sizeof(struct score) ;
if((n_entries * sizeof(struct score)) != stbuf.st_size) {
print("Ill formatted score file.\n\r") ;
return;
}
entries = (struct score *) malloc(stbuf.st_size) ;
uprslts = (struct reslts *)
malloc(n_entries * sizeof(struct reslts)) ;
if(entries == 0 || uprslts == 0) {
print("cannot allocate entry space.\n\r") ;
return;
}
scrpn = uprslts ;
for (i = 0 ; i < n_entries ; i++ ,scrpn++ ) {
scrpn->nwon = 0 ;
scrpn->nlost = 0 ;
scrpn->nyears = 0 ;
}
fd = open(GALSCOR, 0) ;
if(fd == -1) {
perror(GALSCOR) ;
return;
}
if(read(fd, (char *) entries, stbuf.st_size) != stbuf.st_size) {
perror("read error") ;
return;
}
ac-- , av++ ;
for(i = 0 ; i < ac ; i++) {
if(av[i][0] == '-')
switch(av[i][1]) {
case 't' :
dispbest(10) ;
break;
case 'a' :
dispall() ;
break ;
case 'm' :
dispuser(getlogin()) ;
break ;
default :
print("unknown option.\n\r") ;
return;
}
else
dispuser(av[i]) ;
}
}
dispuser(plname)
char *plname ;
{
struct reslts *scrpn ;
int i, nply ;
nply = findbest() ;
scrpn = uprslts ;
for (i = 0 ; i < nply ; i++ ,scrpn++)
if (strcmp(scrpn->namepl , plname) == 0)
break ;
if ( i == nply ) {
print("\n\rIt seems that %s never played galaxy. Poor man...\n\r",plname) ;
return;
}
print("\n\rThe GALAXY results for %s are:\n\r",plname) ;
print("==================================\n\r") ;
print("Games won: %d\tGames lost: %d\tTotal years played: %d\n\r\n\r",
scrpn->nwon, scrpn->nlost, scrpn->nyears) ;
print("This is the complete list:\n\r") ;
print("\n\rWinner\tLooser\tYears\tWinning date and time\n\r") ;
print("------------------------------------------------\n\r") ;
for ( i = 0 ; i < n_entries ; i++ ) {
if (strcmp(plname , entries[i].win) == 0 )
dispentr(i) ;
if(strcmp (plname , entries[i].los) == 0 )
dispentr(i) ;
}
}
dispbest(nbest)
{
struct reslts *scrpn ;
int i, nply;
nply = findbest() ;
scrpn = uprslts ;
print("\n\r******************************************************") ;
print("\n\r\t\tBest players in GALAXY game\n\r") ;
print("******************************************************\n\r\n\r") ;
print("Rank\tPlayer\tWon\tLost\tYears\tScore\n\r") ;
print("----------------------------------------------\n\r") ;
for (i = 0 ; i < nbest && i < nply ; i++, scrpn++)
print("%d\t%s\t%3d\t%3d\t%3d\t%3d\n\r",i+1, scrpn->namepl,
scrpn->nwon, scrpn->nlost, scrpn->nyears, 2*scrpn->nwon - scrpn->nlost) ;
print("\n\r") ;
}
findbest()
{
int i, j, k , p_players ;
int which ;
int qcmp() ;
i = 0 ;
p_players = 0 ;
for(i = 0 ; i < n_entries ; i++) {
if ( strcmp(entries[i].win , "-null") == 0 )
continue ;
if ( strcmp(entries[i].los , "-null") == 0 )
continue ;
if ( strcmp(entries[i].los , entries[i].win) == 0 )
continue ;
which = -1 ;
for (j = 0 ; j < p_players ; j++ ) {
if (strcmp(uprslts[j].namepl,entries[i].win) == 0 ) {
which = j ;
}
}
if (which != -1)
updt_res(i,1,which) ;
else
add_player(i,1,p_players++) ;
which = -1 ;
for (j = 0 ; j < p_players ; j++ ) {
if(strcmp (uprslts[j].namepl,entries[i].los) == 0 ) {
which = j ;
}
}
if (which != -1)
updt_res(i,0,which ) ;
else
add_player(i,0,p_players++) ;
}
qsort(uprslts, p_players, sizeof uprslts[0], qcmp);
return(p_players) ;
}
add_player(at_entry,ifwon,new_player)
int at_entry; /* where is the player located at entry table */
int ifwon; /* did he win this time */
int new_player; /* pointer to the new players entry */
{
if (ifwon)
strcpy(uprslts[new_player].namepl,entries[at_entry].win);
else
strcpy(uprslts[new_player].namepl,entries[at_entry].los);
updt_res(at_entry,ifwon,new_player) ;
}
updt_res(i,winner,player)
{
uprslts[player].nwon += winner ;
uprslts[player].nlost += !winner ;
uprslts[player].nyears += entries[i].years ;
}
qcmp(p1,p2)
struct reslts *p1 ,*p2 ;
{
return((2*p2->nwon - p2->nlost) - (2*p1->nwon - p1->nlost ) ) ;
}
dispall()
{
register int i ;
print("\n\r******************************************************") ;
print("\n\r\tThe complete list of the GALAXY games\n\r") ;
print("******************************************************\n\r") ;
print("\n\rWinner\tLooser\tYears\tWinning date and time\n\r") ;
print("------------------------------------------------\n\r") ;
for(i = 0 ; i < n_entries ; i++)
dispentr(i) ;
}
dispentr(i)
{
char *ctime();
print("%s\t%s\t%d\t%s",
entries[i].win, entries[i].los,
entries[i].years,
ctime(&entries[i].played_at)) ;
}
SHAR_EOF
if test 7505 -ne "`wc -c best_score.c`"
then
echo shar: error transmitting best_score.c '(should have been 7505 characters)'
fi
echo shar: extracting blackout.c '(726 characters)'
cat << \SHAR_EOF > blackout.c
/*
* %W% (mrdch&amnnon) %G%
*/
# include "header"
blackout (s)
char *s;
{
planet * pp;
int i;
pp = getpl (s); /* get planet id */
assert_player (pp); /* see if legal planet + owner */
skipwhite (s); /* go to the money part */
i = atoi (s); /* take the amount */
assert_money (i); /* see if there is enough of it */
skipword (s); /* skip that no. */
assert_end (s); /* does it end good?? */
pp -> secur += i; /* raise the BLACKOUT */
teller[player] -= i; /* take his money */
}
SHAR_EOF
if test 726 -ne "`wc -c blackout.c`"
then
echo shar: error transmitting blackout.c '(should have been 726 characters)'
fi
echo shar: extracting build.c '(3479 characters)'
cat << \SHAR_EOF > build.c
/*
* %W% (mrdch&amnnon) %G%
*/
# include "header"
/*
* In order to build new ships, several requirements have to be met.
* The planet on which it is to be build has to be assigned
* to Industrial, with some buiders on it.
* The knowledge level on that planet has to be at least equal to the
* level of ships to be build. The material there has to be
* at least equal to 1 ship needed for that level, and money should
* be provided.
*/
build (s)
char *s;
{
planet * pp;
int j,
factor,
nships,
ship_type,
money;
pp = getpl (s); /* get planet id */
assert_player (pp); /* verify existence + owner */
if (!pp -> inventar.popul[BUIL]) {
say ("But sir, who will carry out this work??");
return;
}
skipwhite (s);
if (*s == 't') { /* ONLY money is to be added */
s++;
skipwhite (s); /* go to the money portion */
money = atoi (s); /* collect the money */
assert_money (money); /* does he own that much?? */
skipword (s);
assert_end (s); /* chek now how it ends */
pp -> to_build[BUILD_MONEY] += money;
teller[player] -= money;
factor = 1;
j = pp -> to_build[LEVEL];
while (j-- > 0)
factor *= 2;
if (pp -> to_build[BUILD_MONEY] >= factor * SHIP_COST)
say ("The builders will start right away, sir !!");
else
say ("The money won't do for a single ship, sir !!");
return;
}
nships = atoi (s); /* see how many ships to build */
assert_negative (nships);
if (nships) { /* skip the no. chars */
skipnum (s); /* go to the ship type */
skipwhite (s);
}
else
nships = 1; /* if none given, assume 1 */
if (*s < 'a')
*s += ('a' - 'A'); /* transform type to l.c. */
if ((*s < 'a') || (*s > 'a' + MAXSHIPS - 1)) {
say ("The type of ship is not clear, sir!!");
return;
}
ship_type = *s - 'a';
if (pp -> to_build[LEVEL] != ship_type && pp -> to_build[NSHIPS]) {
say ("But sir, the builders are still working on the previous ships!!");
return; /* CANNOT change LEVEL */
}
if (pp -> inventar.know < ship_type) {
say ("The knowledge there is insufficient, sir.");
return;
}
factor = 1;
j = ship_type;
while (j-- > 0)
factor *= 2; /* calculate material for X type ship. */
if (pp -> inventar.metals < factor) {
say ("The material is insufficient for even one ship, sir.");
return;
}
s++;
skipwhite (s); /* go to the money portion */
money = 0;
if (*s) { /* probably wants to add money */
money = atoi (s); /* collect it */
assert_money (money); /* see if he owns that much */
skipword (s); /* chek now how it ends */
assert_end (s);
}
teller[player] -= money; /* take player's money */
pp -> to_build[BUILD_MONEY] += money;/* add to existing */
pp -> to_build[LEVEL] = ship_type;
pp -> to_build[NSHIPS] += nships;
if (pp -> to_build[BUILD_MONEY] >= factor * SHIP_COST)
say ("The builders will start right away, sir !!");
else
say ("The money won't do for a single ship, sir !!");
}
SHAR_EOF
if test 3479 -ne "`wc -c build.c`"
then
echo shar: error transmitting build.c '(should have been 3479 characters)'
fi
echo shar: extracting constants.h '(3899 characters)'
cat << \SHAR_EOF > constants.h
/*
* %W% (mrdch&amnnon) %G%
*/
/*
* this file contains all the constants used by the game.
*/
# define HOME "/usr/games/lib/galaxy/"
# define LOCAL "/usr/games/lib/galaxy/local"
# define WIZFIL "/usr/games/lib/galaxy/wizards"
# define LOGFIL "/usr/games/lib/galaxy/galaxy.log"
# define SAVEFIL "/usr/games/lib/galaxy/galaxy.save"
# define SAVETMP "/usr/games/lib/galaxy/galaxy.tmp"
# define GALSCOR "/usr/games/lib/galaxy/galaxy.scor"
# define DOSCORE "/usr/games/lib/galaxy/glxscore"
# define ONLINE "/usr/games/lib/galaxy/online/"
# define PAGER "/usr/games/lib/galaxy/pager"
# define ESPSIZ 8 /* max nesting of espionage */
# define MAXSHIPS 7 /* how many types of ships */
# define MAXPL 91 /* how many planets are there */
# define PLKINDS 5 /* how many kinds of planets */
# define MAXCHAN 2 /* maximum no. of chanels to open */
# define NCREW 64 /* no. of fighters in A-type HAWK */
# define VISITORS 128 /* no. of additional people */
# define MSGSIZ 150 /* max chars in a single masseg */
# define CLASES 6 /* how many clases of people */
# define FIGT 0 /* fighters */
# define CITI 1 /* citizens */
# define SCIE 2 /* scientists */
# define BUIL 3 /* builders */
# define MINE 4 /* miners */
# define SLAV 5 /* slaves */
# define ESPTYP 7 /* different types of espionage: */
# define ESPKIND 0 /* what kind of planet is it */
# define ESPPOP 1 /* how many people are there */
# define ESPKNOW 2 /* what is the knowledge level */
# define ESPMTL 3 /* how much metal was digged out */
# define ESPSHIP 4 /* what are the forces there */
# define ESPALM 5 /* how many ALM were installed */
# define ESPMSL 6 /* how many missiles are there */
# define BUILD_MONEY 0 /* MONEY given to build ships */
# define LEVEL 1 /* the LEVEL of ships ordered build */
# define NSHIPS 2 /* the NO. of ships ordered build */
# define N_PSI 20 /* max possible messages on screen */
# define ALMCOST 100 /* how much costs 1 ALM */
# define REMOVE_COST 50 /* to remove one if yours */
# define ALM_KILL_COST 200 /* to remove from the enemy's planet */
# define YEARLENGTH 180 /* a turn is 3 min. */
# define PERC_TRADE 5 /* the minimum % of profit in trade */
# define PERC_POPUL 10 /* the % of natural growth */
# define FEED_RATIO 100 /* no. people fed by 1 teller a year */
# define MINING_FACTOR 100 /* years_manpower 1A metals */
# define KNOW_FACTOR 2000 /* years_manpower to raise 1 level */
# define SHIP_COST 100 /* basic cost factor to build ship */
# define MISSILE_COST 400 /* to put a A-type missile */
# define REDUCE_RATE 10 /* detecting lost effect % in a year */
# define FADE_RATE 25 /* undetection paint fading rate */
# define MIN_ESP 100 /* the minimum to report ANYTHING */
# define KIND_ESP MIN_ESP /* to find out the planet's type */
# define POPUL_ESP 5*MIN_ESP /* for it's population */
# define KNOW_ESP 3*MIN_ESP /* the level of knowledge there */
# define METAL_ESP 2*MIN_ESP /* how much metal has he */
# define FORCE_ESP 10*MIN_ESP /* what are his forces there */
# define ALM_ESP 2*MIN_ESP /* how many alms he's got */
# define MSL_ESP 8*MIN_ESP /* how many missiles he set there */
SHAR_EOF
if test 3899 -ne "`wc -c constants.h`"
then
echo shar: error transmitting constants.h '(should have been 3899 characters)'
fi
echo shar: extracting detect_mv.c '(726 characters)'
cat << \SHAR_EOF > detect_mv.c
/*
* %W% (mrdch&amnnon) %G%
*/
# include "header"
detectmv (s)
char *s;
{
planet * pp;
int i;
pp = getpl (s); /* get planet id */
assert_player (pp); /* see if legal planet + owner */
skipwhite (s); /* go to the money part */
i = atoi (s); /* take the amount */
assert_money (i); /* see if there is enough of it */
skipword (s); /* skip that no. */
assert_end (s); /* does it end good?? */
pp -> detect += i; /* raise the DETECT */
teller[player] -= i; /* take his money */
}
SHAR_EOF
if test 726 -ne "`wc -c detect_mv.c`"
then
echo shar: error transmitting detect_mv.c '(should have been 726 characters)'
fi
echo shar: extracting end_game.c '(3509 characters)'
cat << \SHAR_EOF > end_game.c
/*
* %W% (mrdch&amnnon) %G%
*/
# include "header"
char s1[] = "We are on our way to a BETTER LAND... let GOD be with us next time.";
extern char moreflg[] ;
/*
* When the game ends, this function is calles to show it
* in a rather dramatic way. The looser sees his galaxy vanishing,
* while the winner gets a satisfactory view of the galaxy that
* transforms to his original sign.
*/
end_game (winplay) {
char winc = '*'; /* the default winning sign */
/* keeps the new coordinates of vanishing planets */
int newcord[2][MAXPL];
int i,
j,
m,
captr;
char *ps1 = s1;
int line = 19,
col;
if (winplay)
winc = '@';
/* notify the winner */
termn (winplay);
if (moreflg[winplay])
endmore() ;
cleol (19, 0);
disch ('\007');
say ("Sir!!! We won the battle!!! The enemy runs away!!!");
disch ('\007');
(void) fflush (tty);
/* notify the looser */
termn (!winplay);
if (moreflg[!winplay])
endmore() ;
disch ('\007');
say ("Dear sir, we have lost everything. I wish you best luck next time...");
disch ('\007');
cleol (line, 0);
/* back to the winner */
termn (winplay);
so (19, 20, " Our forces are taking over the two Galaxies...");
(void) fflush (tty);
/* and again the looser */
termn (!winplay);
for (i = 0; i < MAXPL; i++) {
pos (pl[i].coord[0], pl[i].coord[1] + 1);
newcord[0][i] = pl[i].coord[0];
newcord[1][i] = pl[i].coord[1] + 1;
pl[i].d_symbol[player] = winc;
pl[i].d_symbol[!player] = winc;
}
/* display the comforting line to the looser */
col = 5;
so (line--, col, ps1);
col += 3;
ps1 += 3;
/* make it succesivly shorter */
s1[strlen (s1) - 3] = '\0';
for (i = 0; i < MAXPL; i++) {
pos (newcord[0][i], newcord[1][i]);
disch (winc);
pos (newcord[0][i], newcord[1][i] - 1);
disch (' ');
pos (newcord[0][i], newcord[1][i] + 1);
disch (' ');
}
captr = 0;
j = 20;
while (j) {
if (j < 14 && captr < MAXPL) {
termn (winplay);
for (m = 0; m < 7; m++) {
curse_com (&pl[captr]);
captr++;
}
(void) fflush (tty);
termn (!winplay);
}
if (j % 2) {
cleol (line, 0);
so (line--, col, ps1);
col += 3;
ps1 += 3;
s1[strlen (s1) - 3] = '\0';
}
/* place the vanishing planets in their new position on screen */
for (i = 0; i < MAXPL; i++) {
pos (newcord[0][i], newcord[1][i]);
disch (' ');
if (newcord[0][i] > 8)
newcord[0][i]--;
else
if (newcord[0][i] < 8)
newcord[0][i]++;
if (newcord[1][i] - 39 >= 2)
newcord[1][i] -= 2;
else
if (newcord[1][i] - 39 == 1)
newcord[1][i]--;
else
if (39 - newcord[1][i] >= 2)
newcord[1][i] += 2;
else
if (39 - newcord[1][i] == 1)
newcord[1][i]++;
pos (newcord[0][i], newcord[1][i]);
disch (winc);
(void) fflush (tty);
}
j--;
}
(void) fflush (tty);
termn (winplay);
endgame (winplay);
}
SHAR_EOF
if test 3509 -ne "`wc -c end_game.c`"
then
echo shar: error transmitting end_game.c '(should have been 3509 characters)'
fi
echo shar: extracting feed_pop.c '(822 characters)'
cat << \SHAR_EOF > feed_pop.c
/*
* %W% (mrdch&amnnon) %G%
*/
# include "header"
feedpop (s)
char *s;
{
int i,
j;
i = atoi (s); /* see how much he wants to give */
if (i <= 0) {
say ("But sir, please be more generous !!!");
return;
}
assert_money (i); /* see if he has that much */
skipword (s);
assert_end (s); /* does it end properly? */
teller[player] -= i; /* take his money */
food[player] += i; /* and give it to the poors */
j = food[player] * FEED_RATIO;
i = count_popul (player) - count_class (player, CITI);
if (j > i) /* he gave them more then enough */
say ("Thousands thanks, my lord !!");
else
say ("%d of your people might starve to death, my lord.", i - j);
}
SHAR_EOF
if test 822 -ne "`wc -c feed_pop.c`"
then
echo shar: error transmitting feed_pop.c '(should have been 822 characters)'
fi
echo shar: extracting funcdef.h '(399 characters)'
cat << \SHAR_EOF > funcdef.h
/*
* %W% (mrdch&amnnon) %G%
*/
/*
* global macros.
*/
#define skipwhite(s) doskipwhite(&s)
#define skipblack(s) doskipblack(&s)
#define skipword(s) doskipword(&s)
#define skipnum(s) doskipnum(&s)
#define getpl(s) dogetpl(&s)
#define ishex(a) ((a >= '0' && a <= '9')|| (a >= 'a' && a <= 'f'))
#define isnum(a) ((a >= '0' && a <= '9'))
#define TWOZERO { 0, 0 }
SHAR_EOF
if test 399 -ne "`wc -c funcdef.h`"
then
echo shar: error transmitting funcdef.h '(should have been 399 characters)'
fi
echo shar: extracting global.c '(9888 characters)'
cat << \SHAR_EOF > global.c
/*
* %W% (mrdch&amnnon) %G%
*/
# include "header"
# define PLANET_H 1000
/*
* This file contains little functions, used globaly
* in almost all the parsing functions.
*/
/* LINTLIBRARY */
/*VARARGS1*/
say (a, b, c, d, e, f, g, h, i)
char *a;
{
cleol (23, 10);
fprintf (tty, a, b, c, d, e, f, g, h, i);
}
/*VARARGS1*/
msg (a, b, c, d, e, f, g, h, i)
char *a;
{
pos (21, 10);
fprintf (tty, a, b, c, d, e, f, g, h, i);
}
/*VARARGS1*/
bug (a, b, c, d, e, f, g, h, i)
char *a;
{
fprintf (stderr, a, b, c, d, e, f, g, h, i);
fprintf (stderr, "\r\n");
(void) kill (getpid (), 9);
endgame (-1);
}
/*VARARGS1*/
pr_at (line, col, a, b, c, d, e, f, g, h, i)
char *a;
{
pos (line, col);
fprintf (tty, a, b, c, d, e, f, g, h, i);
}
/*VARARGS1*/
print (a, b, c, d, e, f, g, h, i)
char *a;
{
fprintf (tty, a, b, c, d, e, f, g, h, i);
}
disch (c)
char c;
{
putc (c, tty);
}
/* A function to skip * spaces, and point to the first NON space */
doskipwhite (s)
char **s;
{
while (isspace (**s) && **s) {
skip++;
(*s)++;
}
}
/* A function to skip * NON spaces, and point to the first space */
doskipblack (s)
char **s;
{
while (!isspace (**s) && **s) {
skip++;
(*s)++;
}
}
/* skip a word WITH it's boundries */
doskipword (s)
char **s;
{
doskipwhite (s);
doskipblack (s);
doskipwhite (s);
}
/* skip only NUMERICAL. point to the first NON numeric. */
doskipnum (s)
char **s;
{
doskipwhite (s);
while (isnum (**s)) {
skip++;
(*s)++;
}
}
/*
* parse a planet name. this set of functions should
* return a pointer to the planet structure, given a
* planet name.
*/
planet * planet_list[PLANET_H];
planet *
getid (s)
char *s;
{
planet * dogetid ();
register planet * pp;
char pid[4];
skipwhite (s);
strncpy (pid, s, 3);
pp = dogetid (pid);
if (pp != 0)
skip += 3; /* a legal name was found, 3 chars */
return (pp);
}
/*
* hash the planet's name, and if found return the pointer
* to it.
*/
planet *
dogetid (s)
char *s;
{
int hval = 0;
planet * pl;
hval = hash_planet (s);
pl = planet_list[hval];
if (pl == 0)
return (0);
if (strcmp (pl -> pid, s) != 0)
return (0);
else
return (pl);
}
/*
* This hash function should be perfect. No collisions are allowed.
*/
hash_planet (s)
register char *s;
{
register ac;
switch (*s++) {
case 'l':
ac = 1;
break;
case 'c':
ac = 2;
break;
case 'r':
ac = 3;
break;
default:
bug ("bad arg to hash_planet %s", s-1);
}
ac *= 16;
ac += hexval (*s++);
ac *= 16;
ac += hexval (*s);
return (ac % PLANET_H);
}
/*
* the initialization function for planet's recognization
*/
init_getid () {
register i;
register hval;
for (i = 0; i < MAXPL; i++) {
hval = hash_planet (pl[i].pid);
if (planet_list[hval] != 0)
bug ("hash function not perfect (init_getid)");
planet_list[hval] = &pl[i];
}
capitals[0] = getid ("l00");
capitals[1] = getid ("r00");
}
/*
* The main function that deals with the planet id
* in a given string.
*/
planet *
dogetpl (s)
char **s;
{
register planet * pp;
doskipwhite (s);
skip = 0;
if (ispid (*s)) /* a possibly legal name was given */
pp = getid (*s); /* get the planet's pointer */
else
pp = curpln;
*s += skip;
assert_planet (pp);
return (pp);
}
/*
* Check if a given string starts with chars that
* possibly represent a planet, and the two other
* chars are legal continuations of such name.
*/
ispid (s)
char *s;
{
switch (*s++) {
case 'c':
case 'r':
case 'l':
break;
default:
return (0);
}
if (fisnum (*s++)) /* the first must be numeric */
if (fishex (*s++)) /* the second can be hex */
return (1);
return (0);
}
fisnum (a) {
return (isnum (a));
}
fishex (a) {
return (ishex (a));
}
hexval (c)
int c;
{
if (isdigit (c))
return (c - '0');
else
return (c - 'a' + 10);
}
/* check if the direction is one allowed */
find_direct (cs)
char cs;
{
int j;
switch (cs) {
case ',': /* counter-clockwise */
j = 8;
break;
case '.': /* clockwise */
j = 9;
break;
case '8': /* north */
j = 0;
break;
case '6': /* west */
j = 2;
break;
case '2': /* south */
j = 4;
break;
case '4': /* east */
j = 6;
break;
case '9': /* north-east */
j = 1;
break;
case '3': /* south-east */
j = 3;
break;
case '1': /* south-west */
j = 5;
break;
case '7': /* north-west */
j = 7;
break;
default:
j = -1;
}
return (j);
}
/*
* This function checks if a given planet (parameter)
* is TOTALY empty. Returnes 0 if so.
*/
chek_empty (pp)
planet * pp;
{
int i,
j,
k,
flg = 0;
for (i = 0; i < CLASES; i++) {
if (pp -> inventar.popul[i])
flg++;
if (pp -> to_take.popul[i])
flg++;
}
if (pp -> inventar.know)
flg++;
if (pp -> inventar.metals)
flg++;
if (pp -> to_take.know)
flg++;
if (pp -> to_take.metals)
flg++;
if (pp -> secur)
flg++;
if (pp -> alms)
flg++;
if (pp -> paint)
flg++;
if (pp -> detect)
flg++;
for (i = 0; i < 3; i++)
if (pp -> to_build[i])
flg++;
if (pp -> reports)
flg++;
for (i = 0; i < MAXSHIPS; i++) {
if (pp -> ships[i])
flg++;
if (pp -> missile[i])
flg++;
}
for (i = 0; i < 2; i++)
for (j = 0; j < ESPTYP; j++)
for (k = 0; k < ESPSIZ; k++)
if (pp -> espion[i][j][k])
flg++;
return (flg);
}
/*
* assert functions. One never returns to calling function
* if condition is met.
*/
assert_money (n) {
if (n <= 0) {
if (iswiz[player] == 1)
return;
say ("That little money won't do, sir.");
longjmp (jparse, 1);
}
if (iswiz[player] == 1)
teller[player] += n;
if (n > teller[player]) {
say ("You don't have that much money, sir.");
longjmp (jparse, 1);
}
}
assert_end (s)
char *s;
{
skipwhite (s);
if (*s) {
say ("The command's end is not clear, sir.");
longjmp (jparse, 1);
}
}
assert_number (n) {
if (iswiz[player] == 1)
return;
if (n == 0) {
say ("That will not change much, sir.");
longjmp (jparse, 1);
}
assert_negative (n);
}
assert_negative (n) {
if (iswiz[player] == 1)
return;
if (n < 0) {
say ("Negative number, sir ???");
longjmp (jparse, 1);
}
}
assert_planet (p)
planet * p;
{
if (!p) {
say ("I don't know that planet, sir!!");
longjmp (jparse, 1);
}
}
assert_player (p)
planet * p;
{
assert_planet (p);
if (iswiz[player] == 1)
return;
if (p -> whos != player) {
say ("Unfortunately, the planet is not yet yours, sir.");
longjmp (jparse, 1);
}
}
assert_occup (ocup) {
if (ocup < 0) {
say ("I don't recognize the occupation, sir.");
longjmp (jparse, 1);
}
}
assert_loosing () {
say ("So sorry, sir, we have lost them all...");
longjmp (jparse, 1);
}
/* check if a given planet is a capital */
iscapital (pp)
planet * pp;
{
if (strcmp (pp -> pid, "r00") == 0 || strcmp (pp -> pid, "l00") == 0)
return (1);
else
return (0);
}
/*
* this swich checks for the types of legal ocupations.
* It also check for the planet type that was before,
* and the planet-type that should be after change will
* be made.
*/
which_class (cc)
char cc;
{
switch (cc) {
case 'f':
return (FIGT);
case 'c':
return (CITI);
case 's':
return (SCIE);
case 'b':
return (BUIL);
case 'm':
return (MINE);
case 'v':
return (SLAV);
default:
return (-1); /* unrecognized */
}
}
/*
* Function to count the no of population in a given
* planet.
*/
planet_popul (pp)
planet * pp;
{
int i = 0,
j;
for (j = 0; j < CLASES; j++)
i += pp -> inventar.popul[j];
return (i);
}
/*
* returns the total no. of people from a predifined class.
*/
count_class (j, class)
int j,
class;
{
int i,
ncount = 0;
for (i = 0; i < MAXPL; i++)
if (pl[i].whos == j) {
ncount += pl[i].inventar.popul[class];
ncount += pl[i].to_take.popul[class];
}
return (ncount);
}
/*
* returns the total no. of population of a player.
*/
count_popul (j) {
int i,
k,
ncount = 0;
for (i = 0; i < MAXPL; i++)
if (pl[i].whos == j)
for (k = 0; k < CLASES; k++) {
ncount += pl[i].inventar.popul[k];
ncount += pl[i].to_take.popul[k];
}
return (ncount);
}
SHAR_EOF
if test 9888 -ne "`wc -c global.c`"
then
echo shar: error transmitting global.c '(should have been 9888 characters)'
fi
echo shar: extracting global.h '(1783 characters)'
cat << \SHAR_EOF > global.h
/*
* %W% (mrdch&amnnon) %G%
*/
/*
* This file contains the definitions of all the
* global variables and return value types of functions.
*/
extern jmp_buf jparse;
extern planet * capitals[2];
extern int skip; /* number of chars to skip. */
extern info * info_head[2]; /* linked info head */
extern planet * spntr; /* pointer to current 'star' */
extern planet * apntr; /* pointer to current 'ampers' */
extern planet * curpln;
extern FILE * tty; /* We write to this tty */
extern FILE * ttys[]; /* these are the players terminals */
extern int player; /* the current player */
extern int teller[2]; /* the money available to each */
extern int food[2]; /* the money invested in food */
extern int trade[2]; /* the money invested in trade */
extern planet pl[]; /* the planets themselves */
extern char *ocup_name[]; /* the names of the occupations */
extern int chand[MAXCHAN];
extern int year; /* The current year */
extern int iswiz[2]; /* Am i a wizard? */
extern int wants_quit[2];
extern int wants_save[2];
extern int wants_restor[2];
extern int wants_newy[2];
extern int wants_pause[2];
extern int Pause; /* Are we having a break or not */
extern char ply0[100],
*ply1; /* the names of the players */
extern int espcost[ESPTYP];
extern char *inftypes[ESPTYP];
extern struct terminal ttycs[2];
extern struct terminal *ttyc;
planet * getid ();
planet * dogetpl (); /* getpl is a macro */
time_t time ();
long lseek ();
char *strcpy ();
char *sprintf ();
char *strcat ();
SHAR_EOF
if test 1783 -ne "`wc -c global.h`"
then
echo shar: error transmitting global.h '(should have been 1783 characters)'
fi
echo shar: extracting header '(329 characters)'
cat << \SHAR_EOF > header
/*
* %W% (mrdch&amnnon) %G%
*/
/*
* this file includes all includes.
*/
# include <sys/types.h>
# include <stdio.h>
# include <ctype.h>
# include <setjmp.h>
# include "constants.h"
# include "typedefs.h"
# include "funcdef.h"
# include "global.h"
# include "options.h"
SHAR_EOF
if test 329 -ne "`wc -c header`"
then
echo shar: error transmitting header '(should have been 329 characters)'
fi
# End of shell archive
exit 0MRDCH@TAURUS.BITNET (06/14/85)
From: Mordechai Chachamu <mrdch@taurus.BitNet>
Hello everybody!!!
Since galaxy was posted, I received many requests for part #4.
This is the part that contains "utility" programs, and should be
placed in ~galaxy/src1. I take this opportunity to add and correct
few things, along with the reposting of that part.
Even if you got that part in good shape, it's worth looking at
it's new version. A brief description of it follows.
~galaxy/src1 changes:
1. The first posting contained a hidden subdirectory, ("safe") which
escaped my attention. That directory contained redundant data and
should be ignored.
2. The src1/Makefile is now better and cleaner.(called here "makefile")
3. Comments were added to most src1 files.
4. The file "constants.h" was trimmed to contain only relevant info.
It should be copied to ~galaxy/src as well. (They should be identical).
~galaxy/src changes:
1. The Makefile was improved. (especially "make install").
2. The file "diffsrc" contains some context diffs that should be
patched in.
~galaxy changes:
The installation shell script "install.sh" and "install_howto"
underwent some major changes. They accompany the NEW makefiles.
Waiting for comments.
My address:
mrdch@taurus (BITNET)
mrdch@taurus.bitnet@berkeley (ARPA)
mrdch%taurus.bitnet@wiscvm.ARPA (CSNET)
and if all fails, then
...!decvax!humus!taurus!mrdch (UUCP)
*GALAXY* wishes you a pleasant journey in the void...
Mordechai.
# This is a shell archive.
# Remove everything above and including the cut line.
# Then run the rest of the file through sh.
-----cut here-----cut here-----cut here-----cut here-----
#!/bin/sh
# shar: Shell Archiver
# Run the following text with /bin/sh to create:
# install.sh
# install_howto
# Makefile
# diffsrc
# makefile
# READ_ME
# constants.h
# edscore.c
# galaxy.csh
# galaxy.motd
# local.c
# okgalaxy.c
# pager.c
# score.h
# This archive created: Fri Jun 14 21:48:53 1985
echo shar: extracting install.sh '(2104 characters)'
sed 's/^XX//' << \SHAR_EOF > install.sh
XX# This is the galaxy maker.
XX# It should be run: /bin/sh install.sh
XX# Be sure to set the following shell-variables
XX# before you run this command file.
XX# Since this file has to use super-user privileges,
XX# make sure you read it BEFORE using it.
XX# Good luck.
XX
XXSDIR=/users/guest/galaxy/distr
XX# Set this to reflect the home directory of galaxy.
XX# All the rest resides in subdirectories.
XXSOURCES=$SDIR/src
XXSOURCES1=$SDIR/src1
XXMAN=$SDIR/man
XXDOC=$SDIR/doc
XXONLINE=$SDIR/online
XX# This are system variables.
XX# The first should be carefully matched with variables set in
XX# $SDIR/src/constants.h!!!
XXLIBDIR=/usr/games/lib/galaxy
XXSYSMAN6=/usr/man/man6
XXSYSDOC=/usr/doc
XX
XXcat << Funny
XXWarning: Read this file before running it!
XX
XXWarning: This file must be run with super_user priviliges.
XX Before running it , create a user named galaxy,
XX group - games.
XX
XXShall I proceed ?
XXFunny
XXread answer
XXif [ "$answer" != y ]; then
XX echo GoodBye
XX exit 1
XXfi
XX
XXif [ ! -d $LIBDIR ]; then
XX mkdir $LIBDIR
XX chown galaxy $LIBDIR
XXfi
XX
XXecho 'Making the galaxy game'
XXcd $SOURCES ; make galaxy # install the main game
XXecho 'Installing the galaxy game'
XXmake install
XXecho 'Making the utility files'
XXcd $SOURCES1 ; make all # install utility files
XXecho 'Installing the utility files'
XXmake install
XX
XXecho 'Checking/creating online directory'
XXif [ ! -d $LIBDIR/online ]; then
XX mkdir $LIBDIR/online
XXfi
XX
XXchown galaxy $LIBDIR/online
XXecho 'Copying online files'
XXcp $ONLINE/* $LIBDIR/online
XXchown galaxy $LIBDIR/online/* # install online documents
XXcd $LIBDIR
XXecho 'Creating the "score" and "wizards" files'
XXecho > galaxy.scor # score file.
XXchown galaxy galaxy.scor
XXchmod 600 galaxy.scor
XXecho mrdch > wizards # wizard file.
XXchmod 644 wizards # I'm always...
XXchown galaxy wizards
XXecho 'Placing the manual page'
XXcp $MAN/galaxy.6 $SYSMAN6/galaxy.6 # manual
XXecho 'Placing the document'
XXcp $DOC/Galaxy.doc $SYSDOC/galaxy # document
SHAR_EOF
if test 2104 -ne "`wc -c install.sh`"
then
echo shar: error transmitting install.sh '(should have been 2104 characters)'
fi
echo shar: extracting install_howto '(7251 characters)'
sed 's/^XX//' << \SHAR_EOF > install_howto
XX***************************************************************
XX* PLEASE NOTICE THE FOLLOWING CONDITIONS *
XX***************************************************************
XX
XXAs the authors of the game, we would like to make some
XXrequests and remarks concerning the game installation.
XX
XX1. The sources contained hereby are distributed free, for the
XX much hoped enjoyment of all game lovers.
XX
XX2. Being in public domain, anyone is entitled to change/add/delete
XX anything he wishes.
XX
XX3. We make a distinction between two kinds of changes:
XX "Bug fix" - a change that brings the game to act closer to
XX the way it should. (As defined in the document).
XX "Enhancement" - a change that alters the way a player THINKS
XX during the play.
XX As a test to distinguish between the two, one should answer
XX the question:
XX "Will I play differently BECAUSE of that change?"
XX
XX4. We would appreciate hearing about changes of the first kind.
XX If possible, please mail them to us.
XX
XX5. If a change of the second kind is introduced, we expect the
XX person to compile it under a DIFFERENT name.
XX (However similar to the origin). In addition, we would like
XX to hear about it, and the reasoning behind it.
XX
XX7. The game may be redistributed on the condition that no file
XX from the original distribution will be left out.
XX
XX8. The reason for the requests above is:
XX Galaxy is different from many computer games, by involving
XX TWO players at the same time. It is our wish that two
XX people from different SITES will be able to compete one
XX against the other. This can be achieved ONLY if the rules and
XX conditions specified in the document remain intact.
XX
XX9. On the other hand, we are eagerly waiting for reactions
XX of any kind. If there will be some public opinion concerning
XX the way the game SHOULD be, we will correct it on future
XX versions.
XX
XX***************************************************************
XX* END OF CONDITIONS. NOW THE FUN. *
XX***************************************************************
XX
XX Installing galaxy - Three ways to treat a lady.
XX
XX1. Run the install.sh in this directory. It must be run with
XX Super User privileges, so at least read it before typing
XX the command.
XX2. Refer to the end of this document, which outlines a step by
XX step procedure.
XX3. Read further, and possibly gain more insight to the structure
XX of this game.
XX
XXContents of the distribution directory.
XX
XXThe distribution directory contains several subdirectories:
XX"Src" holds the source for the main program and "src1" has the
XXsource for miscellaneous programs.
XX"Man" holds the manual page, for general reference.
XX"Doc" contains the complete documentation for the novice and
XXexperienced player.
XX"Online" is the same document in small pieces, that can be viewed
XXduring the game.
XX
XXAfter compiling the source two programs are obtained:
XX"galaxy" and "okgalaxy".
XX"galaxy" is the game itself. Whenever a user wishes to challenge
XXsomebody to this play, he should run "galaxy". If the offer is
XXaccepted, the other user runs "okgalaxy".
XX
XXProtection
XX
XXIn order to enjoy the game to it's full potential, ALL relevant
XXfiles should have their access bits set so that NO forgery
XXis possible. When a game is saved, the saved file belongs to
XX"galaxy", and it's mode set to 600. Encryption is used as a further
XXprotection tool. The encryption source file is the ONLY code that should
XXnot be left open to public.
XX
XXThe two runable modules belong to galaxy.
XXTheir mode should be 4111.
XXThe directory "/usr/games/lib/galaxy" is to be owned by galaxy too,
XXand have it's mode bits set to 700.
XX
XXManuals
XX
XX"Nroff" the document and the manual page. Place them in their
XXappropriate place.
XX
XX(The "Galaxy.doc" at "/usr/doc" and "Galaxy.nrf" in "/usr/doc/nroffed").
XX
XXThe "online" holds the entries for the online "help" facility of
XXthe game. It should be copied entirely to "/usr/games/lib/galaxy/online"
XXdirectory.
XX
XX
XXTerminals
XX
XXThe screen is a vital instrument here. The game looks for the type
XXof terminal used, as defined by TERM in the environment. It then
XXextracts some entries from the "termcap" data base. If the
XXterminal lacks some basic capabilities, the session will be aborted.
XX ***** High baud rates are recommended. *****
XXOne feature of the game is it's ability to make good use of
XX2 screens terminals. There is NO entry for "FLip to the next page" and
XX"Flip Back to the previous page" in termcap(5). In many new terminals
XXsuch capability exists. If such is the case at your place, add those
XXtwo entries. We have defined them as "fl" and "fb" respectively.
XXThis feature is NOT essential to the game.
XXAnother assumption, however, IS. We assume existence of a numeric keypad.
XXThere might be a way do avoid such prerequisite,
XXwith the cost of much less comfort to the players.
XX
XXInstallation - step by step
XX
XXThe procedure outlined here is a detailed version of the
XXcommand file install.sh in this directory.
XX
XX
XXIt is assumed that a uid named "galaxy" is created, within the
XX"games" group. To avoid use of super user privileges, all files
XXbelong to galaxy.
XX
XXThe variables outlined here can be freely changed.
XX
XXSDIR = /users/guest/galaxy ; the "home" dir.
XX
XX; subdirectories within "home" directory.
XX
XXSOURCES = $SDIR/src
XXSOURCES1 = $SDIR/src1
XXMAN = $SDIR/man
XXDOC = $SDIR/doc
XXONLINE = $SDIR/online
XX
XX; where most of the game will reside
XX
XXLIBDIR = /usr/games/lib/galaxy
XX
XX; create LIBDIR with galaxy ownership
XX
XX mkdir $LIBDIR
XX chown galaxy $LIBDIR
XX
XX; compile the programs and...
XX; transfer them to their place and...
XX; take care of mode bits.
XX
XXcd $SOURCES; make galaxy
XXmake install
XXcd $SOURCES1; make all
XXmake install
XX
XX
XX; create the score file
XX
XXecho > galaxy.scor # score file.
XXchown galaxy galaxy.scor
XX
XX; make a file in /usr/games/lib/galaxy by the name "wizards".
XX; This file should contain login names of people who would
XX; like to experiment and debug (???) things in that game.
XX; They have great power as wizards.
XX
XXecho mrdch > wizards # wizard file
XXchown galaxy wizards
XXchmod 600 wizards
XX
XX; Take care of documentation...
XX
XXcp $MAN/galaxy.6 /usr/man/man6/galaxy.6 # manual
XXcp $DOC/galaxy.doc /usr/doc/galaxy # document
XX
XX; and the online documentation.
XX
XXmkdir $LIBDIR/online ; chown galaxy $LIBDIR/online
XXcp $ONLINE/* $LIBDIR/online ; chown galaxy $LIBDIR/online/*
XX
XX; The following suggestions are not essential, but recommended.
XX
XX Copy the sources to /usr/src/games/galaxy
XX
XX Read the "Terminals" paragraph above, and see if you can do
XX something about it.
XX
XX We cannot over-emphasize our request for comments criticism and,
XX yes, even encouragements.
XX
XX Please mail them to
XX
XXOur address:
XX {mrdch,amnnon}@taurus (BITNET)
XX {mrdch,amnnon}@taurus.bitnet@berkeley (ARPA)
XX {mrdch,amnnon}%taurus.bitnet@wiscvm.ARPA (CSNET)
XXand if all fails, then
XX ...!decvax!humus!taurus!{mrdch,amnnon} (UUCP)
XX
XX Mordechai Chachamu
XX Amnon Horowits
SHAR_EOF
if test 7251 -ne "`wc -c install_howto`"
then
echo shar: error transmitting install_howto '(should have been 7251 characters)'
fi
echo shar: extracting Makefile '(2068 characters)'
sed 's/^XX//' << \SHAR_EOF > Makefile
XX# Galaxy Makefile. Belongs to ~galaxy/src.
XX# SccsId %W% (mrdch&amnnon) %G%
XX#
XX
XXLIBDIR = /usr/games/lib/galaxy
XXHOMEDIR = /users/guest/galaxy
XX
XXCFILES = assign.c blackout.c build.c detect_mv.c feed_pop.c \
XX global.c init_all.c kill_alm.c leave_at.c \
XX move_to.c no_detect.c over_stat.c parse.c planet_enq.c \
XX planet_inf.c planet_sit.c play.c put_alm.c \
XX retrieve.c softclock.c take_from.c term2init.c trade.c \
XX use_term.c wizard.c write.c end_game.c \
XX savegame.c terminal.c set_missle.c best_score.c
XX
XXOFILES = assign.o blackout.o build.o detect_mv.o feed_pop.o \
XX global.o init_all.o kill_alm.o leave_at.o \
XX move_to.o no_detect.o over_stat.o parse.o planet_enq.o \
XX planet_inf.o planet_sit.o play.o put_alm.o \
XX retrieve.o softclock.o take_from.o term2init.o trade.o \
XX use_term.o wizard.o write.o end_game.o \
XX savegame.o terminal.o set_missle.o best_score.o
XX
XXHEADERS = header constants.h funcdef.h global.h typedefs.h options.h \
XX score.h table.h
XX
XXSOURCEDIR = .
XXLDFLAGS =
XXCC = /bin/cc
XXRM = /bin/rm
XXCTAGS = /usr/ucb/ctags
XXGET = /usr/bin/sccs get -s
XXPR = /bin/pr
XXLPR = /usr/bin/lpr
XXECHO = /bin/echo
XXMV = /bin/mv
XXTAR = /bin/tar
XX
XXall : galaxy
XX @${ECHO} Galaxy is up to date.
XX
XXgalaxy : ${OFILES}
XX ${CC} ${LDFLAGS} ${OFILES} -ltermlib
XX @${MV} a.out galaxy
XX
XXtags : ${CFILES} ${HEADERS}
XX ${CTAGS} ${CFILES} ${HEADERS}
XX
XXclean :
XX ${RM} -f ${OFILES}
XX
XXlpr :
XX ${PR} ${HEADERS} ${CFILES} | ${LPR}
XX
XX${OFILES} : ${HEADERS}
XX.PRECIOUS: ${CFILES} ${HEADERS}
XX.DEFAULT: ${CFILES} ${HEADERS}
XX ${GET} $@
XX
XXinstall: galaxy
XX cp galaxy ${LIBDIR}
XX mv ${LIBDIR}/galaxy ${LIBDIR}/galaxy.out
XX chuser galaxy ${LIBDIR}/galaxy.out
XX chmod 4111 ${LIBDIR}/galaxy.out
XX
XXgamelock:
XX chmod 700 ${LIBDIR}/galaxy.out
XX
XXgameok:
XX chmod 4111 ${LIBDIR}/galaxy.out
XX
XXtar :
XX ${TAR} cv ${SOURCEDIR}
XX
XXbackup :
XX ${TAR} cv ${HOMEDIR}
SHAR_EOF
if test 2068 -ne "`wc -c Makefile`"
then
echo shar: error transmitting Makefile '(should have been 2068 characters)'
fi
echo shar: extracting diffsrc '(1324 characters)'
sed 's/^XX//' << \SHAR_EOF > diffsrc
XX*** parse.c Fri Jun 14 18:55:08 1985
XX--- compare/parse.c Fri Jun 14 18:53:27 1985
XX***************
XX*** 500,509
XX * A suicidal command. When all is lost.
XX */
XX give_up () {
XX! if (!iswiz[player])
XX! end_game (!player);
XX! else
XX! endgame(!player);
XX }
XX
XX /*
XX
XX--- 500,506 -----
XX * A suicidal command. When all is lost.
XX */
XX give_up () {
XX! end_game (!player);
XX }
XX
XX /*
XX*** savegame.c Fri Jun 14 18:55:24 1985
XX--- compare/savegame.c Fri Jun 14 18:53:41 1985
XX***************
XX*** 32,38
XX
XX int SWITCH_FLAG;
XX
XX! char version[80] = "Galaxy: version 1.0 13/6/85";
XX
XX /*
XX * A few helpfull hints about galaxy's save file structure:
XX
XX--- 32,38 -----
XX
XX int SWITCH_FLAG;
XX
XX! char version[80] = "Galaxy: version 1 6/9/84";
XX
XX /*
XX * A few helpfull hints about galaxy's save file structure:
XX*** terminal.c Fri Jun 14 18:55:36 1985
XX--- compare/terminal.c Fri Jun 14 18:53:55 1985
XX***************
XX*** 182,188
XX if (ttyc -> t_curpage == 0)
XX ttyc -> t_curpage = 1;
XX else {
XX! init_disc ();
XX ttyc -> t_curpage = 0;
XX }
XX }
XX
XX--- 182,188 -----
XX if (ttyc -> t_curpage == 0)
XX ttyc -> t_curpage = 1;
XX else {
XX! init_dis ();
XX ttyc -> t_curpage = 0;
XX }
XX }
SHAR_EOF
if test 1324 -ne "`wc -c diffsrc`"
then
echo shar: error transmitting diffsrc '(should have been 1324 characters)'
fi
echo shar: extracting makefile '(1215 characters)'
sed 's/^XX//' << \SHAR_EOF > makefile
XX# This makefile belongs to ~galaxy/src1.
XX# %W% (mrdch&amnnon) %E%
XX#
XX
XXLIBDIR = /usr/games/lib/galaxy
XXGAMES = /usr/games
XXECHO = /bin/echo
XXCFLAGS = -O -s
XX
XXall: okgalaxy pager local edscore
XX @${ECHO} Utility files are up to date.
XX
XXokgalaxy: okgalaxy.c
XX cc ${CFLAGS} -o okgalaxy okgalaxy.c
XX
XXpager: pager.c
XX cc ${CFLAGS} -o pager pager.c
XX
XXlocal: local.c
XX cc ${CFLAGS} -o local local.c
XX
XXedscore: edscore.c constants.h score.h
XX cc $(CFLAGS) -o edscore edscore.c
XX
XX.DEFAULT:
XX sccs get $@
XX
XXclean:
XX /bin/rm okgalaxy pager local edscore
XX
XXinstall: okgalaxy pager local edscore
XX cp pager local edscore ${LIBDIR}
XX chown galaxy ${LIBDIR}/pager
XX chown galaxy ${LIBDIR}/local
XX chown galaxy ${LIBDIR}/edscore
XX chmod 755 ${LIBDIR}/pager
XX chmod 755 ${LIBDIR}/local
XX chmod 755 ${LIBDIR}/edscore
XX cp galaxy.csh ${GAMES}/galaxy
XX chown galaxy ${GAMES}/galaxy
XX chmod 755 galaxy.csh
XX cp okgalaxy ${GAMES}/okgalaxy
XX chown galaxy ${GAMES}/okgalaxy
XX chmod 4111 ${GAMES}/okgalaxy
XX cp galaxy.motd ${LIBDIR}
XX chown galaxy ${LIBDIR}/galaxy.motd
XX chmod 600 ${LIBDIR}/galaxy.motd
SHAR_EOF
if test 1215 -ne "`wc -c makefile`"
then
echo shar: error transmitting makefile '(should have been 1215 characters)'
fi
echo shar: extracting READ_ME '(522 characters)'
sed 's/^XX//' << \SHAR_EOF > READ_ME
XX# %W% (mrdch&amnnon) %E%
XXThis directory holds the service programs, used by galaxy.
XXThe make will make it all. Read before using.
XX
XXSome remarks:
XX"galaxy.csh" is the front end of the whole game. It enables
XX posting of some remarks through a motd file in
XX /users/games/lib/galaxy.
XX"edscore" enables paging through the score file for editing
XX purpose. Use whenever necessary.
XX"okgalxy","pager" and "local" are programs to establish
XX communication when the game starts.
XX
XX mrdch & amnnon
SHAR_EOF
if test 522 -ne "`wc -c READ_ME`"
then
echo shar: error transmitting READ_ME '(should have been 522 characters)'
fi
echo shar: extracting constants.h '(3659 characters)'
sed 's/^XX//' << \SHAR_EOF > constants.h
XX/*
XX * %W% (mrdch&amnnon) %E%
XX */
XX
XX/*
XX * this file contains all the constants used by the game.
XX */
XX
XX# define HOME "/usr/games/lib/galaxy/"
XX# define LOCAL "/usr/games/lib/galaxy/local"
XX# define WIZFIL "/usr/games/lib/galaxy/wizards"
XX# define GALSCOR "/usr/games/lib/galaxy/galaxy.scor"
XX# define ONLINE "/usr/games/lib/galaxy/online/"
XX# define PAGER "/usr/games/lib/galaxy/pager"
XX
XX# define ESPSIZ 8 /* max nesting of espionage */
XX# define MAXSHIPS 7 /* how many types of ships */
XX# define MAXPL 91 /* how many planets are there */
XX# define PLKINDS 5 /* how many kinds of planets */
XX# define MAXCHAN 2 /* maximum no. of chanels to open */
XX
XX# define NCREW 64 /* no. of fighters in A-type HAWK */
XX# define VISITORS 128 /* no. of additional people */
XX# define MSGSIZ 150 /* max chars in a single masseg */
XX
XX# define CLASES 6 /* how many clases of people */
XX
XX# define FIGT 0 /* fighters */
XX# define CITI 1 /* citizens */
XX# define SCIE 2 /* scientists */
XX# define BUIL 3 /* builders */
XX# define MINE 4 /* miners */
XX# define SLAV 5 /* slaves */
XX
XX# define ESPTYP 7 /* different types of espionage: */
XX
XX# define ESPKIND 0 /* what kind of planet is it */
XX# define ESPPOP 1 /* how many people are there */
XX# define ESPKNOW 2 /* what is the knowledge level */
XX# define ESPMTL 3 /* how much metal was digged out */
XX# define ESPSHIP 4 /* what are the forces there */
XX# define ESPALM 5 /* how many ALM were installed */
XX# define ESPMSL 6 /* how many missiles are there */
XX
XX# define BUILD_MONEY 0 /* MONEY given to build ships */
XX# define LEVEL 1 /* the LEVEL of ships ordered build */
XX# define NSHIPS 2 /* the NO. of ships ordered build */
XX
XX# define N_PSI 20 /* max possible messages on screen */
XX
XX# define ALMCOST 100 /* how much costs 1 ALM */
XX# define REMOVE_COST 50 /* to remove one if yours */
XX# define ALM_KILL_COST 200 /* to remove from the enemy's planet */
XX
XX# define YEARLENGTH 180 /* a turn is 3 min. */
XX# define PERC_TRADE 5 /* the minimum % of profit in trade */
XX# define PERC_POPUL 10 /* the % of natural growth */
XX# define FEED_RATIO 100 /* no. people fed by 1 teller a year */
XX# define MINING_FACTOR 100 /* years_manpower 1A metals */
XX# define KNOW_FACTOR 2000 /* years_manpower to raise 1 level */
XX# define SHIP_COST 100 /* basic cost factor to build ship */
XX# define MISSILE_COST 400 /* to put a A-type missile */
XX# define REDUCE_RATE 10 /* detecting lost effect % in a year */
XX# define FADE_RATE 25 /* undetection paint fading rate */
XX
XX# define MIN_ESP 100 /* the minimum to report ANYTHING */
XX# define KIND_ESP MIN_ESP /* to find out the planet's type */
XX# define POPUL_ESP 5*MIN_ESP /* for it's population */
XX# define KNOW_ESP 3*MIN_ESP /* the level of knowledge there */
XX# define METAL_ESP 2*MIN_ESP /* how much metal has he */
XX# define FORCE_ESP 10*MIN_ESP /* what are his forces there */
XX# define ALM_ESP 2*MIN_ESP /* how many alms he's got */
XX# define MSL_ESP 8*MIN_ESP /* how many missiles he set there */
SHAR_EOF
if test 3659 -ne "`wc -c constants.h`"
then
echo shar: error transmitting constants.h '(should have been 3659 characters)'
fi
echo shar: extracting edscore.c '(1888 characters)'
sed 's/^XX//' << \SHAR_EOF > edscore.c
XX/*
XX * %W% (mrdch&amnnon) %E%
XX */
XX
XX# include <sys/types.h>
XX# include "constants.h"
XX# include "score.h"
XX# include <stdio.h>
XX
XXchar *tmpf = "/usr/games/lib/galaxy/scoreXXXXXX";
XXchar *ctime ();
XXint tmp,
XX sc;
XX
XXmain () {
XX struct score s;
XX char c;
XX long time();
XX
XX sc = open (GALSCOR, 0);
XX if (sc < 0) {
XX perror (GALSCOR);
XX exit (1);
XX }
XX tmp = creat (mktemp (tmpf), 0600);
XX if (tmp < 0) {
XX perror (tmpf);
XX exit (1);
XX }
XX
XX while (read (sc, &s, sizeof (s)) == sizeof (s)) {
XX if (c != 'q') {
XX char *str,
XX *index ();
XX str = ctime (&s.played_at);
XX *index (str, '\n') = '\0';
XX printf ("%s,%s %d %s ", s.win, s.los, s.years, str);
XX c = getchar ();
XX if (c != '\n')
XX while (getchar () != '\n');
XX }
XX switch (c) {
XX case 'd':
XX break;
XX case 'q':
XX default:
XX write (tmp, &s, sizeof (s));
XX break;
XX case 'a':
XX write (tmp, &s, sizeof (s));
XX printf("winner ? ");
XX gets(s.win);
XX printf("looser ? ");
XX gets(s.los);
XX printf("years ? ");
XX rint(&s.years);
XX s.played_at = time(0);
XX write(tmp, &s, sizeof(s));
XX break;
XX }
XX }
XX if (unlink (GALSCOR) < 0) {
XX fprintf (stderr, "unlink ");
XX perror (GALSCOR);
XX exit (1);
XX }
XX if (link (tmpf, GALSCOR) < 0) {
XX fprintf (stderr, "link ");
XX perror (GALSCOR);
XX exit (1);
XX }
XX if (unlink (tmpf) < 0) {
XX fprintf (stderr, "unlink ");
XX perror (tmpf);
XX exit (1);
XX }
XX exit (0);
XX}
XX
XXrint(i)
XXint *i;
XX{
XX char s[100];
XX gets(s);
XX *i = atoi(s);
XX}
SHAR_EOF
if test 1888 -ne "`wc -c edscore.c`"
then
echo shar: error transmitting edscore.c '(should have been 1888 characters)'
fi
echo shar: extracting galaxy.csh '(173 characters)'
sed 's/^XX//' << \SHAR_EOF > galaxy.csh
XX#! /bin/csh -f
XX#
XX# %W% (mrdch&amnnon) %E%
XX#
XX
XXset motd = "/usr/games/lib/galaxy/galaxy.motd"
XX
XXif ( -e $motd && $#argv == 0) cat $motd
XX
XX/usr/games/lib/galaxy/galaxy.out $argv
SHAR_EOF
if test 173 -ne "`wc -c galaxy.csh`"
then
echo shar: error transmitting galaxy.csh '(should have been 173 characters)'
fi
echo shar: extracting galaxy.motd '(214 characters)'
sed 's/^XX//' << \SHAR_EOF > galaxy.motd
XX
XX Wellcome to the Universe of Galaxies!!!
XX
XXIf that's your first time to try galaxy, I hope you have
XXread the manual first. If not, hit 'del' to exit and
XXthen do 'man galaxy'.
XX
XX Enjoy your journey!!!
XX
SHAR_EOF
if test 214 -ne "`wc -c galaxy.motd`"
then
echo shar: error transmitting galaxy.motd '(should have been 214 characters)'
fi
echo shar: extracting local.c '(623 characters)'
sed 's/^XX//' << \SHAR_EOF > local.c
XX/*
XX * %W% (mrdch&amnnon) %E%
XX */
XX
XX# include <stdio.h>
XX
XXstruct chan
XX{
XX int ichan ;
XX char c ;
XX} ;
XX
XX/*
XX * this file is invoked to create TWO reading processes.
XX * Each process reads from it's respective terminal,
XX * and writes it to the main process.
XX * The SOURCE is identified by the "ichan" no.
XX */
XXmain(ac, av)
XXint ac ;
XXchar **av ;
XX{
XX struct chan c ;
XX if(ac != 2)
XX exit(1) ;
XX
XX c.ichan = atoi(av[1]) ;
XX while(!feof(stdin))
XX {
XX c.c = getchar() ;
XX write(1, (char *)&c, sizeof(c)) ;
XX }
XX exit(0) ;
XX}
SHAR_EOF
if test 623 -ne "`wc -c local.c`"
then
echo shar: error transmitting local.c '(should have been 623 characters)'
fi
echo shar: extracting okgalaxy.c '(1453 characters)'
sed 's/^XX//' << \SHAR_EOF > okgalaxy.c
XX/*
XX * %W% (mrdch&amnnon) %E%
XX */
XX
XX# include <stdio.h>
XX# include <signal.h>
XX# include <sys/types.h>
XX# include <sys/stat.h>
XX
XXstruct stat stbuf ;
XXchar *tty ;
XX
XX/*
XX * The reason for this file is that usually there is no READ
XX * permission on someone else terminal. Giving this command
XX * enables the main game to read whatever is typed by the
XX * second player, and interpret his commands.
XX */
XXmain()
XX{
XX char *ttyname() ;
XX int doexit() ;
XX
XX tty = ttyname(0) ;
XX
XX if(tty == 0)
XX {
XX fprintf(stderr, "Don't know you.\n") ;
XX exit(1) ;
XX }
XX
XX/*
XX * collect terminal situation in a temporary buf.
XX */
XX stat(tty, &stbuf) ;
XX/*
XX * prepare for leaving the game when it's all over.
XX */
XX signal(SIGINT, doexit) ;
XX signal(SIGQUIT, doexit) ;
XX signal(SIGTSTP, doexit) ;
XX
XX/*
XX * try to make the terminal readable to all.
XX */
XX if(chmod(tty, 0666) == -1)
XX {
XX fprintf(stderr, "Your tty ain't yours.\n") ;
XX exit(1) ;
XX }
XX
XX/*
XX * all went fine, relax and let the originator to catch up.
XX */
XX printf("Please wait.....") ;
XX fflush(stdout) ;
XX
XX/*
XX * Suspend all activity. To exit this mode after the game
XX * has finished, one needs to interrupt it with a keybourd
XX * signal.
XX */
XX pause() ;
XX}
XX
XX/* restore terminal mode to original state. */
XXdoexit()
XX{
XX chmod(tty, stbuf.st_mode) ;
XX exit(0) ;
XX}
SHAR_EOF
if test 1453 -ne "`wc -c okgalaxy.c`"
then
echo shar: error transmitting okgalaxy.c '(should have been 1453 characters)'
fi
echo shar: extracting pager.c '(563 characters)'
sed 's/^XX//' << \SHAR_EOF > pager.c
XX/*
XX * %W% (mrdch&amnnon) %E%
XX */
XX
XX# include <stdio.h>
XX
XXmain(ac, av)
XXint ac ;
XXchar **av ;
XX{
XX FILE *tty ;
XX
XX if(ac != 3)
XX getout("arg count") ;
XX
XX tty = fopen(av[1], "w") ;
XX if(tty == NULL)
XX getout("cannot open terminal") ;
XX
XX fprintf(tty, "\07\07%s would like to play galaxy with you.\n\r",av[2]) ;
XX fprintf(tty, "\07\07If you wish to play exec /usr/games/okgalaxy\n\r") ;
XX
XX exit(0) ;
XX}
XX
XXgetout(s)
XXchar *s ;
XX{
XX fprintf(stderr, "pager: %s.\n", s) ;
XX exit(1) ;
XX}
SHAR_EOF
if test 563 -ne "`wc -c pager.c`"
then
echo shar: error transmitting pager.c '(should have been 563 characters)'
fi
echo shar: extracting score.h '(436 characters)'
sed 's/^XX//' << \SHAR_EOF > score.h
XX/*
XX * %W% (mrdch&amnnon) %E%
XX */
XX
XX/*
XX * this file defines the score information structure.
XX */
XX
XXstruct score /* score log structure */
XX{
XX char win[20] ; /* winner name */
XX char los[20] ; /* looser name */
XX int years ; /* game years played */
XX time_t played_at ; /* date played at */
XX} ;
SHAR_EOF
if test 436 -ne "`wc -c score.h`"
then
echo shar: error transmitting score.h '(should have been 436 characters)'
fi
# End of shell archive
exit 0