0% found this document useful (0 votes)
224 views

Basic Software Library Volume 4 - General Purpose Programs

Uploaded by

manonpiano
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
224 views

Basic Software Library Volume 4 - General Purpose Programs

Uploaded by

manonpiano
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 156

-

I B·RARY ·~- •

q,.; ' ,,..

.,I..
. ,.. e- . ...
UME

., \

by R.W.
BASIC
E

L ME IV

GENERAL
PURPOSE
PROGRAMS
THIS BASIC SOFTWARE LIBRARY IS MADE AVAIL
ABLE, FREE OF RESTRICTIONS AND ROYALTIES
TO SCHOOLS, COLLEGES, UNIVERSITIES, INDI-
VIDUALS, HOBBYIST & BUSINESS CONCERNS FOR
USE ON THEIR OWN COMPUTERS AND OR COMPUT-
ING SYSTEMS. REPRODUCTION IN ANY PART OR
FORM OF THIS ENTIRE LIBRARY IS STRICTLY
FORBIDDEN. USE OF ANY PART OR FORM OF THIS
ENTIRE LIBRARY FOR COMMERCIAL USE OF ANY
KIND IS STRICTLY FORBIDDEN WITHOUT THE EX
PRESSED WRITTEN PERMISSION OF SCIENTIFIC
RESEARCH.

lST. PRINTING - - JANUARY 1977

COPYRIGHT UNDER UCC 1977 BY:

SCIENTIFIC RESEARCH INST.


P.O. BOX 3692
CROFTON, MD 21114

ii
I NT R0 DUCT I 0 N

The pMglta.m6 pJr.uented heJr.e a1r.e !let out 6oJr. :the .i.ndlv.ldual who hJu a. !lpecl6.ic.
need -ln mln.d. Be.c.a.u.6e a. de,t.a.,U.e.d dlilc.wi.&ion 06 :thue plloglta.m6 would Jr.e.qu.Ute. a.
text .&e.ve.Jutl :Umu the. p1r.ue.nt .&ize. 06 .t1U..6 UbJUVr.y it hall been omltted. Indl-
v~ who have a. llpe.cl6)..c Jr.e.qu.Ute.me.nt wil.i. have to be a.t lea.6t knowledge.able.
.i.n :the. a1r.e.a :the. pMgJtam ill WILUte.n a.bout; -le: S:ta.ti..6Uc.o.i. plr.OgJt.alnil Jr.eq<Wte :the
u..6eJL i:iJ be. fia.mi.Utvr.. w.Uh :the te/IJ'lll; me.an, meclla.n, etc. Th-l.6 ill bec.a.u.6e :the pM-
gJtalnl> a1r.e WILU.ten bt :the veJr.na.culaJl. o 6 :thw ll ub j e.ct matte.Jr.. WUh th-l.6 know-
tedg e. a.lane., no pMgl!.aJ1lmi..ng expvvi.ence. on :the palr.t ofi :the u..6eJr. .l6 Jr.eq<Wted .i.n
oJr.deJL to U6e a.ny 06 :thue pMgJt.alnll -ln mollt llyllte.mll. Once. U ill de:te.Junbted :that
a. palr.UCJda.Jr. pMgJUJm may be 1U>e6ui. the U6eJr. meJr.ely typu -ln a. copy 06 :the BASIC
i.oWtc.e code exa.V:ly dll U a.ppetVr..6 bi :the pJr.OgJt.am LUiUng. Then 6oUaw :the .ln-

.ed:Jr.ucti.on!l 601t. JtWUt..i.ng the pJr.OgJt.am M pll.Me.nted .i.n the. In.&bw.ction poll.Uon 06

:the WIU:te up, -i.mme<Lia.te.ly pJt.ecedlng :the. pMgJr.am. Af...60 -lnci.uded .i.n the WIU:te upll
Me llW:e.men.h that a.ppe.a.Jr. .i.n :the lloWlce code which ma.y poll!libty need to be
changed to Jr.u.n .i.n the. U6Vl' ll c.omputeJL lly4:te.m; .le: Rf.JV t.W:e.men.h may have. to be
c.hanged to FRANV .i.n oJr.deJL to c.ompUe ,fo c.eJL.ta..ln .6 y.6te.m.6.

PUBLISHERS NOTE: Appendix B included at the end of Volume V was not


mentioned in the preface by the author. We feel this appendix is
the most important single item included in this library. We see
this appendix as a fore runner that might lead the way toward
standardizing a computer language among the manufacturers. This is
in addition to the obvious benefits to all users of this Basic
Software Library.

iii
iv
TABLE OF CONTENTS
VOLUME ONE
Preface
Part 1 - Business & Personal Bookkeeping Programs
NAME DESCRIPTION
Bond Computes price and interest for bond purchases.
Building Analyzes the cost of building design proposals.
Compound Computes effective compound interest rates.
Cyc Ii c Determines seasonal coefficients for two cycles.
Decision 1 Makes a lease/buy decision for you.
Decision 2 Makes a decision on whether to buy a component or make it.
Depreciation Calculates depreciation by 4 different methods.
Efficient Cal. the most efficient assignment of resources and/or personnel.
Flow Predicts your yearly cash flow.
lnstal lment Performs monthly installment accounting.
Interest Computes interest accruals, monthly.
Investments Computes annual rates of return on investments.
Mortgage Makes a comparison of mortgage terms.
Optimize Optimizes the layout for a plant, shop, office, etc.
Order Determines your economic order quantity for inventory items.
Pert Tree Performs an analysis of a pert network.
Rate Computes true annual interest rates.
Return 1 Computes lessor's rate of return for uncertain assets.
Return 2 Computes a lessor's rate of return after taxes.
Schedule Schedules N jobs in a shop with M machines.

Part 2 - Games & Pictures


NAME DESCRIPTION
Animals Four Teach the computer all about animals.
Astronaut Land your spaceship on another planet.
Bagel Advanced number game, numbers may be algebraic, few clues.
Bio Cycle Calculate your Bio-Life Cycle and plan your days.
Cannons An advanced war game with big guns.
Checkers Plays a regulation game of checkers.
Craps A dice game with hard way odds.
Dogfight Air fight w/missiles; betweeen a phantom and a mig.
Golf Plays any number of holes; inc. obstacle course.
Judy Have a rap session with Judy via your computer.
Line Up Simple number game, all you have to do is unscramble them.
Pony Authentic horse race, any number of players.
Roulette Gamblers delight, plays Las Vegas rules.
Sky Diver Sky dive on another planet
Tank A war game between two tanks.
Teach Me Teach the computer to learn new things.

v
TABLE OF CONTENTS
VOLUME ONE (CONTo)
PICTURES
NAME DESCRIPTION
Introduction
A. Newman He's absolutely MADI MADI MADI
J.F.I<. Our 35th. president.
Linus Loveable "Peanuts" character, w/blanket.
Ms. Santa A modern miss to put a twinkle in your eye.
Nixon Former "United States" president.
Noel Noel Christmas or anytime this is a beautiful creation.
Nude A true work of art for anyone's gallery.
Peace A message for all seasons.
Pol iceman True and blue, he's the law.
Santa's Sleigh In banner form, perfect for decorating the mantle.
Snoopy That paragon of Dogdom even plays football.
Virgin A picture you can read as well as see.

TABLE OF CONTENTS
VOLUME TWO
Part 3 - Math & Engineering Programs
NAME DESCRIPTION
Beam Evaluates and selects steel beam sizes.
Conv. Calculates convolutions.
Filter Calculates low pass filter components.
Fit Performs interpolations by spline fits.
Integ ration 1 Uses Gaussion Quadrature to do integration.
Integration 2 Integrates a function by spline fits.
Intensity Cale. and plots RF or Acoustic intensities.
Lola Cale. Long. and Lat. from interstellar fix or distance.
Macro Simulates a language compiler.
Max. Min. Cale. the max. & min. values of funct. over a spec. interval.
Nava id Cale. position from altitude and azimuth of celestial bodies.
Optical Calculates Blackbody energies, w/filter look-up tables.
Planet Calculates Sun and Moon positions, hourly.
PSD Calculates Power Spectral Densities and FFT's.
Rand 1 Generates random numbers between 0 and 1.
Rand 2 Generates random integers between (X) and (Y).
Solve So 1ves po 1ynomia1 s by ''Bai rs tows Method''.
Sphere Tri an Solves any spherical triangle.
Stars Locates 50 stars (celestial).
Track Cale. course and distance and incremental vectors.
Triangle Solves for all parts of any triangle.
Variable Finds all variables in Basic programs.
Vector Cale. final position; given start and motion vectors

vi
TABLE OF CONTENTS
VOLUME TWO (CONT,)

Part 4 - Plotting & Statistics Programs


NAME DESCRIPTION

Binomial Calculates binomial probability distributions.


Chi-Sq. Applies the Chi-Square test to samples.
Coef f Cale. coefficients of fourier series to apprx. a function.
Confidence 1 Calculates confidence limits on linear regressions.
Confidence 2 Calculates confidence limits for a sample mean.
Correlations Performs auto and cross correlations with plots.
Curve Fits 6 different curves by the least squares method.
Differences Calculates difference of means in non-equal variances.
Dual Plot Plots two functions on the same sheet.
Exp-Dlstri Calculates exponential distributions for a sample.
Least Squares Performs least squares fit by linear, exp., or power function.
Pai red Compares 2 groups of data using the rank test.
Plot Plots 6 equations on the same sheet.
Plotpts Plots data points on standard teletypes.
Polynomial Fit Performs least squares polynomial fit.
Regress ion Performs multiple linear fit with or without transformations.
Stat 1 Finds the mean, variance and standard deviation.
Stat 2 Computes various stat. measures for a variable.
T-Distribution Calculates normal and T-distributions.
Unpaired Compares 2 groups of unpaired data.
Variance 1 Performs one way analysis of variances.
Variance 2 Analyzes a variance table of one way random design.
xv Plots functions of X and V.

APPENDIX A- BASIC STATEMENT DEFINITIONS

TABLE OF CONTENTS
VOLUME THREE
Part 5 - Advanced Business Programs
NAME DESCRIPTION

Bi 11 i ng Performs posting and billing of accounts.


Inventory Maintains data for inventory records.
Payroll Computes payrolls with full set of deductions.
Risk Performs a risk analysis on capital investments.
Schedule 2 Performs the most effi. scheduling of men or resources to loca.
Shipping Solves the problem of scheduling and assignments.
Stocks Computes the value of stocks.
Switch Calculates the effects of a bond switch.

vii
TABLE OF CONTENTS
VOLUME FOUR PAGE
General Purpose Programs
NAME DESCRIPTION
Bingo An age old favorite. 11 B9, C23, D4, E13, F21, BINGO! 684
Bonds Computes the yields for a bond for different periods. 690
Bull If you ever dreamed of being a Matador, here's your chance. 696
Enterprise Take charge of the Enterprise while Capt. Kirk is on leave. 702
Footba 11 Authentic NFL version of this well known sport. 710
Funds 1 Calculates long-term predictions of funds. 722
Funds 2 Plots the results of Funds 1. 728
Go-Moku Ancient Chinese game of chance. 736
Jack Plays Blackjack, las Vegas style. 742
Life Life is truly a battle for survival, a real challenger! 750
loans Calculates annuities, loans and mortgages. 763
Mazes Generates unique maze puzzles for you to solve. 771
Poker Five card draw - for up to 5 players. 777
Popul Performs population projections for defined areas. 784
Profits Determines the profitability of a firms various depts. 787
Qubic 3-Dimensional Tic-Tac-Toe. 791
Rates Cale. the effective annual interest rate for stated interest. 799
Retire Calculates your Civil Service Retirement benefits. 803
Savings Computes savings plan profiles. 808
SBA Calculates repayment schedules for SBA loans. 811
Tic-Tac-Toe An all time favorite for young and old alike. 817

TABLE oF CONTENTS
VOLUME FIVE
Experimenter's Programs
NAME DESCRIPTION
Andy Cap Draws this famous cartoon character.
Baseba 11 Plays a full 9 innings of baseball.
Compare Compares two groups of data.
Conf id 10 Determines the confidence limits for a normal population.
Descrip Provides a description of uni-variant data.
Differ Computes the diff. of the means for data of equal variance.
Engine Calculates the otto cycle of engines.
Fourier Th!s program evaluates fourier series.
Horse Draws a picture of a horse.
Integers Computes integers as the sum of other integers.
Logic Determines conclusions from logic statements.
Playboy Draws the playboy symbol.
Primes Factors numbers into their primes.
Probal Cale. Chi-Sq. and probabilities from 2X2 data sets.

viii
TABLE OF CONTENTS
VOLUME FIVE (CONT,)
Experimenter's Programs
NAME DESCRIPTION
Quadrac Solves quadratic equations
Red Baron Draws a picture of the infamous Red Baron.
Regression 2 Calculates linear regressions.
Road Runner "Beep! Beep!" Draws a picture of the Road Runner.
Roulette Computerized "Wheel of Fortune 11 , plays roulette.
Santa Old Saint Nick appears as jolly as ever.
Stat 10 Calculates quantities for two groups of paired data.
Stat 11 Computes sample statistics.
Steel Calculates steel beam capacities.
Top Computes cost for surfacing a road or driveway, etc.
Vary Performs an analysis of a vari. table; one-way random design.
Xmas Gene rates a 11 S I NG I NG" Christmas ca rd.

APPENDIX B - STATEMENT CONVERSION ALGORITHMS

TABLE OF CONTENTS
VOLUME SIX
A Complete Business System
NAME DESCRIPTION
Ledger Maintains ALL Company accounts and generates ALL financial
reports. Includes routines for: Pyrl, Inv, Depr, A/R, A/P,
Balance Sheets and Profit & Loss statements, etc.

ix
x
PREFACE
The information contained in these pages represents the culmination of a
very large project. That of compiling a versatile and complete Software
Library that will be of use to a large number of diverse individuals. The
programs presented here when combined in a system will represent a very
powerful 1 ibrary bank. Such a work as this has been attempted in the past
in such areas as cook books, electronic source books, mathematical tables
and even computer games. But to date such a collection as this has yet to
be offered to the average individual to use as he chooses. The word 11 at-
temped11 was used as no work is ever considered complete by everyone regar
dless of its thoroughness.

The programs presented here were chosen for their uniqueness and general
usefulness. There should be at least one program included that will be of
use to every type of individual whether they have access to a computer or
not. Computers are a wonderful and very useful tool. Through this Library
I hope to interest more people into becoming involved with computers. The
Library is written so that little or no computer programming experience
is required to invoke any of the programs. The programs that are present-
ed here are all written in the computer language called BASIC. Each pro -
gram has been successfully run on a G.E. 635 computer. The entire source
code is presented as well as a short narrative page which defines the pro
gram, tells who might be interested in using it, a brief set of instruc-
tions or how to get them and then any limitations in the program are no-
ted. In the limitations section the storage length in K Bytes is given so
the prospective user will know how much memory to allow for the program.
Where possible the amount of memory space required for full execution is
given for the programs, this space is independent of the space already oc
cupied by your BASIC compiler.

The programs are broken down into five sections or parts. Each part deals
with a specific type of program. Part 1 contains business type programs.
These programs will be of interest to individuals who have businesses,
play the stock market, balance their own checkbooks, do installment buy-
ing, figure taxes, etc. There are a total of 20 programs in this section.
Part 2 is the lighter side of the Library as it contains 16 games and 12
picture programs. No computer library is complete without some fun. Among
the games presented in this section is one called Checkers. The game is
rather long but it is virtually machine independent as it doesn 1t use over
lay techniques or use files. Most of the other games included here are as
exciting as this version of Checkers. Each was chosen so as not to mimic
others that the reader may have seen. The pictures are as unusual in their
own way as are the gan~s. Most of the pictures are spread over several pa
ges, this was done not only so the reader will need to run the program to
see the details of a particular picture but also in the hopes of getting
as many of these programs into use as possible. As the picture programs
are very simple it is an easy place for the novice to start learning about
programming.

Part 3 is comprised of Math and Engineering programs. Some of these programs


will be of use to high school students, professional people, sailors, engi-
neers, astronomers, airplane pilots, etc. Most of these programs are very

xi
technical but they can perform every day calculations quickly and easily
and they are extremely simple to use. There are 23 general usage programs
presented in this section.
Part 4 is made up of Plotting and Statistical Analysis programs. These
programs can be readily utilized by a number of people In widely differ-
ent disciplines from fishermen to statisticians. The data gathered may
be from a poll, a census, a te~t sample or even the number of fish cau-
ght on various days. The stat programs will be of invaluable aid to any-
one who gathers data of any kind. The plotting routines wi11 be of use
to most of the people who use the stat programs or programs in Parts 1
and 3. The plotting is done on any standard teletype or terminal and
does not require a special plotter or plotting terminal. There are a tot
al of five direct plotting programs and 18 stat programs in this section.
A11 of the programs presented here may be run by simply typing the source
code as listed, exactly as it is, into your computer. Now before the pro-
gram will run it will have to be converted into machine code. This is done
automatically and requires no forethought except to make certain the oper-
ating system you are working in is BASIC. In the larger computer systems
you are asked what system you want to this type BASIC; the smaller sys
terns only have BASIC, in these you are O.K.
Immediately following Part 4 is Appendix A. Here, all of the Basic State-
ments used throughout these pages are defined. Each statement is explained
sufficiently well to enable one unfamiliar with this subset to modify any
necessary statements so that the program or programs wl11 compile and exe-
cute with the Basic compiler or interpreter available with their particu-
lar computer. Most of the Basic compilers available today, that require
more then 10K Bytes of storage, will execute all of the programs presented
in these volumes with the possible exception of a few of the games and the
program "Variable". Multiple 1ine statements are not used in most of the
programs and only a few programs use string manipulations extensively. A
few of the programs may require more on line storage then is available on
some of the sma11 micro computer systems; these longer programs will not
be executable due to the limited amount of memory. However most of the
programs will execute in 10K Bytes of memory or Jess, thereby making most
of the programs in this Library executable in virtually any Basic speaking
computer without any required modifications.
Volume I II is comprised of ADVANCED BUSINESS programs, part 5. This volume
as well as subsequent volumes are intended to make this Library complete
and useful to al 1 Individuals.
Each of these programs are written in a subset of the Dartmouth language.
The specific subset is that which was used by General Electric on their
635 systems. These programs have operated without problem on a variety of
small and Jarge machines even several of the new micro computers. The pro
grams that use string manipulations may require slight modifications be-
fore fully executing on some systems. These programs are mainly found in
Part 2 ~ Games.

xii
All of the programs in this Library were written or edited by the author.
All of the programs edited by him were given for Inclusion, "swapped" for
traded, or made publ le. A few of the original authors of the "swaps" are
not known, for this I apologize. The others, unless specifically mentioned
In the text, are presented here. In addition I would like to thank the fol
lowing for their cooperation in making this work possible.

ACKNOWLEDGMENTS

M Y W I F E MA R Y A N D M Y F A M I L Y

DONALD ALVAREZ G E T I ME S H A R I N G
DAVE B E E T L E B I L L J 0 NE S
M0 R T 0 N B E R G E R GE 0 RGE L0 NG
C0 P Y CAT I NC T 0 M R 0 S E

A R T W0 R K C 0 U R T E S Y 0 F ME L I S S A

xiii
xiv
GENERAL

PURPOSE

PROGRAMS
BINGO:
DESCRlPTION
This program simulates that old family favorite 11 Bingo 11 • The game is played
between you and the computer, although another may play using the computer's
card. The computer will tumble the balls and select the numbers at random.

USERS
Individuals who enjoy matching their luck against chance will like playing
this game. Bingo will also appeal to persons who enjoy a leisure game of
chance without the tension of house betting.

INSTRUCTIONS
After the program is loaded into memory type RUN. All necessary instructions
and inputs will be prompted as this program is self instructing. For a de-
tailed operation of the game, list the program.

LIMITATIONS
This program uses two dimensional arrays; see line 210. Line 230 contains a
Restore statement and line 490 contains a SPC ( ) statement. The SPC ( )
statement is used to set the print position for the Bingo cards and could be
replaced by a TAB ( ) statement, if your instruction set does not include the
SPC ( ) instruction. A definition of the SPC ( ) statement can be found in
Appendix A, in Volume II. The source code requires 6K Bytes of memory for stor-
age and the program will execute in most 8K Basic compilers in only 7K Bytes
of memory, this is in addition to the amount of memory required to store your
Basic compiler.

684
(=1 j 1C1 FiE!.;1
i·~'.:i t :: i~i
1
F~FJ:·J
~~~: ::t: =::~: n-f 1L ; i
!."'•
r.:=F f) C;t?f~ t·!
1 ~6: :~t;
=-=~ ::;:: ~-;-: ~~ ::::: ;¢:: ~!: :,-::: ::;:-:

i:'.'i j 7'0 F'RHff H\'OU fiF£ t!CIL·I r~OH·iC:i TO PLAY !-'":! CC!i"'!F'UTEPIZE:D IJ[F-'.'.~;ION OF HHiCO-·-"
01 :::fi LET F= 1
r1 c::o~:::; LET w=O
0210 DIM BC10, 101
0220 nIM LC7'5J,Fl$(5)
1~~C ::::!~~1
1
~~E~:;TCIF.'E
0240 READ A$(1J,A$(?),8$C3J,A$C4l,A$(5)

(i2.{(i FCIF.~ ~( l = 1 TC.I ·-;::ir5


0280 LET LCK1J=0
0?9(i HD<T f<1
1~:r:~:~~=n~1 I t·rr u 11 !i
F'F~ If

0 3 i !] IF F >j THFJ·i 340


~;'i:;:;:·o PR I MT" '/1."!UF' CflF.:D"
c:::=:::::o
GOTO 3'50
034f.1 PR Hff l! MY CflF:'fl II
0::;::~;0 LET M=16
036li LET G=F+4
037'0 FOR Y=F TO G
0380 FOR X=F TO G
0390 LET R=INTCM~RNDCQll
0400 IF R<M-15 THEN 330
0410 IF LCRJ()0 THE~ 390
~'14C.:0 LET f: C=<~ \'l =R
('143C1 LET L(F.'.)=1
(-:1.:.l4li i"·iE>=:T >::
045(i LET M=M+15
Ci 4 f.(i t·iD<T \'
047'(1 PEM THJ'.::; SEOUEtlCE. F'PH-ff'.::; THE CFH?D (L_If"-i[::;; 440-6712!)
04::::i;::1 F'PHff

685
8540 FOR Y=F TO G
O:='i'::~!2l IF f:C:=:,Y)=PfF+c.·,F+E'.) THDJ 5::;:0
0560 PRINT BCX,Yl ,T~B(1J;

c1~s·::i!21 r·1E::-=:·r \'


Ci 1::a~~1i~i t"1E::-::T ;:.::
('16 i 0 PP I t·ff
062~3 PPHff
0 630 PP I t·ff
064Ci PF-'. I MT TFiB ( 9) ; 11
-·-··------·--·------·--------·-·------·--- -----·--------·--------·-· --------·

:;=1650 F'P Hff" crrnF· nrF AF""TFP MAC:HJt!E: 1:1uTOMF1TICALL\' ADUAt··ICE'.::; PFIPEPJ 11
~;'l66Ci n:ip V9=1 TU ·:::1
0670 PPHff
~:16:::0 MD·::T ~=::9
0b90 lF F=6 THO~ 720
0700 LET F=6
ff? 10 GOTO E?O
ff?;:'.Ci PF-'. I r·iT
cr?~:::c1 F'R r MT 1··10L·~ 1_,1r:, PE FILL SET ro PLF1\' THE ci=w1r.
11
U'.:;E A PEt·1c r L TO MflF-:K OFF"
o74ti PPHff 11 THE r·1u1··1:t:fP'.::; cin \'OUP CAPr1 AS THEY AF.:E cF1LLED. 11
0?50 PPIMT 11 !'.F'LEF6E PLffi' MY CAF-:tr i=c::; ~·!ELL F1~:: \'OUP m·~n:i"
0760 PF-'It·ff DCtt~' T CET '.;:;MAPT mm TP'r' TO CHEFIT H:;
11 11

07?0 PPHff"BICi BF.:CITHEP LOI.JES YOU."


07::;:0 PPH-IT
o 79c1 PP I rff "F!PE \'OU PE fl DY" ;
O:::(1(1 INPUT R:t
0:::1e IF F.:$·:.: >11 !·-10 11 THD·I ::::50
0:::20 PF.:H-ff

(184(! GOTO 7Bli


0:::5€1 REM
0:::60 FOR Kl =1 TO ?':;
o:::?l1 LET L CK1) =O
'~1:::::::f1 r·1E:=<T ~<. 1
0:::9~3 PRHff
0900 LET BC3,3)=0
0910 LET BC8,8l=0
0920 REM THIS SEQUENCE GENERATES THE BINGO NUMBERS CLIMES 880-1100)
0930 LET U=INTC75~RND(Q))+1
!2194€1 IF L (IJ) <>D THEJ·I 930
~j950 LET L (U) =1

686
~~': 960 F'F' I t-n
i,'1970 IF F'HI.1 !.;~!:! .:· .. ;~· ·rHFl! lOOO
09~=:0 F'P Hff" IT co1·1i:::::; UF' ~ ", n=ri:: c?cn ,
l citJ~] IF. F:t ·II1 t I)) .·· II ~· ·r~·!FJ--i J ~~r~:t1
li~i1ia F'F'.I!iT"THE t!l.. lt·ff:EP I::;: ",T!=!BC::·o·1,
i ~~i2ti GOTO i 100
10::0 IF f:'.MD 10) > •; : , THEJ! l>360
H'i4~i F'PIHT"L·.!E Hfil.1~ 1=1~ ", T;=ff C~ti),
1050 GOTO 1100
i ~~.lE,~=i IF ~~t·iII ( G!) > 0 ::~ ~ri lE~t··i 1j~·r:.iC1
l 07!21 F'P I HT Ip ·:::; 1=1:
i; I! , TAP c:::'.~n '
10'3(~ F'F.~ I t·rr 11 ·rHE t·~E~.::-::-r Ir~~: II , TAI~ f ~~~(~) !i
1 E10 PF'.Hff A$ f H"iT i: CJ- 1) ,.. 1':d +1); U

1120 FOP '/=1 TO 10


j l ~3i~i F'CO~: :~=:=--: i TCI 1(!
114t1 IF Bf><, \') =U T HF:tl 1 c?E.~:;
i 15I] t·it:::-=:T >=:

1 i 7I2i LE~T F==i

11 ·~1(1 LET F=:f~.


1 c'.00 CiOSUI:: 1:::;:10
1 i:'.10 IF i.)==O THEM i ?4C1
1 c'.20 J F L·i= l THEt-1 19C::i0
1 2:30 GOTO ;:::'.050
1. C~4·~3 IF L·-~=(i THEt""i :;i::3(1 1

l ;=:5(i CiCITCi ;::: 1:3tJ


1260 LET BCX,YJ=0
1 ;:'.?(; GOTO 115Ci
1 C:::::::0 REM '.~;[G!UEt"-!CE i: LINES 1270-19~;(!)
TH I'.:; J'.:; TH[ I: HiCiO DETEPM H! H-!Ci
1 ;::::9(i PP Hff
i::::i;::10 FEM THIS I'.:'.; THE UEFffICF!L. CHEO:: FOP F:It!Go:i;i::r,i:;.;.: (L HiES 1c'7(i-14::0)
1 ::::10 LET G=F+4
1 3~::'.0 FOF.'. Y=F TO Ci
1 33~:1 F"OF.'. >='.=F TO G
1340 IF BCX,\')()0 THEN 1460
1350 IF >=>=::F+4 THE.ti 14~i(!
1360 IF F=-6 THH·I i4H'1

i 3'.:,:o PPIMT"YOIY I.IE GOT :=t


1390 LET !1~=l
l 4Ci0 f.;:·ETURti
14 i!~i PP I MT
14E'.0 pp I MT II 'i.)[ COT 1=i
1430 L[T U=

687
1 44~3 CiOTCJ 1470
1 i:.1°5f"i t··JE>=:T ;..:
l ·~-f.1 ~2i t"-IE:=<T tl
1·~70 PEM TH I::;; I·:. TH[ HOP TZO!·ffAL CHECY FOF'. I: I t·K~O**-:.;.; ( l.. I t·it:::'.; 1450-· 1610)
l 4B(i LET !~~==F+4
1490 FOR X==F TO G
J ':';0~3 FOP '-1'=F TO (;
l ::; 1ti IF. B ( >=::: r' :t :::: >~i T!··IE:rt
1
j t::3f~1
1~?A IF Y{F+4 THEN 1620
1 :~;n3~~1 IF F ::::E~ ·rHEJ',i i 5f:t1
1 '540 PRU-ff
1 '::;'':i0 PF:'. I HT II YOU, I.)[ GOT i=1
1 '560 LET L·i== 1
1 i:;7i;::1 !?ETURN
1 '.:i '.::o PF.'. Hff
1 '::i90 F'RHff" I' 1) [ GOT Fl B I t·I G 0 :i;.: :.;.: :.;.: *- '*'"
l 6ti0 LET I):::: 1
161(i GOTO 1650
l 6c~0 ND::T Y
1 t:,::::~~1 t·1E:=·=:T :=<
1 E.40 REM TH I:;::; I::;; THE ·:;LAMT CHECK f M=- l ) FOP F.: I r1GO*'*'~ ( L. I NE::; 16;;::(1-1 77~?1)
1650 LET /=:F
1 E.6(1 LET \'==F
1 i:.70 IF 'B ( ;:.,;, \')<;:.qi THEJ-·! 17::~0
1 E1 ;;:;~J LET ::<=::-::+1
1 t==,·~~i LET 'l=\ +1 1

1 ?(1~3 IF Y< F +'.5 THEJ·I i 670


1710 IF Y=11 THEN 1760
1 ?20 LET ~·~=1
1 7 ·~:(1 PP HIT
17'4ti PRIMT"YOIY UE GOT A B I t··l G 0 '*' '*' *"
1 750 FTTUF~'.N
1 ?6(1 PRHff" PUE COT fl f: I M Ci 0 '*' '*' :.;.: :¢: :.:~ 11

1 7 7(1 LET i..J== 1


1 ?80 F.'.ETUF.'N
179~:1 F.:EM THI:::: E: THE ::;LAMT CHECK (M==1:t FOP BIMCO;.:.:** (LIME'.:; 178(1-195(1)
1 ::;:(1(1 LET >=:=F +4
1 ::: 10 LET Y=::-::
1820 IF BCX,YJ<>0 THEN 1930
1 :::::::~::1 L~ET :=<=:="=:-· 1
1 :::40 LET \'=Y+ 1
1 ;:!5t1 IF Y< F +5 TH Ell 1::::E'.0
1 :::E.(1 IF Y=11 THEN 1910
1 :=;?~i PPIMT
1 ~=:~:::0 PPIMT"YOU, I)[ COT A
1 :::9(1 LET ~·~==1
190(1 PETURM
1910 F'PIMT

688
1 ·;;:;:'.(i LET l.J=-~ 1
t ::r31z; F~ETIJF~t1
1

l ·::140 PEM TH I:::; THI: ·r I [ F'P I r·ffOUT ·::;EOUEJK:[

1 ·;160 PP nn 11 :.;i::.;i::i:i::i:i::i:i::i:i::i:i::i:i::<r::i:i::<i: I r :::; A Tri::: ;.;:-::i:i::i:i::9':.:i::i:i::i:i::i:i::i:t::.:.:*- 11


i ·;1?(1 PEM T!·-II '.::; I·:; THE 11 PLFfr' f1Cifl HI?" ::;:;[OUEtK:[
1 '31 :::(1 F·F.~ I t·~T
1 ·;i·~1(1 PF.'.H!T "DO '/OU l·IAMT TO PL.fl\' AGAH~";
;::::~11210 H1F'UT [:;:
1(1 PPHH
;:'.~JC~~:::i IF E:$=
0
'/E:~:;"
i'.:'.'.~;)·3Ci ':::TCiF 1

c:'.060 FOP. :=:;::1 TC! 6


~:· Cr?~i F F.~ I t·iT u I L:.l I f··l
1
u ,
I! r.

;::'.090 PFUMT
c:'. i 00 PRJ NT
c' 110 GOTO 1 ·;1::::~~1
;::· 12(1 PEM TH I:::; I'.;:; THE II \'OU L·~ It·~ II ·::;E:OUEJ·K:[
c'. i 3(i PR I MT
c'.14~3 PPHff" YOU l_,IHi..... 'r'UU l·HN....... \'OU ~·-IHI ••••••• "

;::'. i 6l'I F.:EM


c::1 ?o am

689
BONDS:
DESCRIPTION
Bonds calculates bond yields to maturity for a bond. The yields are computed
before and after taxes. The user must supply the tax rates, the redemption
value, price, annual coupon and the maturity for the bond before any calcu-
lations are made. This program is more comprehensive then the program BOND.

USERS
Persons or companies interested in investing in bonds, or already having bond
investments could benefit from using BONDS.

INSTRUCTIONS
The input data for the bond may be entered in data statements prior to program
execution or it may be entered after execution through the prompting provided
in the program. After the program has been loaded into memory, type RUN. Bonds
will then ask if you want instructions. There are three valid responses to this
question: YES, NO and DATA. If you answer YES, the program will prompt for the
required inputs. If your response is NO, then you are expected to enter the
seven (7) required data inputs. If the response is DATA, the program will expect
to find the data previously entered in Data Statements prior to operation. Data
for a sample problem is contained in line 190.

LIMITATIONS
The program should execute in most Basic compilers with 5K Bytes of available
memory. The source code requires 4K Bytes of memory for storage.

690
r.;
I I

Li OPE!'! TH I·:::; B1=1::; I c F'F'r"!CiF'AM COf'!P!_fTF.·:; THE: }![FfiPE mm r=iFTEF' Tfl::<


1 H:!FTM \'IELD rn !·11::nUF:'JT\' OF A t:OHD l'IITH Hl·ll·ifli=1L COUF'Oti OF c
1 E'OPE""f'1 DOLLf!F''.:;, Vi"T[i·IF'T I O!i FIT F .DOL LAF'.'.:::;, 1=1rff1 fl MATUF' J Tr' CF
l "::;~~1F.~Et;1 t:11 /E~FlF.~'.:; Flt·iTt li1C:t rl1Ctt. iTli!:; (f•''I;:~ r·iEETi t'ICfT" F:E~ fn"i If·!TE:C;EF~:t, A"f
1

Hi:3FTM A F'PJCF F' . THE !Fi'.=< F:FffE. AF'F'L.IEfi TO Hff'EF:'.EST F'ECEIFT:;


j :=;oPEM r:;:; Ti~ THF G'f::lt i=JPF'LIED TO Cf!F'ITF!L CArt-i::; J•:; re;
l f.OPEM PF'.EM I UM C!f I F'UPCHA'.:£ HBOU[ THE f;:'EDEJ'iF'T I ot··I FiMOUt·ff I::;;
1;:::, ':=!F'EM AMOPT I 2'.ED 01 IFP THE MffTUF'. I TY firm TIEDUCTETI AT Ti ; DI ::;cout·ff
l 7!2!F:'EM flT F'UF'.CHF1:::;[ f:EL.O!·I F:'EDEMPT I Oli AMCllJtH I:;:; TF:>TD AT MF!TUF'. I TY
T'=i
I :.-.ii

1 ?\::FEM
1 ·;::t;;'1F.EM

190 DATA 5,i00,f,5.25,97,_5,.25


C::00F:'.EM

C'.4·~:::1 It'"fF'IJT A~~


;:::50 Pf?Hff
c'.60 IF f!$="DATA" THE::ti 5(10
c'7!2l IF A$=-" ii MO" n-![t--1 460
?:::(1 PPIMT "EJHEF.'. THF" FOLLm·JH1C DATA ITEl'i~:;"
c'.90 PPH-ff
::::;:=10 PF.: I HT "ITEM 1 " ; THE: ( !<E'. :1 ; "AMMUAL COUF'oti CHi T!OLl.... AFd:;) "; T!=ff: IJ:::::) ;
:::: 1 ia I! lPUT C
::,: C~~~t F·~~ I t·iT
·::::::o PPHff !I ITEM ?", ri:-1:c U=2); "FPOCE[D::; on PEDEl1PTIOt!"; TAB (!(J);
:::::4.(1 IMPUT P
::;::5i:;:1 PF:'.Hff
:;: E,(i F'F.~ I t·iT ii I TEtt!~:; ::::.! f: i:.} JI ; TAJ:: f t<i~) ; u r=1FfT'l_IF~ I 1· l I t··t
1 1
lEJ"'.iF.:~=;, t1'1Cit·1TH~::; I! ; 'TFrB !"J::".:3) ;
:::: 70 I MPUT M1 , M;::
:;,: :;:: ~3 F·F.~ I t·fr
:;:90 PRHff "ITEM 5";T1=1:t:IK2); "PPICE";TF!:E:IJ=.3);
40(-i IMPUT P
4H:-; PPHff
4;::i21 PF.'.Hff "ITEJt:; i:=. :~, ?";TAB(K~::_:'.); "TA::< F'FiTC:; Clli IMCOME, CflP cn::;";Tfif:!]:::::.=::i;
4:·=:~7i HiPUT Ti, T,::
440 PPHH

691
500 PEAD c,?,M1,M2,P,T1,T2
'=' i o PF:'. I nr "couPot··I" ; c, "F'[DEMPT I OM AT" ; ::;:'., "PR r c E" ; P

':·40 PRHff
545REM SEMI-F~NUAL COUPC~
•::; '.:i 0 LET C=:C/c'.
::15 SF:'. Et i TI ME TO i ·!f!TUF.' IT\' I H :::;EM I -At1NI..IAL COUF'Ot-1 PER I ODS
1

'.:'i61:; LET M:;:::::::Mi ;i:.:;:'.+ r·1Z:' /6


·:~i65F'.EM f-1UMBER OF CC1UPott:; H·iCLJJDHlG FH11=1L COUF'Ot~ TO MATUF'IT\'
'.:i70 LET M4=INT f MJ J
~;·;"5PEM TI ME TO !"!E}<T COUPOt-i PEP I OD
!:i::;::o LET M'.:i=M3-··M4
:::;:::5F'.EM IS BOND S8_LING AT A PRE~IUM
590 IF P<R l~EN 620
•:::; 95REM 3EM I ·-At ·It !UFIL Fit'IOPT I ZFIT I OM OF PREM I UM
600 LET D=CP-R)/(M4+1J
6 i l~i CO TO 630
6c'.l21 LE.~T D=~o
62':5!?EM fffEP TA>=: Atm AMOTIZF!TIOH COUPOt·I
63(1 LET C2=C--(C-D) *T1
640 LET B=P-D~CM4+1l
645REM I:OO!< t.)f!LUE AT MATURITY
650 LET G=T2*fR-Bl
655PEM MFlRK[T UAL.UE OF' BOMD PLU::; F!CCPUED I!ffEPE:::;T
660 LET U1=P+C*C1-M5l
665REM F-TDE.MPTI0t1 PPICE
6 70 LET U;::'.=F.'.
6 75F£t"I I'.;:; TI ME TO Mfff UP I T'"t' Gl?EATEP THFlt"I TH PEE '/EAP:::;
680 IF M3>6 THEN 710
6 9(1 GO::;UB 1!Zi1 (1
700 GO TO 7c'.0
7 10 GC6UB :::6~)
715REM F1Mt·1UF!L PFITE OF PETUF.'.M
720 LET Y=2•CEXP(\'J-1J
730 PF.'.Hff "YIELD BEFOF:'.E TF!:=<", 101?.i*Y; "PEF-'.CEt-ff 11
740 PPit-ff
745PEM AFTEP TF1:=< MfiPKET 1..JALUE PPE:::;EJff
750 LET U1=P+C•C1-M5J•f 1-T1J
7':;5PEM F!FTEP 1H=< ::;EM I --AMMUAL COUPOt·1
760 LET C=Cc'.
765PEM flFTEF.'. TF1>=: MFIF'.KET 1.JALUE AT MATUP I TY

692
780 IF M3>6 THEN 810
~::i ·::1 ~3 C;;C1~:;;iJl:: 1Cl 1f2i

860 LET Y .0001 =


:;::?0 GOSUB '?-30
880 LET D = Q-CUl+U2+Cl
890 IF ABSCD/UJJ<.00000005 THE~ 920

9;?:(1 FTTUF.'.H
9 :;:o LET J=:U 1;.;;:e:-::F· C'r':i:i:M!:i)
940 LET Ul ~:*C1-EXPC-M4•YJ)/(EXPCYJ-1)
950 LET !J?=:U2:i:i:D<P (--\':s:i:M4)
96(1 LET l.)J =
1.Ji:''*'l·i4-P:i:i:M5
9?0 LET iJJ=l.IJ+ 1.C/ CE>:P (\') -1) le'.)* CE'.:<P f\')- C!-14/['.:::P I\'*- CM4-1 ) ) )
9:::0 LET 1,1·:::=U3+CC ··CD<PC\'l-1Jlc'.)=Q:f fM4-1't/(t)::P(\':<i:(M4-·i)))
99(1 PETUPt1
i OOOPE:M f!LGOF.'. I THM FOF.: DETEF:M I t·1 I MG E::<ACT PATt.: OF PETUPt·~
1010 LET \'=. 000l
10i:'.O GOSUB i (1:::~:::1
l 03(i LET l):::i)-.. (I) 1 +Ui:·)
l 04(1 IF f"fBS r: D/l)J :i ::· • ~x10Q(1(1(15 THEt1 1(170
11215~3 LET Y=Y-Il/1)3
1 06(1 GO TO 1 Oc~O
1 !21?(1 F.:ETUPt··I
10:::(1 LET I.) 1 =U::::=(I
109(1 LET Q=U 1
1100 LET U2=U2~~XP(-Y:i:i:M3)
1110 FOR I=O TO M4
1120 LET !.J 1=U1 +C'*'D<P C-Y=Q: ( M5+ I) )
1 l ::::0 LET '· 13=t.JJ+ CM~~+ I J *-C*E::·::p ( -Y:<i: ( M5+ I ) )
11 40 t·1C<T I
l 15~) LET 1.J3=U3+M~:*Uc'.*D=:F' (-Y*f'13)
l 16~~1 F.'.ETUPM
1l7!21 END

693
TO ~-IllD TH[ 1~:[FCI!:;::[ fl!!Tl HFTET: T1=1::=: YTE1 . fi'.::; FCC: 1=:1 smrn, 1~:i:::;·::::ut·IIllC THE": FULL.J:11. 1111c;
DATA~ l - Fl :;::':'• 1:i! IHUF!L c:oui::·on, ; : '. ·- PE:DD·!PT I C!l i l.J!1U.J[ UF' ~:: l !?10, ::: -· 1·:1:rruP J T\'
OF $9?, AND TAX RATES OF

F:'IJI I

DO \'O!J 1.. 1i=1t IT I 1·y::;TF'UCT I cnt:::; F OF.: E! ITF!? I! IC, n1=1TH ~:"y'l;:'"3
FJITET' HI[ F OLLC!i. 1I I-IC rn=1T~~1 I TEI"!'.::;
I TEJ'! l Fit·li-!tWIL 1::0l IPf.l!· 1 (I!·! DOi.. L HF:..::; :i -:.i::,
,., ..
I TF r··• c:' PF:OCE[Ir:::; Ut! FF::Il[l"IPT I on ? J i;:'lO
I !TY! -.....: 1::.; ::l :·11:n1. . n~:'. IT\' I 1·1 \THI;:·'.:::;, t•IO' ITH::::
1'°:'
?6, ~:;" ,:,:.r::;
PRICE ?97
I ...,

I l"E,l'='i ..
·~·!

.-, 1:::'
J TEJ-1 (::1 l~t "? :' tl ·~I , II

COUPOrl 1:::
·-' flEJ!PTICHi 1rr 108 PRICE
1··1t=1TUP I T-1' 1:..."1'C1:11:;;:::::; •:;:,. E:::::, i•!!Jt!1li'.:::;
TF1::< F::i=!TE:·::; • •=', i"I! ! I HCOMF. .25 ON CAPITAL GAINS
YIELD BEFORE TAX 5.560054 PERCENT
2.907394 PFRCENT

694
!IC! \'1 11.i i·!H! fT l' 1:~.>T F'.t 1r>r I f:n· 1,=·;
!TFT' l TEi'i.:; 'T!-·lh'.Cl!Jt;a- 1 "'.'

i·iHTUF' I 1 \'


1
IE LJl E:E.F'f'!F:'F. rr:i;:-:: ·r
\
1
IE L.. TJ F1F··rF-·F:'. --1· 1~·:1;:.:: "T"
i

PUrl

CCllJPOll ~ RFDEMPTION
MflTUP I T'r'
1T1>< F'HTES

YIELD BEFORE TAX


•,,)I 1: .L. Il
0

;:~:1F'T't:1? ·rr::1;:.::

695
BULL:
DESCRIPTION
In this program you will be transformed into a Matador. Have you ever been
a Matador? Well, in any event you will have the opportunity to test your
skill and courage in killing a bull or in the reverse being killed by a Bull!

USERS
Anyone who is looking for a good, fast, moving game where the probabilities
for "loosing" or "winning" are Equal, will enjoy playing Bull. This game is
extremely unique and is full of unexpected events.

INSTRUCTIONS
All instructions necessary for execution are included in the program. After
the program has been loaded, type RUN; you will then be asked if you want
instructions. If you type NO to this question the game will commence, any
other response will yield the full set of instructions. The game is self
contained and provides for all necessary inputs automatically.

LIMITATIONS
This program uses multiple line statements throughout, i.e.: lines 460, 730,
780, 970, 1030, etc. In addition, line 413 contains a Restore statement. The
source code requires SK Bytes of memory for storage and 6K Bytes for execution.

696
"!": ·r :~·.
j : j !..:!

1:~ i:'J c1F:Sf~~


1
I t·rT n 1~1t i FOF~Cl 1 F:iA'.:::;::; "1F 1·t·~E ~t;~JL.L::: \ cn_i 1··1r1\'
1
1·~'.\·
1

ii

;:~'.~.:;liF;F~1t·iT
11
C:1=:l.lEJ~~Cli·IIC"Fi rrn=1r·tC:1E~F.J)l_t!:; l 'H:1i)E' CJF" T~!F . c:AF F:),
If"··~'::3IIiE 1 1
H

;:· i:. L:'iPP r t-rr" 1::::Lt·:;-::; DHMr ,;[F'.OU'.::; ouT·:; I ·nE t·1c111E· OF THE. c:i=:PF. ~ op 11
c: .~?~2iF=~~, r t·. 11i:1= =CiF~I) Ir ·!F1F \i ~.:;k.t T1~ L ciF- 1l-tE~ c·RF:E~
1 1 1 1 111

;:'.·~nZ1F=F. . I l""i!" I l"·l~:;TE!={[l C!F /CHJ t=1ff'r1 1·F'\· t: I L.L. :BtJl_L ii


1
l'-~IE "T}H_~~
1
Frta]l)E, 1 0

1: "T(l •

;~c1l1F F~ I t"·~T u
1
c1t··1 r-:Jf·/ 1-1JF~'.J ·! ~ 4·=CH.JE~F.i Tt-~E J-iCH:;~:r·-1~:;, c.i= 1 r-1 -r·HE c·t-iE:~:;T; I!

:~::4!3F'F.:It·n" THE c:F.'(l~·!TI 1·11 LL DETEFMit·iE ~·iHfff Fl~·IAPTI \'OU DE~:;[pl)[ !!


::: 50PF.: I 1·ff II F'O:::;THUMOU::;L \' IF t·iECE'.:;SAPY I!
'.::::60PF:IHT"THE :t:PFil..JEP \'OU 1=1F:E, THE T::ETTt~'. THE R~·!FIPD YOU RECEH.lE"

:;::9(1PPIMT"THE :BETTE"P \'OUP CHANCE'.:;:; APE"


r:l i~it~i F'F.~ I t·ff

41 c~ F:Ef'1

,::f.1 7 F2 ~~ I t·. IT !i ~*-~~:¢:JI


~E>:::iLET D ( 5 l :::: 1

,: 1 40PEM T\'Pt" OF FULL

460 FOR x=1 TO 5'RERO l$(X)'NEXT X


470 DATA SUPEF~, E~CELLENT, GOOD, FAIR, STINKY
480 R=INT(RN0(-1)~5)+1
4 9(1PP nff" \'OU HA'JE DPfiL.it·l A "; L$ t: R :i ; " r:ui L"
500IF A>4 THEN 530
i:; 101FA<2 THEl"i 5::"i0
":';;:'.t:1CiOTO 560
:::;;:(1PF:Iiff 11'/0U, PE LUU=:\'''
":i4tiGOTO 56fi

697
~:~·;~'.;CiF;F~Ir·iTf!cic~i=1I! LJ.JC"l"i: '·1 :·n..t==
11
L.L.~ t·iEEii IT= u

560REM PICADORES
~:', ::: 0PR I r-iT
~=;·=.;n;::1LET A.;:= II p I c1=iri0Rc=.:; II
600CiO'.:;UB i t.10
6 1OL ETD f 1 ) =C
b20REM TOPEADORES
i;:;.-::0LET A$=:" TC!REF!IIOF'.E:~:;"

1:1 ;::Ci IF. Z= i "Tl·-lEt t l :::: 1t2f


690LET DC3l=D(3J41

?C.'.(iF'Rit·ff HEF:E COMES THE BULL!


11
TP\' i:-·op Fl l<ILL";

?'40PRIMT "CAPE t·lOl. .IE~ 11


;

?'60Pl?INT"Tl-IE BULL E; CHAPGINCi AT \'OU! YOU ~:1PE THE MF!TFiDOP-- 11


?'?liPF.: I MT II DO \'CIU ~·~FINT TC! TF.'.Y TO ~:::I LL THE: BULL II ;

?90PPIMT
11
L·~HAT MOl.JE DO \'OU MAKE l·~JTH THE CAPE";
:::OOINPUT E
810IF E<>INTCElTHEN 830
820IF E<3 THEN 850
:::3(1PF.'.Hff"DOM' T PF1t-nc, '/OU IDIOT I PUT Drn•.lt1 A COPPECT MUMBEP";

:::!:itiPEM CHFINCE:::; OF BE IMCi GOF.:ED


860IF E=O THEN 920
8?'0IF E=1 Tl-EN 900
:=.:::::OLET M= l /2
:::90CiOTO 930
900LET M=E'.
9 i. 1:·n:;;oro 9::::~1
9E:OLETM=3
9:;::(1LET L=L.+M
940 F=(6-R+~/i.0l•RND(-1l/f (o(1)+o(2)+o(3)/10)•5)
950IF F<.511~EN 660
960PRHff"THE HULL HF!'.:;; CiOF.'.ED YOU"
970o7=rNT(RNo(-1J•2)+1,oN o7 THEN 980,1010
9::=:t1PPHff 11'r'OU ARE DEFID"
990LET D(4J=i.5
10(1(1GOTO 1310
HH0F'Fnt··!T"YOU AF.'.E '.;:;TILL fiL IUE"
1 c1r::0PF.: I nT" no \'OU F:ut·1 FTOM THE Pr ne;" ;

698
j (i40PF.'.IhT"CO!·~fiF.'.D
11

H:i50LETD (4) =0
E'i60GOTO LH~~!
j ~~i(fiF'P I HT I! YOU ffr£ BF.:RI I[. '.::;TUPI D' BUT "[;!?~:11.1[ II
JOSli Fi=INT(Fi:ND(-·j):¢:?)+1···.0tl Fi c;OTO 1(1 90, 111(i

l 1 :::O~'.EM TH[ t•!OMEliT UF TF:'.UTH


1 1 4t~iL[T Z= 1
1 1 ':i0PF.: Hff" IT I::; THF. MCW!Flff OF TF'UTH. HOL·j DC1 \'OU TP'r' TO KI LL THE: F:UL L" ;
1160IHPUT H
1 1 7,:1FOF.'. .J=4 TO':i
1 l :::o IF H=.J THEJi 1 E:JO
1 1 '30 IF .J=H THU·! 1C.:::::o

l ;:·.11z1pp I MT" YOU Pf!M I ClTD. THE HULL CiOPE.D YCiU. "
1 c'.cJ:iGOTO 97ti
li:'30 t-::=(6-·RJ'*'1tf¢:i=.:t·K•l.-1) ( f[i(1)+D(2)'r.>:S:i>:D(:3)))
1240IF .J=4 THEN 1290
1 ::'.50IFK>. c'.THHi 960
i c'.60PRHff 11 YOU l<ILLED THE I:ULL"
i E 7'0LETD ( ~i :i =C'.
1 ;::-:;;a~1GOTO 131ti
1 ;:'.9t1IF K>. eTHEtl 96(1

1 :310REM CPOHD HOr·KJF:'.'.:;


1 3c'.0PF.: I MT
1 ·:::::=:t1PF.: nn
1 :::4ti IF D ( 4) <>0THEJI 1 J9(·1
1 ::::s~:1PF.: I MT 11 THE CF.'.m·rn :Boo:::; roR rn1 Mr 1·-1uro:;. IF \'OU EUEP DAPE To :::;i-10H 11
1 :::E.OPF.'JMT"YOUP FFICE: HI Fl PIMG AGAH1, THE~\' :::;1·.IEAP THE\' ~.ULL !<ILL \'OU--"
1J7'[1PPHff11UtiLE::s THE BULL DOE::; FIF'.·:;T"
1 JBOGOTO 1s:=::o
139("! DEF FNC: ( ::-:: :i:::: ( f .::j. '5+ j ./6- fD ( 1) +D ( 2) ) :.;.:;::·. 5+4;.;i:n ( 4) -+Z*TI ( 5) -D ( 3) '*''*'c~) / 1;:~0-·R) :i:i:FND ( ·-·,,:)
1400IFDC4J<>2THENl430
1410PF.'. 1MT 11 THE CF:'.rn·m CHEEP~::; ~~I LDLY 11
1420CiOTO 1450
l430IF DC5l<>2 THEN 1450
144(iPF.'.IMT 11 THE CF:m·m CHEEF.'.S"
1450PPIMT 11 THE CF:'.Ol·m mJAPD'.::; You 11
;

l 46~1 ei7=n~c: ( 1) ··. IF o7< 2. 4 THEt·I 157[1


1470 o7=FNC(1),IF o7<4.9 THEN 1550
l 4B(i ei7=n~L. ( 1) ···· l F D ? . 4 THEN 15;:'.0
14 9CiPF'. I MT II BOTH EflF'.'.'.:; AMfl THE TA IL OF THE BULL II
l '.:ili(1PP I HT II OLE! '/OU i=iF£ , MUY HOMBPE' ! OL[ ! OLE~ II

699
l510GOT015;::0
1520PPI!-iT"BOTH LflP:::; (IF" T'-lt: BULL"
1 ':.l"::::OPPHff"OLE ! II
1 ':'40GOTO 1 ':i:;:::o
1 ':i51aPPit"IT"ONE [HF.'. or TH[ F:ULL Ii
1 ':i60CiOTO 15H!21
1 i:; ?OPP I 1-n" ncm-i r nc"
1 ::;;::opp I !'ff
1':i90 PRIHT "DO \-'OU 1,.lfiHT TO TP'/ ~:1CiAIH 11
;
1 ':i 91 H~PUT z~: ··.. IF :;:: :*::::: "'-;-'[::;:;" GOTO 410
1 t:.~:::i~?:IGOT02~33(1
1610 LET s=3/R*RNo(-1)
1620IF B<.37 THEN 1740
1630 IF B-::: 1-'··2 THETl 17;::(-1
1640 IF B< • 63THEH 1?(10
1650IF B<.87 THEN 1680
1660LET C=l/1(1
1670CiOTO 1750
1 6:::0LET C=c'./ 10
169t-iCOT0175t1
1 70tiLET C:=J/ 10
1 711~KiOTO 17~i(i
17;::•:'.:iLET C =::4/ 1 ~3
1 730 COTO 17':i(i
174tiLET C=i/2
1750LET T=INTC10~C+2/10)
1 760PPIMT THE "; F1~:; " flID ri "; t_:;.: 1 T :i 11
11
JCIB"
177!21IF 4>T THEM 1900
17S~HF 5=T THEt--1 1:::7~?1
179(1 Fl=INT(Fi:ND(-1)*-c'.)+j·,.oN Fi GOTO 1G~)(1, 190(1
1 :::1;::1(1 IF A$= TOPEF!DOF.:ES It THEM 1 ::::20
II

u::1ePPHff"OME or THE 1-10P::;r:::~; OF THE ";A$;" ~·~F1::; GOF.'.ED"


1820 Fi=iNT(RND(-1)•2)+1,DN Fi GOTO 1830,1850
1 :::3(1F'F.: I MT II OME OF THE II ; A$; " L·~FIS KILLED II
1 :::40GO TO 1900
1 :::soPF.: I NT rm11 11
F1$;
;
11
HEF.'.E KILLED"
1 :::60GOTO 19~.::10
1 S7t1 IF A$= II TOF.'.EADOF.:ES II THEM 1890
188(1 F1=nff(i:;:r--mf-U'*';:?J+1···--PFUNT i:-1 " OF THE i-·IOPSE::; OF THE.: ";Fl$; 11
GOF.'.ED"
1890 F1=INT(FiNo(-1J~2l+1,PRINT Fl "OF THE '';Fl$;" KILLED"
1 90€1PF.:Hff
1 '910PETUF.~H
c'.0:::0 END

700
!.:iii ETiCH F'f:1::::s UF THF BULL., \'C!IJ Mff/ TF:'.Y
Cl::::! IE.Rotn CFI CDFlt ICiFF'OIJ•:; n1·:::; I DE MOl)F OF THF CFIF'F ) ,
1 =LL:::/::; f!Ai iGET'OU'.:::; nu1 ·:::;HI[ t·lOI)[ OF THE" c·F:F'F , UF
D1r·~AF.'':' ::;L·~ I F.'.L OF ·rHt: Cf!PE

HSTEf!D OF THF f!F:CiUF., YOU MF!'/ TF:'Y TO r<IL L. THF" f:l.ILL


Cl l ntf/ TUF.'.t"l ~ ·=~===OiJ[F:' THF HOPt·1'.:::;, !5== H-l THF CHF ::::;T;

THF ~·~HAT AHAPD \'OU DE'.~:;E.TUE


CF:m..rD !·i ILL TlElEPM Jtl[
IF 1·1FCE:::::sF1PY
F'1.1:~::n-!UMOU::::;L\'
THE: :t.:RF!UEP \'OU 1=1F=:F, THF: f:[TTEF THE fil·IF!FJ1 '·:\!U F:'FIE I UF

THE: BETTER f~ .JUB THE F' I CADOF.'ES t=1Hfl TOF'EF!Tll iF'E ·:: no,
THE BETTER YOUR CHANCES ARE

F)ri~-:;~:; tit.1t·i1F.:r:·:F.'. j
THE B~-L IS CHARGING AT YOU! YOU ARE THE MATADOR--
DO '/OU 1. .1Atff TO TF."1' TO VI LL THE BULL?rT::::;
IT I'.:::; THE MOMENT OF" T!?UTH. Hrn·~ DO \'OU TF'\' TO KI LL THE BULL.?1
YOU PANICKED. THE BULL GORED YOU.
\'OU AF£ DEFU.1

701
ENTERPRISE:
DESCRIPTION
The federation is in dire need of a commander to takeover the Enterprise while
Captain Kirk is on leave. Prior military experience helpful as the Enterprise
and a Klingon battle cruiser face each other in a simulated battle mission on
your computer. Designed to test your abilities, this version of the game will
require considerable skill on your part to avoid total destruction. GOOD LUCK!

USERS
Starfleet Captains and other individuals interested in keeping the Star Trek
tradition alive and well, as well as having a lot of fun, will find this sim-
ulation space battle both exciting and fascinating. **WARNING** This game may
be habit forming ~ players have been known to become addicted!

INSTRUCTIONS
Type RUN after the program is loaded and the program will ask you if you want
instructions. The program is self instructing and easy to use.

LIMITATIONS
Line 230 contains a TAB ( ) statement, 670 an ON GOTO statement and 2270 a
Restore statement. Lines 330 and 2810 contain Multiple line statements. The
source code is 7K Bytes long and the program will execute in BK Bytes of mem-
ory. For those of you experiencing extreme difficulty in bringing back the
Enterprise in one piece, the weapon control constraints are located in lines:
700, 800, 870, 2010 and 2020.

702
ENTERPRISE

ENTERPRISE

i~i0~5U IF i=i:~:=: "! !0 11 THFl :::50


i::'.l~~i~:,~J IF i=i:;.-:== i! r··.10 ii 1·f-JE~r.. :~:::=s1?i

I::; i Ui!FFCit lTFT1


I~ 1.:1 -r· T L E"

c1 i 4L~i PP I rn· " =-· FfiF'L·:1=1FT1 F'!·iH::;EP t::RM~s, F:'.F:r·1ci::: ::;::(10, c1(10 t<M. 11

c1150 PP r t·rr 11 1 F:'EF:F'. F'Hfi:::;f:T, PAr·lGE: '.:;flME 11


0160 FEM
F.:EJ=1
~J J. ?i21
u t ::a21F'P I t·ff 11
2 FC!F.'L·.iAF'.D F'HOTOt·i TOPPEDO BAr·-w::=::, PAt·1cr: i:'.'O, 00(1 ro ;::.co, ooo k.M. "
0190 F.'EM
Clc'.0(i PF.'.Hff
(1 E'. 1Ci
F'.EM
CiC~C~[i F.:Et 1 1

i?2:3(i F F~ I t·il""
1

[i~?i:.1-0 F.~Et,·1
(:1;:::5(1 PF.'.IHT 11 1-FI F:'.E FOP~·-lflF.'.D n!A'.:£F.:·::;"
0260 PF.'.Hff "E:-F-lFT PE.AF.'. PHfl'.::;EP"
02?0 PPHH 11 ::::-·FIF.'E. FOPt·jFIF.'.D PHOTOtl TOF'.PEflO"
1X:'.80 PPIMT 11 4-F"JPE: PEFW PHOTOti TOF:'.F'ED0 11
0290 PF.'.Hff "'5-fiCTIUflTE. F!UTO DISTF.:UCT"
o '.;:i;:K1 PP I MT "::.--:::;1_.1pF£tmEF.'."
e1::;::10 PF.'.Hff "?-fHTEMPT TC1 BPEAK COt·ffACT-·-·CO HffO HFlF:'.P DPif..JE"
0320 PPHff 11 :::-·MOUF CLO::'.;EP TO THE KLIMCiOtl"
0330 PF.'.Hff"···.PF-'.Hff "FILL UECTOP HEFIIIH·!C8 ~·HL.L. BE BEnJEEM 0 F:tm 1:=::a Dt:CF'.ETS"
034li F.:EM
0::::5(1 PPHff "KLit"·ICotl COMIMG IHTO PAMGE--:::;HIELD:::; ot·i"
0360 READ R,H,p,x,A

039(1 PEM
0 400 PP It-ff I! ~'~HAT I"::; .;'CHJF:'. COMPUTEF.: DEF"Ett:;E t ·IUMF:EP f l -C::::;) II ;

0 4 l (1 I t·iPUT t"i2
0420 IF N2<1 GOTO 400

703
0430 IF N2>25 GOTO 400
044(1 REM
0450 F.'.EM
0460 FOR I-=1 TC! n;:::
(14 7li B=Pt·m ( :>::)
04B0 l·~E::-ff I
~J491Z1 Ci0:3UB 137[1
05(1(1 pp I NT II THE PAt·K:;E= II ; F.'.; II KM. AT A UETTOP HEAD I t·IG OF II ; A; II IlEC:iF.'.EE:::; II
0510 e;o:::;uB 6E:o
0520 IF H>B THEtl c~560
0530 IF E=6 GOTO 2700
054(1 IF E=5 GOTO 2610
0550 IF R>1.00000E+6 THEN 2690
0::i60 GOSUB 1100
~Y:i70 IF P>:::: GOTO ,::6Ei
ti58(1 IF 1<=7 GO TO !:i00
(159(1 GOTO 49(1
06(1(1 F.'.EM
061121 F-'.EM
0620 ~·J=;:'.'.
06:30 PPHIT "~ . lHFff I::; 'r'OUF.' MOl..JE 11 ;
064(1 INPUT E
~~65(1 GOt;IJB 1490
(166(1 IF O>C1 THEt"-1 630
0670 ONE GOTO 680,790,910,950,900,940,990,1030
0680 IF A>90 THEN 730
~:169(1 B=PND i:::·::)
0700 IF B>.2 GOTO 770
0705 F.'.EM THIS E; FOP THE FPOMT PHFISEP::;
071(1 PF.'.IMT "COMPLETE MI::;::;;, YOUR AIM I::; OFF"
0 72(1 PETUF.'.t. !
o730 PF.: I NT "MI s::;, r NCOPF.:ECT '...IECTOF.: ANGLE"
0740 PFUrff "PEMEMBEF.'. THF!T ~BETl·JEEM (i Arm '31(1 DEGREES IS FORl·~AF.:It 11

0750 PPHff " At--ID THAT BEn.IEEN 90 AMD i::::~] DEGF.:EES IS PEAF.'.l•.JAF.'.D"
(176t1 RETUF.:M
077(1 GOSUB 2(1(10
(i?f:0 RETURM
121790 IF Fl< 90 THEN ?:?.:0
08(10 IF B>.4 GOTO 770
0803 REM THIS IS FOR THE REAR PHASERS
(18(15 GOTO 710
0810 IF A>90 THEN 730
(i820 B=RMD i:::-=::i
0830 IF B>.1 GOTO 770
08:?.:5 F.'.EM THIS I::; FOF:'. THE FPONT PHOTOM TOF.:PEDOES
(1840 GOTO 71(1
IF A<90 THEM 7:30
(185(1
0860 :B=F.'.MD C>::)

704
0:::9(1 PEM
(19(10 PR I t-iT TAI: ( ;:'.O ·.1 ,' II
F! !-.. ,...
i I u A T ·-·--· D"
!::'1910 PEM
~~:i'3;~C1 F·F~It·iT ·:.i :-.-·.
-, .- c:·
" j ~i ' -' I i
U930 F'.ETUF:'.N
0940 Pl?Hff "Oti t:E:HALF or THE KLHiGOM EMF'JP[, I fiCCEPT YOUR '.:::;UPF.'.ElffiER"
09":;0 REM
0960 F'Fd MT TAB i: ;::~121 :i ; "PF.'EPARE ro BE -i::oAPDE.D"
n9?0 F£T'UF'.ti
09:::0 P=F+ 1200@ao. *-F:t-m f >=: :i :i
0990 IF 1.00000E+06 THEN 1010
101210 PETUF.'.t-1
1010 PP I MT 11
corn·F1c1· r·1or BROKEth t·1Ell n1'.:;TF1tK:t:= 11 ; p;" ~'M.
11

1020 RETUF.ti
1030 IF R<200000. lHEN 1060
1040 R=R-200000.~RND(X)
1050 PETUPN
1 060 R=R/c'.
1 tl 7~3 PETURN
10:::0 FTM
109(1 REM
1 1 (i(1 ~'~= 1
1110 K=INT(C7•RND(X)J+1l
11 c'.0 149(1
GO~;IJB
1130 IF N>0 THEN 1110
114•3 OM K GOTO l 150, 1150, 11 ::::0, 11 ::::ra, 11 ::;:(1, 1 E~::::o, i 290
1150 PF.'. I MT "KL r r··1crn·1 F 1PES PHOTOM TOF.:PEDO"
116(1 GO'.::;UB 20(10
1 1 7(1 F.'.ETURN
11::;:(1 PRit'ff "KLit·IGOt·i FIPES PHf·6EP:::; AT ElffEF.PPI'.:;E"
11 9(1 LET B=F.'.MD (>=: )
1200 IF B>.2 THEN 1160
1 c'.10 PRHff "You ouTMAt..1E:u•.__1i:::F.'.ED HIM, MI'.::s. 11
1220 F.'.ETUPt·1
123(1 PF-'.IMT "KLit··IGOt--1 ATTEMPTING TO 'BPEFIK COHTACT •••• II;
124(1 P=F.'.+ ( 2(10000. :<i:F.tm ( >=:) )
1 c'.50 IF F.'.< 1. ~30000E +06 THEN 1C.?(1
1 c'. 6(1 F.'.ETUF.'.t·1
1 i::'.7(1 PF-:Hff "COMTACT t10T BF.:OKH·I"
12B(1 F.'.ETUF.'.N
1290 PR I NT II KL I t·1GOH flPPPOACH I NG II
1 ::::0p IF R< 200(1(10. THH·l 1:;:3(1
1310 R=R-200000.•RND(X)
1320 F.'.ETURM

705
134~3 RETUF.'.M
135~:::1 REM
l ·:::E.0 F.~E~t;1
1 :::7(1 B==RND C:=-::)
1380 IF B>.5 THEN 1410
1 ::::90 !?==P+ C10(100•PND ( ::-:; J )
1460 GOTO 142(1
1410 R==ABSCR-C10000*RNDCXJJ)
1420 A==A+C100•RNDCXJ)
1430 IF A>1SO THEtl 14~i(1
1440 RETUF.'.t-1
1450 fi==A-1 :;::(1
1460 GOTO 1430
147(1 F.'.EM
14S0 F.'.EM
1490 IF W==1 THEN 1750
1 ::;oc1 IF E< 5 THEt"·l 1530
1510 0==0
15c'.(i F.ETUPN
1530 IF E< :::: THEJI 1 71210
1 ':i4~3 IF R >6€10000. THEJ1 159~3
1550 IF D==5 THEM 16:i(1
1 560 IF R< 2(1000. THEl1 l :;9(1
1::;70 P=0
158(1 RETUF.'.N
1590 PR I MT II THE F.:Flt·K;E OF A PHOTON TOPPEDO I::; 2(1, (10(1 TO 600' (U3fl KM. II

16(10 GOTO 167(1


161!21 PRINT "'r'OUP PHASERS HAUE BEEt-1 DE::;TRO\'ED ALF.'.EAD\' 11
1620 GOTO 167(1
163(1 PR I NT II THE F.'.ANGE OF A PHA::;[p Is 30(1, (1(10 KM. II
164(1 GOTO 167(1
165(1 PRI~ff 11 \'0UR MEF!PONS HAl..JE :BEEN DESTROYED ALREADY"
166(1 GOTO 1670
16 70 PF.: I MT 11 MOUE I MPO::;::;; IBLE, TF.:Y AGAIN"
1' 6:3(1 G!=l
16 9(1 RETUPM
1 70(1 IF F.: >30(1[1[1(1. THEN 163(1
1710 IF D=4 THEN 1610
1 ?2(1 IF D=5 THEM 165(1
1 7 3(1 G!=~:::1
1 .? 4(1 RETUF.'.N
175(1 IF K>5 THEn 1::::::0
176~:1 IF K>2 THEN 1::::40
1 771-3 IF F.'. >600€10~:1. THEN 182(1
1 7H0 IF F.:< 20000. THEN 182~3
1790 IF H>7 THEN 1820
18(10 M=0
1810 F.'.ETUPM

706
1840 IF R>300000. THEN 1820
1 :::50 IF H >6 THEJi 1::::;::0
1860 t·i=(1
1 ::: 70 F.'.ETUPN
180) IF P>H+l THEN 1950
1RgR IF P<H-1 THEN 1920
l 9ti0 M=l'l
1 910 r::'.ETUF.'.t·i

1 9~50 IF K=6 THFll l eE'.~2!


l 960 r·i=t1
1 97ti PETURM
198~3 F.'.EM
1990 F.'.EM
~=· e1(10 B=F.:MD f >=:)

C.'.020 IF B>. 1 GOTO c'.050


c'.030 PF.:Hff "MEFIP MJ::;'.:;;"
;::'.04ti F.:ETUF.'.t-1
c'.(15(1 IF ~·1=1 THEH c'.(1:::5
2~:160 PF.:Hff "HIT OM l<L.INCiOt··I BATTLE CPUI ·:;EF.:"
2 07~:1 H=H+ 1

;::0B5IF I:<. 4 GOTO E:o::;::(i


E:090 PRIMT "HIT rn·1 THE u~;~; EMTEPPF.'.I'.:;E, DAMflGE REPOF.'.T- 11

i:'. 1[1(1
P=P+ 1
c'. 11 (i
CiOTO 21 ;::o
2120 IF W=1 THEH 2160
c:: 1::::t:1
PF.: Hff "DI PE.CT HIT OM KL I MGON 1...•1c:;'.:;EL, DAMAGE PEPOF.:T-"
214(1 H=H+2
215(1 C:iOTO c'.:380
c'.16(1 PRINT "DIRECT HIT ON E..tffERPRI'.:;E, Dflt'IF"iGE REPORT-"
21 7€1 P=P+c'.
c'. 1 B0 IF P< 9 TH Hi ;:'.c'. 1 (i
2190 D=l
c'.20(1 F.:ETUF.'.t-i
2210 IF P=6 THEN 2290
c'.22(1 IF P=7 THEt·i c'.31(1
c'.2:'.::1-3 IF P=::: THEN i:'.:34121
2240 IF P:::<.:: THEM 22?(1
c'.c'.50 PRHff "SHIELDS HOLDING - NO IIAMAGE"
c'.E~60 RETUF.'.t-1
;:· 27iz1 PF.: I NT "SH I ELD::; ~·IEAKH~ I MG - MI MOP rn=1MACi[ IM MIDSHIP::;"
E:2f:0 RETUF.:N
2290 PF.'.Hff "ALL '.:;HIEL.DS DE::;TF.'.OVED - DfiMAGE TO OUTE:P HULL II
E:::::oo RETIJF.'.M
c.::::: 1€1 It=4

707
;::: ::::21;:1 F'F.'. I MT "F'HF1SEP'.=.:; DE ACT I t)ATED - It IL I TH I I.JM CHP\''.:;TALS 01..JERHEAT I NG"
C.'.:::::30 f:ETUF.'.N
c.:;:40 D=5
;:::350 PRI~ff "ALL ~·-IE:F1P0tt:; DESTF.:OYED - POL·~E:P DF'OPPitiG"
C.'36(i PF.:Hff "Mfl.JOF'. DfiMAGE TO f,JARP EtiGit1E'.:;"
c'.'.3?~1 RETURN
2380 IF H<9 THEN 2410
i:~ :::: ~3t1 T1=:=:
c'. 4~X1 F.'.ETUF.:N
•'.=: 410 IF H=8 THH1 c'.530
2420 IF H=7 THEN 2510
c~43(1 IF H=6 THEt··I ;;::4•31(1
E'.44€1 IF H>:3 THEN ;::470
;::45(1 PRINT "SHIELDS HOLDIMG - MO DAMAGE"
E:46(1 RETUF.'.N
2470 PRINT "::;HIELD'.:; L·~EAKENU1G - MINOF.'. DF1MAGE 11
c'. 4::;:(1 F.:ETUF.:N
c'.49(1 PF.'.INT "ALL '.:;HJELI6 DESTF.:O'r'ED - HULL DAMAGE"
c'.5(1(1 F.:ETUF.:M
c'.510 PFUNT "PHA'.:;EP BArn::s DESTPO\'Eit - MA.JOF.: DAMFICiE FOPE mm AFT"
c'5i::0 F.'.ETUl·?.N
;:'. i:;:3(1 It=7
2541'.1 PRINT "ALL ~·~EFIF'ott:; ClM KLH1GOM !..JESSEL DEACTIUATED, POl·JEF.'. DF.:OPPH1G"
2550 F.:ETUF.:N
2':i60 PF.:Itff TAB ( 1':i); 11 C 0 H C.; ~'. A T U L A T I 0 t-1 ::;:;"
c'.570 PR Hff
258~3 PRIMT "KLIMGOM UES'.:;EL DE'.:TF.:O\'ED"
259(1 PF.:INT
2600 GOTO 2700
2610 PRINT TAB (20J; "EMTERPF.:I:::;E DESTRO\'ED"
262(1 PF.'.Hff
263(1 IF E=5 THEM 26!:i0
c'.640 D=100(1*RND i:::-:::i ····.GOTO 266(1
c'. 65(1 D= 1(1(1(100. *RMD t: >::)
c::660 PRitff "RAnrus or MATTEF.:-AtffIMATTER D<PLOSION="; ri; 11 KM. 11
267(1 IF R<D THEM ;::580
26:30 GOTO 270€1
c~69(1 PRitff "COMTACT BF.:m::Et·h F.'.ETUF.'.N TO BA'.:;E"
2 70(1 PR Hff II AGA IM (YE::; OR MO) II ; ...... GOTO E'.76(1
c'.71(1 PFUNT "STAR FLEET HAS IIETEF.:MINEI1 THAT 'r'OU ARE TOO BLOOD-THIF.'.ST\' 11
272€1 PF.:INT "THEF.:EFOF.:E, IT HAS BEEN DECIDED THAT YOU l.ULL NOT BE "
27:30 PF.:Hff "AL.LOl·JED TO COMTINUE ON THIS F.:AMPAGE OF KILLING POOF.:"
274(1 PF.:INT "LITTLE DEFEMSELESS KLINGons. ADMIRAL 1.-JESTLAKE, II
2750 PF.:INT " '.:n1=1R FLEET COMMFINI•" . . ·.GOTO c:::::2i;:1
27E.0 INPUT A$
C:'.770 RESTORE
278(1 IF S4>=4 THEt·1 c'.?1(1
c:~ 79€1 IF A$= .. YEs 11 THEt·1 2:::: 10
2:::00 IF A$( >11 VES 11 THEM c'.82(1
c'.810 S4=S4+1·-....GOTO ::.:5(1
2:::20 PF.:INT 1111
E:::::::::i.3 EMD

708
DU 'r'UU 1-IHtlT Ht=;TPI IC:T I Ott:=; C/E·::: OR tKn ~:"rT'.::
l·IH I LE Ot·1 PFffROL. t IF:f!P TR I ::;~::ELL I ON--7' ...
Tl-IE u·:;·:;; Et-ITEPPP I'.=:[ J ::: COtiFPOt·ffE::::; I:Y
A K L I t I Ci U I i I : f: I T T L F C F' U I ·:: F F'.
\·IEJtF'Ot1F"f'
c'. F0Rl·4ARD PHF6EP I:AtJK::~;, PF!t1GE: :::t1f1, 000 U·1.
PEAR PHASER, RANGE:SAME
2 FORWARD PHOTON TORPEDO BANKS, RANGE: 20,000 TO 600,000 VM.
1 !?FAR PHOTOtl TORPEDO I:Arn:::, RANCE: ::;f1ME
t·I Ft ti F. 1. I I) E F.: '.:;
1-F JPE FORWARD PHASERS
c:·-FIF'E REAR F'HF6EF:
3-FIPE FORWARD PHOTON TORPEDO
4-FJRE REAR PHOTON TORPEDO
5-ACTIUATE AUTO DISTRUCT
6-'.::;tJRREJmER
7-ATTH1F'T TO I:REFtK COtlTACT--GO J t--ITO l·~FiF'.P DR I 1.JE
8-MOUE CLOSER TO THE KLINGON
ALL UECTOR HEftDHiC::; l·IIL.L BE BEHIEEN 0 At·ID 1:::0 DEGF::E:ES
KLH-IGON COMIMG HffO PFINGE-·-SHIELDS ot·1
THE RANGE= 91332.36 KM. AT A UECTOR HEADING OF 144.9378 DEGREES
WHAT IS YOUR MC~E?4
COMPLETE MISS, YOUR AIM IS OFF
KLINGON APPROACHING
THE RANGE= 45666. 1::;: l<M. fff A UECTOR HEftD I t·iG OF 1. 44. 937::: DEGPEE:::
WHAT IS YOUR MOUE?4
COMPLETE MISS, YOUR Ff IM IS OFF
KLINGON FIRES PHASERS AT ENTERPRISE
MEAR MI::;s
THE RANGE= 53897.81 KM. AT A UECTOR HEADING OF 62.60793 DEGREES
t·JHAT I:;::; \'OUF.: MOt..JF.:~?3
DIRECT HIT Ot·~ KL.HiCiot1 I.JESSEL., DflMACiE REPORT-
SHIEL..DS HOLDING - MO DflMAGE
KLINGOM FIRES PHOTON TORPEDO
NEAR ME;::;;
THE RANGE= 63323.14 KM. AT A UECTOR HEADING OF 100.1475 DEGREES
t·JHAT I::;; YOUF.' MOUE?4
COMPLETE MISS, YOUR AIM IS OFF
KL HiGOH FI F:E::; PHA::;EF.:S flT ElffERPR I ::;E
HIT ON THE us::; El·ITERPR I::;(' DAMFiGE REPORT-·
SHIELDS HOLDING - NO DAMAGE
THE RANGE= 61206.09 KM. AT A UECTOF.' HEADIMG OF 109.9991 DEGREES
WHAT IS YOUR MOUE?2
DI F.:ECT HIT ON KL I t··IGON UE::;SEL, DAMAGE REPORT-
SH I ELDS WEAKENING - MINOR DAMAGE
KLINGON FIRES PHASERS AT ENTERPRISE
HIT ON THE u::;::;; ElffE:PPR I ~:;E, DAMAGE F.:EPORT-
SH I ELDS HOLDING - NO DAMAGE
THE RANGE= 57123.84 KM. AT A UECTOR HEADING OF 154.9717 DEGREES
WHAT IS YOUR MOUE?

709
FOOTBALL:
DESCRIPTION
If you're a football fan this program should be right up your 50 yard line.
This is an authentic football game simulation. The game adheres to the NFL
rules and the play generated is as stimulating as you're up too.

USERS
NFL and AFL fans will find this game very enjoyable. The game will appeal to
anyone who has an interest in football, regardless of their expertise.

INSTRUCTIONS
The program contains all necessary prompts and instructions for playing the
game. To use ~ load the program and then type RUN. For detailed program op-
erations list the program before playing.

LIMITATIONS
This program uses the DEF FNX ( ) function and the FNX ( ) function exten-
sively, starting in program line 1090. Line 2030 contains an ABS ( ) state-
ment and line 6080 contains a Restore statement. The source code requires
llK Bytes for storage and 13K Bytes of memory for storage and execution.

710
l ;~'HJ FEM TH I'.:; I::;; FOCITBFILL
l30 REM THIS P~JGRAM SIMULATES A FOOTBALL GAME
1 4 ti REM THE: USEP CHoo::;;[::;:; H l ~=; om i TEAM 1=1tf[I HI ::; OPF'ot·iHff AND THEt-i
i :;iz1 REM ACT:; 1::i::; THE: C!UflPTEPBACK At·m DE:FDt:;JI)[ ::;IGt·iflL-·CFiLLEP FOP HVi; TEF°lt'1
1 ::4 F.'.EM TH I::; PF'.OCPF!M ::;AMPLE:::; THE OPPO::; IT I ot·1::; PLF1Y::; FPOM fl t·mM-L I t-IEF!P Tl I ·::;T.
c'.10 PF-'.Hff" THI::; E; PPo-·=nvLE FOOTBALL. 'r'OU UILL BE THE"
c'.2(1 F'PHff"OUAFffERE:ACK AND DEFEt~Sii)E SIGtiAL-CALL.EP FOP \'OUP"
;:'.:;:e PRHff "TE1=iM. '/OU HA'.JE 14 OFFEMSIUE Pl.A\''.:; c::: PUM:=.;; i::. PAS'.::;E::;:i"
c::4~~; PPit·ff"Fltm 4 DEFDt:;11..1E ALIGMMEMT::;.
11

c'.5!~i PPHff" THEF.E I::; i=J "fl~O-·MH·IUTE L,~fll?tHt·iG BEFOPE TH[ Hm"
c'. 6(1 PR r MT 11 OF E:ACH HF1L.F. FI UE ro '.:Eur:Ji PLA"i"::; APE. LEFT In THE"
c'7(i PF.'.Hff"Hf!LF fff THF!T POI MT a II
c:' :;:: 0 PF.: Hff
3'::10 REM

370 DIM BC15J, D$C10J


390 FOR 1=1 nJ 5
4t~i~7i PEF!D A$
410 LET D$Cll=A~
4 ;:'.'.0 ND=:T I
430 DATA POINTS, FIPST Drn4NS,\'DS-RUSH,YDS-PASS,YDS-PENALTY
440 PRHff
471 IF I8=1 GOlD 630
472 F'F-'.IMT"DO '/OU L·IAt-IT Fl LI:::;T OF PLA\'::;; (\'['.::; OP fiO) II;
4 74 HiF'UT I9$:
476 IF I9$= 11 1··m 11 GOTO t.::::o
477 IF I9$= M11 COTO 630 11

.:.1 ::::~1. PF.: nn 11 CALL pu::1\''.:; r6 FOLLrn·JS: "


49(i PF.'.IMT
500 PF'. I t·ff !I F.:Utt::; ~ II
5H3 PRIHT 11 i=Dll..J[; C::=OFF TF!CKLE; ::::=scr::;::;ops; 4=TF.'.AP"
~i20 F'F.~It~iT" 5=:~;1..ffTF'; f:.=OPTI OtH 7=PEUER'.::;E; ::::=DPm·J"
5:::(1 PF.'.INT
540 PF-:Hff"PAS:::;E:::;: II

550 PF-:Hff" 9=SIDELHiE; 10=L.OOK-HI; 11=POLLOUT"


560 PRINT" 1E~=SCF.:E:EN; 13=~FL'r''; 14=' PC6P "
570 PF-:Hff
~i ::;:(1 PF-: I MT II KI C:KS: II

5'3(1 PRHff" 15=FIEL.D CiOF"iL; 16=PUNT; 17=G!UICK KICK"


60(1 PF-'.Hff
610 PF.:INT 11 CF1LL DEFEl·iSE:::; A::; F'OLLOl·JS: II
62(1 PF.:Hff 11 1='PRO' i:4-·3J; c:·='OKIE' 15-c:~:i; '.:.:=''.:;HOPT-YDG'; 4='PPEUEt-ff' 11

630 PRitff
E.::;:(1 PRINT"YOUP TEFIM 11 ;

711
6 9(1 1r·iPUT ,- .:?
700 LET G' 1l=A$
7 c'.0 PP· :·n" OPPOHEJ·IT" ;
II ,/UT B$
?·;::~~i
740 PPHff
750 LET 0$C3l=B$
760 IF B$<>A$ THlN 800
7?0 PF'Hff"YOU AF:'.E II; A$; II. TP\' AGAIM. II

?:=.:o COTO 730

840 FOR I=t TO 45


::: 5(.1 F:~E.AI1 It~-=
860 LET E$(1J=D$
::;7[1 f"iE>=:T I
:::::::::0 DATA '/APD' ~::I CKOF F, TOUCHBACI<' F.'.UMBACK, BflL.L on
:::90 DATA YARDLI!iE, Dil.1[, OFF TACKLE, ::;crs:=.;op:=,:;, TPAP
900 DATA SWEEP,QPTION,REUERSE,DRAW,SIDEL.INE
910 DATA LOOK- Ii·!, F:OLLOUT, ::::;CREEM, FL\', PO~;T
920 DATA FIELD GOAL,PUNT,QUICK KICK,EXTRA POINT
930 DATA PRO,C~IE,GOF~-LINE,PREUENT,PENALTY
94~3 DATA OFFSIDE, HOLDit..!C;, IHCOMPLETE, BATTED Drn·~t"i
950 DATA IHTERCE:PTiot·i, LO::::;::;;, rm GAIH, CAHh FUMBLE
91:.0 DATA TOUCHDm·lth ::;AFETY, GOAL TO CO
9 70 DflTA F IF.'.:::;T, ::D::onn' TH I RD' FOURTH
980 FOR 1=1 TO 14
990 READ LCI),C;CIJ
1 ocx1 NC<T I
1010 DATA 2,7,3,10,5,15,5,20,3,10,7,15,9,25
1020 DATA 5,15,5,10,5,10,7,15,10,20,10,50,10,40
1 ~~i:::X.1 H9=;::'.:i
1 0 4t1 E9=5(1
1090 DEF FNF{Xl=SINC3.141*RNDC-Xll
1100 T5=Q=1-2*INT(RNDC-1J*2l
1110 IF Q)0 THEN 1150
112(1 PF-:Hff 0$=(:3); ~·lON THE TOSS AND ~·HL.L F:'.ECEH..IE.
II II

1 1 30 PF.: I !'·ff
11 4(1 GOTO 120l1
1 15(1 PF-; I NT 0$ C1 ) ; " !...!OM THE TO~::;::;. "
1160 PPIMT"DO \'OU ELECT TO l<ICK OF-: PECEil..JE";
11 70 It"!PIJT C$
1. 1 :::0 PRINT
1. 190 IF C$="KICK" THEt·i l;::'.20
120[1 C!=-1 '¢!0
1210 IF Z9>0 THEN 5990
123t1 Y=::::o+ 1MT c40:.:i:n1r 1: 1 :i )
1;:::40 PRIMT v;E$:c1J;" ";E$CE:)
1 2 50 >=:=::~:: + i: G!:Q:'y
1
)

1260 IF Q=1 THEN 1290

712
l ::'.?0 THEH 1:.::50
l2B0 GOTO 1·:::i)O
IF >=:·:::100 THEJ·I 13:=;0
PR I t·-ff E$: ( ·::;: )
l 3 lCi D=O
1 ::32~::1 :=<=5(iwf-· ( ::::~J:¢:t))
1 ·;:::::f1 G!=-1 :¢:C!
1 340 GOTO 1 ¥'.n?1
1~~~ IF P>14 THEN 1370
1360 R=INTC40*FNFC1)J

1 "::'.!:;ti~i ><=:=-::+ f G!=~~~)


140(i F.'.=Pi=O
1 410 GOSUB i 4~i0
1420 GOTO 155li
145~3 PF.'IMT"BAL.L ot1 II;
1460 IF :=<>50 THEt--1 149~)
l 4 70 PR I MT 0$ ( 1 ) ; II II ; :::: ;

149~:1 PRINT 0$ CTI; II II; f!f:::; C:<-10(ij;


1500 PPHff " YARD LINE 11
1 :=; 1li F:ETUPM
1 ~55(i D=D+ 1
i560 IF D>1 THEM 1590
1570 DEF FNTCX,QJ=ABSCX-CCCQ+1)/2J•100J)
15B(1 DEF Ft-·llJ(:>::,oJ=AB::;c;:.::-·C ( CG!-1) ..·.. 2:t•H;:1(1))
1590 IF D<>l THEN 1660
160(1 IF PB< )(1 THEt"i 162t1
1 61 (! ::;=(1
l 62(1 pp I MT E$ ( 4i:'.) ; II DOf;Jt·i II ; 0$ (ABS ( 1)-·2) ) ;
163(1 IF FMT C:>=:, OJ >10 THEli 16::::0
1640 G1=1
1650 GOTO i 711~1
i 660 PRHff E$ c41+D:i; rim·~t1";
11

1 6 7(1 IF G 1 >(1 THEli 1 710


16Bt1 PR I MT 11 'r'1=1F:D::; To GO: " ; ABS i: 1 o-·:; J
169(1 PRIMT
1 700 GOTO 1 78(1
1 71(1 PF.'.Itff 11 II;[$ ( 41)
1720 PRIMT
1 730 F.'.EM
1 7B~3 P::::=0
1790 P1=P
1 :::00 CiOSUB 549[1
1 810 IF Z }(1 THEt-1 5390
1820 IF 8>0 THEN 2260
1 B::::i.:;:1 GOTO 2'340
1840 IF D>1 THEN 1890
1:::?(1 P=1+IMTC3.5*-F.'.MDC--1J )*4

713
1890 IF D>2 THEN 2000
1 920 IF At:::; f 10-3) /3 THEN 1950
1930 P=12+INTC3*RND(-11)
1 ·;.14c1 GOTO 2330
1 950 IF P 1 >12 THHI 1;:::?O
1960 IF P1>8 THEN 1990
1 97~:1 P=P 1 + 1

199(i on ( IMT (c'. 0*=F.'.ND (-1) ) +1) GOTO 187(1, 1'370


20€10 IF D>:::: THEtl c'.l 6(1
c'.030 IF ABS 00-'.:;) >3 THEN c'.(160
f:'.1214(1 P=l +4:0:INT (2*Rt"ffl (-1)) + IMT (2*RND t:-1.))
f:'. 05(1 GOTO ;;::::::30
2060 IF AB::; 00-'.:;:i >6 THEN 2€180
c'. 07(1 GOTO 197(1
2080 IF ABSC10-SJ>11 THEN 2110
c'.121'3~3 P=P 1+ 1
21(1(1 GOTO 197(1
2110 IF ABSC10-Sl<25 THEN 1930
E'. 1 f'.(i P= i 7
2 i 30 GOTO c'330
E'. 16~3 IF nff (: -: ' 0) >A~7.i THEt·1 c'.22(1
c'.1 70 IF AB:::; ( 1t:::1-::;) >J THEM c~ 190
c'.1 :::€1 GOTO 2€1*3
219(1 IF Flff i: :=<, G! J >2:i THEM 222(1
2200 P=15
c'.21(1 GOTO 2:::::;:(1
222(1 F'= 1El
2c'.30 GOTO 2::::::::0
2260 PfHNT"'r'OUR PLA'l";
c'.270 INPUT P
2280 IF P>17 GOTO 2286
22::::2 IF F'< 1 1:;1]TC1 22:::E.
2 284 GOTO 2::::::::~;.1
2286 PR!tff"L·~HAT KINDA PLA'-i"'' S THAT? TP\' FIGAHh HH~U<LETOES. 11

22:=::3 C~(ITCt 22E.0


2330 PF.'.Hff E$ (P+E.:;
2::::40 IF P< 15 THEM E~36(1
c'.350 ON P-14 GOTO .E~41(1, ;:~66(1, 2730
;::::::60 L=L CF')
c'.::::70 G=G CF')
238(1 IF C!<0 THEt·I 301 (1
239~:::1 GOTO 284(1
241~3 PEM
2420 Y=INT (FMF ( 1) *-5(1)
243121 IF V>.6:0:nff (>=:,o:i THEt-~ c:46€1
c::440 PFHMT E$ (;::1 J;" I:::; BLOCKED"
2450 GOTO 2520
2460 IF 'r'< (FNT (::-:;, C!) +10) THEM 2510
c'. 4 70 IF • (15+ 1(1/Ftff ( :=-:: ' G!) <~'.tm ( -1 ) THEM 251 (1
24:30 PP I MT [$: ( 21) ; II 1:::; GOOD! II

714
C'.::;2~:1 :D=~::;=~~.i
2530 IF Y>FNTfX,QJ T~lEN 1300
2550 R=INTCFNFl1l~YJ
;~'.SE,[i C~1]TC1 27:::121
2590 IF RNDC-ll>.20 THEN 2630
i~~'. Ei(i(i F'F:~ I r·u·IT ( ;~4·) ; JI F'FI TI _.Eii II
~::, f, 1!-~1 F"~=[i

;:·630 PPIHT E:;:rc.:4:i; 11


1·::; coon!"
;:::i:Ati GOTO 5190
(~'.f,E.ti F.:Et 11

2670 Y=20+INT!30~FNFC1))
;::i:.;:;:(i PPit-iT y; II 'r'f~!RD PUNT"

2700 R=INTC35~FNFC1J)
c:? 1 ti e;cno 27::::0
;~:'.7:3~3 F.:Et:1
;::·? 40 Y=3~-i+ r r·ff f 2o:r:i:n1r i: 1 :i .,
E?s0 PPnff v; 11 \'flPD KICK"
C.~ 7 E,~:::i ::<=::-:: + t: G!*\')
2770 R=INTC10•FNF(1Jl
c~?::=:0 GOTO :~:·36(j
2840 IF Q(0 THEN 2940
;;:·:;::50 IF Ft-ff i:::·::, I]) >;:·0 THEJ1 2:::::::~3
C'.~::E,(1 Ir3=:3
C~:::7~1 i:;t]TCI :::,:(11 ~~I
2880 IF ABSC10-Sl<20 THEN 2910
;;:· e9t1 D9=4
;:: 9(10 GOTO 3(110
2910 D9=1+INTC2~RND(-1))
c'.920 CiOTO 3010
E'.94(1 PPHff"DEFEJ·l::;E 11 ;
c'. ·35(1 I MPUT D9
2960 IF D9>4 GOTO 2966
2962 IF D9<1 GOTO 2966
c'.964 GOTO 184~3
;::966 PPHff"YA PPIMADOMt·1A ! CALL A PEAL DEFTr·IES, OKAY?"
2968 GOTO 2940
301(1 REM
302(1 IF P>8 THEl1 °::'.:C.:::::0
::.:0::::~:::1 IF P >4 THEM J0~i(i
304(1 OM P GOTO 3E::.:0, :;:0:::(1, 31c'.(1, ::::120
305(1 ON P-4 GOTO ::::0:::(1, :?:160, ::::160, 32(10
3080 IF P1<>1 THEM 3230
3t19t1 GOTO 3210
3120 IF P1<>2 THEN 3230
:;: 130 GOTO 3c'.10

715
3160 IF P1<>5 THEN 3230
:::: 170 GOTO 3210
3200 IF P1<9 THtN 3230
::=:c~ 1~~1 LI= 1 a C'.5
3c~20 GOTO 3;:'.60
3C.'.30 U=1
3260 IF D9<>1 THEN 3290
3270 IF P>5 THEN 3410
3280 ON P GOTO 3430,3410,3390,3410,3430
329(1 IF D9< >2 THn·I :::::3c'.0
3300 IF P>5 THEN 3410
3310 ON P GOTO 3410,3430,3410,3390,3430
3320 IF D9<>3 THEN 3360
::::::::::::i:1 IF P >5 THEM 3::::50
3340 ON P GOTO 3430,3430,3410,3410,3430
::::350 IF P<>9 THEM 34H:J
3360 IF P<13 THEN 3380
:337(1 GOTO :-;:43~)
:::::380 IF P< >B THD-1 3410
:3::::·30 t~1=1. C~5
3400 GOTO 348(1
::::410 M=1
3420 GOTO 348(1

3480 'r'=INT ( ( i:c;:i:i:i:;::r·m (-1) ) ·-· (L*F.'.ND i:-u ) ) ~ (IJ:<i:M) )


:3490 IF R2< >€1 THEl·I 513(1
35~~10 IF RND i:-1) <. 9::: TH[N :::::530
3510 Y=FNTt:X,Ql+1
352(1 GOTO 4570
::::530 IF P>8 THEt··I 37'90
::::580 IF F.'.ND ( ~ 1) <. 93 THEt1 4030
3 590 \'==I NT ( • '5*-Fl1F ( 1 ) :<i:y)
:::: 6f.:'.10 PR I MT E$ ( ::::8) ; II AFTER I! ;
3610 IF Y<=0 THEN 3640
~~:E.2(1 F'F.~It"~T 'y'; 11 ";E$f 1);
11 11
;E$:f::::7)

364'21 IF Y< >0 THH1 :3670


::::65(1 PF.'.INT E$: i:::::6)
366€1 GOTO :369[1
36712:1 PRINT ABS(\'); 11 11 ;E$0); 11 11 ;E$C35l
3690 IF 1-IMT (c'.*F.tm (-1) ) =(1 THEN ::::72121
3 70~3 PF.'. I t'IT E$ ( ::::8) ; II F.·ECOl...IEF.'.ED II
::::71 (1 GOTO 403(1
3?2€1 PRINT E$ (:38); II LOST"
:;:7::.:€1 ::-::=:~+ f G!~\·:t
J?4(1 !J=G!~ ( ·-1)
:3750 GOTO 5320
:3791) IF RMI1 C-·1) <. (i? THEM :;:9:::0
3800 IF Y>0 THEN 3830
::::81(1 PRINT"OB TACKLED FOF.: II;
:3820 GOTO 4570

716
::Jjt~:1 ("j1JTC1 4.cr3t:1
:;: ·=.t:3t1 F1 F.~ I t"1TE~: f -~!:::~ J
>~:=>< + f C!* Y' :t
1
:3 34(1
1

3950 R=INTC15~FNFC1J J
'3'3E;~3 F·=1 ~=~
~3 t3 7~:t 1)=~::; =Ci 1 =f~
C;C1TCi 4.;:;7(1
~:::·;1~:::~:1
i:.l !J:3C1 IF f;F:~:; ( F.~f"iII ( -· 1 J .. _.is ~:;) :.>. C.:.14 THEt·i 4 5i'fi
4 0 4(1 p:=:= i
,~. i?t 5li C:iCiT Ci 4. 71 t~i
4060 IF INTC2•RNDC-1ll=O THEN 4130
4070 L·l=-1
4080 IF INTC2~RNDC-1ll=0 THEN 4110
i:l li '3l1 F·:=:= 1 ~i
4100 GOTO 4150
4 120 GOTO 41 72!

=l 14~i C:it)1'() 4(1::::(1


1

4150 PRINT E$C31J;


4160 GOTO 41B0
4170 PRINT E$C30J;
4 1 ::::0 pp I t"ff II II ; [::7,: ( ;::9) ; II Ot-1 II ; 0:$ (AB'.::; ( H-;:'.) )
4190 IF W<0 THEl~ 4350
4 ~~'.00 IF C!< (i THEN 4300
4210 IF P8=15 THEN 4Z30
4220 IF Y<=0 THEN 4320
.::J.c::::t1 CiCt~:;tJE: ~1-:3·3t1
4 2 40 \'=P8*~·j
4 250 pp I MT E$ ( E'.·::1) ; II 1=1CCEPTED: II ; p:::; II \'FiPD:::; II
4i:'.60 D=I1-1

4300 IF S+Y>ABSC10-S) THEN 4320


4·31(; GOTO 4230
~1-~32(1 F·~:::=J.)
4 330 GOTO 457(1
4340 IF W>0 THEN 4210
435(:t PPHff"DO \'OU !4CCEPT THE PENALT\' l'lC::; OP t-10) II;
4 ::i==.i:::1 I MPUT C$:
4 ::r?0 1F C$==" 1-10 11 THEJi 4::::c'.t1
4::_::75 IF C$= H 11 11
THEt·-1 4::::;:'.:'.(i

439(; IF G>O THEM 44'?(1

717
= =
.-
:;:
..:....
(lj ....
::
.-. 0::.
c:::i
l=J
.-. co
l~t l~I
·-·
((1
0.1
I
((I
Ld
r-1
r--
OJ OJ ::; i:i:i 1=:;:; ::-
LI°)
":'j'
if)
~r
((I
i;s1
1T:
..._. ·-·
((1
·-·
l_i ·ifr µ::, I-·
..,...
~
:z: ..J
....
j=f 1I:
....... ~
t;J
:r.
I-
w
I
I-

::;
..:....
1-1
,::-.;
c.i:::
= ~fr
i=I

(S:i 1:S:i
1i·1 >t-f
fr-:, •!)
·-·l=·
0...
•:S:i
tj- i_:) .-.

(ij (!j
• •. .c
t-=·; ,-
(S)
~:
(S:1
((!
'·D ~::r

1S)
l~i '.~· ~~i
·::r
1 l)_i

0
~omo
0m0-
G
,. _
1-S:11I
~:r Ci
10:::-i
r~
i"-
·::r

iI (S)
":- 1.£1
- (S)
!~) l!IA'·
= 13'.1
OJ if)
C'°) L :Z:
1I
0::.
"':T
·.J ::·:_
ii-. (:.:; :. j:::::;
::( tj·
••
~o..
:~: ~~'. ·tj-
~oom~
~ ~
'!~! .. ~'".:::!
Ct::
= -::r
Z:
ar.
= = (S) i..W W
l.C:• I I
I-
::-::
._, ):: ·-< }:: L.. .1.- .L- ('J:: :z: .-. .-. LLl I- I- LL,,
:z:=~ 1-~ L W ~ .,;... UJ LJ z: i..1.J Z:: L!.J :~- LW .£1 1
:~- I 1S) (i\ ..::...
~:z:~ :Z:I-- W I !
~w i.J.J ...!...
"'r''
I
:r Lw :c W :J.:: I ('"1 ·-· l-- -.::r (S:• (1) (S:1 Ld "'-1,....., ~
~~ru~ :r !·~... ~J~: (:;'.! t-"" = 1::.;:i i-··· -- 1:S:1 ((t
~~L9~~9I
!- '.,,_.· ~ l,IJ "·/ l.J_ i,IJ I- "':T
0 Q
..-1 ["- i·"-
..'""
,
......
1-· ;S:1 i-.. I
((! i-- I-· ((! u '*'· 1) ) -lit ((t ~Ci
(S) ·-·
1~~1 i:o ·!fr
•.£)
.(i
1

1:S:1 ·-·
o:i -4.i'r
1,£1 I (fi ((I (S)
".Li !-- ii Ii Ci"
(S) (..)
13:1 H
i:(; ·-· If') CC• ·-· LD 7 "':T "':!'° ;¢=
LI'.; 1,.(1 tj\ · :jM
1
( 1
') ('.;) f···- (S:1 l..i..i f"- (C
::- ..·... (iJ Li.J If'.> ('~' LJ LI') ...-1 OJ LI''.! .,..-1 :::.:::
r1 .. I- ot:"J'" a_ 1- -g- (~;) ~:r tj·· z: . -4 c::; 1~: "'.I" (I\ - .,...., 1:S:1 'r"I II ":t /'., ":j"· ••.•.· 11-1 1-:'; 1'"':·; 1r1 ,:z:, + + l~lj if) =
:i:i; :z:: .... /· . . .,. . '°'"· Ii 1- cb - · 1-- i. 1:ci :i · 1-
::..
-:r 1'1 '--4 .-. fl i 1-1 ,-, '7
0::: /·. ·-·
!"''"'! -i-1 :-1 ....... LI
-· . .. ,I j'.:'.: . - II i=:, - ~• ;.. i ~: j::. ... ::.::
1::i::1 /··.
·+·
.w..., ;--·::1
~~7~, ....
r"" t""'
·.,/ 1--
1-1 i-•

"·.." l-
1=1 ::{ ::( 1:L. Li~ 1::1 :;.... :;::.~ l=I ::- z.: l=i ..,...
H I-· j'.:.~
0... 1-1 :z: t""IJ .,..., ..-1 - ! ...-. l-1 ..,...
i= !--! '11 I ii 0°:1 i i=: j'.:; ii ((I
1:J::i /
=I
... OJ CU
i:::.: ((! ((I l=I
1..() l=t 7:
I-·
1-- ··~.t· !-·· .....,
~ Li... 0) ..- l.1... ((! Ci LL II Ci II C1 LJ L1_ ii C• i..1- l..L L1_ Ci LL Le.. l.1... Li- C1 LL 0::: 1:J LL 0::: C• o::: LL C• LI::: i:r.. 11 i:o 1=1 ii 1=• LI::: i:1.., p Li... 1.J- LL 1;::1 JI p Q:::
LI... l_ .... Li.. 1::_1 1--J 3 1:.J 3 (!,i 1:t::: 1-·>l )::
r--1 ,......( 1:5 l-·~l I-··! ,....., (.D Im"! I,.•••! 1--H•! }•m•j 1:..:J l-4 LJ... (.,~ t--t CL. I~ LL I-! C.'J CL CL 1::; ((! CJ c;;; t:_::! LL.. LJ... 1_'.} l-...., ,_.., f-··i l,,,!J u... 1_:1 l.J...
OQQQQQQOQQQ~QQQQQQQQQQQQ0QQQQQQQQQQQ~QQQQQQQQQQQQQQ
o..-1ruM~m~~-0000..-1ru~oo~o-ru0~moo~o-ru0~m~~oo0m~~oo~o-~m~~oo00..-1ruM
~~~-:t"':T-:t~~"':T~m~m~m~~~~~~~~~~~~~~~~~~~oooooooooo00~000~00000
~~~~~~~~~~v~~~~~v~~~-::r-::r-::r~-::r~~~~-::r~~~~~-:t~"':T-:t-:t~-:t"':Tv"':T"':T~mmmm
~:iCi'.5Ci IF :: '/E~ ·.:;" Tl-·tEJ· I ;:::~5·3Ci
:'.iCi55 IF u•.(u T. IEJ·I ;~~;·31[1
~=;r1E1C1 F·F.~ I t··j~r ii FtL1:1'l 11
':':!070 IMPUT P
5080 IF P>14 THEN 5060
5090 IF P>l2 THEN ~220
r:; 1 ti0 Pc'.== 1
::; l 1~3 Ir3=2
i:::: 1 ;::'.0 COTO ·x12~:1
~5 1 :.:!0 F.:2=t1
5 14ti IF Y< 4. i THHl ~-:'ii::C::O
~:; l 'S[i
~; l E,[1 PF.' I MT E:$: ( ;:·4) ; II·:; F!F.'.E GOOD I "
~"i l 7(1 C11:i~=;iJE: ~:;E.t.[1
CitJT() 5:3::~f1
i:; 190 F"3=i
~:"; ;:'. (i(1 c;cc::;~J~B SE.E.(1
':'.'iZ::10 C;C1TC1 5::::~:::(1
i:;c::;::'.(1 PPHff E$ c:::4 :i ; 11
:=irTEJ1PT FF1ILED"
~)2:3~~1 C:!Cl"f(I 5:3:::!C.::I
~;2::::1.] ~=;=::::·+'/
IF :::;:>·3 THEH ~'i:;::;;:::(1
:;;::·:.i~:1
5300 IF D(4 THEN 5350
::;3 i (1 G!=G!~ ( -1)
~-; ·320 I.1=:::;=C:i 1 =~J
5:~::3121 IF F·> 14 1·HE:r"ol 5:;:5;z1
':i :;::4(1 B ( 5+C!l =:B ('5+0 :i + l
':i350 IF P=H:: THDi t;::::E.~?1
:536ti GOSUB 1450
~i :370 C~CtTI] 1551Z1
::; 3 ::::0 PF.: I MT
::; ~3 '3t1 F·F-~ I t·iT Ct$ ( 1 ) ; u : u ; !'.:; 1 ; 11

~;4;;::10 PPIMT
5410 D=S=Z=Pi=G1=P=P9=0
54;:'.0 IF s::::< >O THFN 5450
':i43(1 G!=O*- f -· 1 :i
~~; 440 GOTO 120~:1
5 4 50 >=:=50- i: 3C1*CU
'5460 PPHff E$t:2:i; 11
FF.:OM ";O$(AI:si:o-;::'.:i :i; 11
;::o ";E:$:(6)
~i 4. ?t1 ~=;::::=(1
~i4:~:0 GOTO 12.~:(1
~i49t1 T=T +1
550(1 IF T=H9-~i THEl·I 5591)
5510 IF T=E9-5 THEN 5590
5520 IF T>H9 THEN 5540
553(1 GOTO 565(1
r554(1 IF Tl >O THEt·! 563~:1
5550 IF RNDC-1)<.35 THEN 5650
~i56C'l GO'.::;U:t: 5B10
':i57(i ()=T5

719
=
C1
z::
0:::
0
((1
Ld
::-
((I
()
1-i
....... =
1-
~ 1~1
((1 :<t=
-
1-1 i"1;.1 ....... II 0
+ r. ..1 N
=
1''1
Z:
.......
.......
...13:1
1:1:1
If)
,. :

l-
a::
I-·
((l
w
E

i:o~.
- ..,
,.,

0:::
i=l
1:0
w
-:-

-
1-
II
- '1
i

II
0

"
..:...
U::: a:: 0 ~
~
~ 0 TI
•I . 1':"i_ i.C1i-::"'i •"=:'110::-11'1"1
3. W :: - i:r:, If:, + w ~ 1S1 if
0I ~ W I- m0 ~ G Z 0-0...
w t---
if) 1:r· (S)
1 1S:1 + E Z: lf) ~ ·-· 1I ~.j) ll
l-- ».Li C.L. 1S1 Ll'°:i ::- .- : ([ 1I Z: ... CL 1:.;J Z: .,--;
;;~ m0 +~ ~+ G W ~ 3 WZ:: ~ - WZ::il..
-"-
!-4
·-·- lJ':;
...:... •
·::-: i.t
!_c•
i.O ·::-:
!...;:•
+
.,....;
E
1-1 Li_
_
-'
~[ W
1-- ..l...
CC
"" '>;'j"
.-.
..-!
0:::
w
I ~ J1. If)
j-- ..!... l,IJ ..-1
~ WA +z:: Z::+ ..-1 I- 0 0 !- = + I 1-00
l J:: .-. W
C1J LJ CO ·-· Li... ::- = !- 0,...... i- :: II 0
;S:1 (.:• i:s:i 1- .,.....
i
:r:
<_, c:~'
;:c. 1-· ;:r., ....... IJ".
I ·-·
i-- 1::i::1
1:S) ~·
".!) !i
-i 1:S:1 i~
1I: Li") Z:
1=1
C• i/1· z: Z::
= i:c
1--
r-· ·-·
<.Ir
i=• ,=, = . . .-\ 1-
Z: ·IJ't Z: Z: ((I
iJ\ ::;: i.r1 t:S:I
(1~; I-·- '.i) i:r.. ·-·· !I c f"- 0... II r"- .--. :I ((! LJ i::i .:..:i :: = ((I 1:S:< i::::i 1:r: (.) = = II ...... w Ii')
i.(-:! :: If) Ld i::t Z:: .-.. 1::;:1 t.ri f' +
Z: (0 .-. i.J'"'.• c; :Z:: If) = II ii = ::
:: II t-·1 ...... Z: = Ii II I- II G:• 1-1 0::: (•~!
1-- I- 1-- ·-./ Z:: 0::: •::; /., C•J .,..., 0::: / ... c; 0::: I-'· +1-- i- t··- ·1.i'!· <.it !- 1-- 1-- 1-1 I- 1-- II Ct:. i- 1-- i.i't .t/r II ,....,. II 0
oz::z::z::o1--0:::~+000000~0..+o-~roz-z::~uuz::z:z:: z::1-z::-~~
!-·- 1--1 ...... 1-1 1-- I-· (lj II I-· 11 i- I)) 1-- .,._, I- 1-i 'I- 1-1 11 1-1 0.. ,. . ., . . . . . . . . 0::: H ::..: H 1-- :::c I- il.. z .z::~uui::::i
...
II 0::: 1-1 ::-:: ((I II I- i=i -1-1--0
O 0::: 0::. 0::. 0 Li.. Lt... W ·-· Lt... Ct.I C1 .,..... W Li... ·-· 1::1 ·-· W Ct:: 1=1 Ct:: 1J" 11:. Z: Li.. Lt_ 0::. 0::: Ct:: Ct 1:J::: W 11:. II 11 l.i..I 1.J 0::: :Z:: Li.. Li.. (T" C• ·-· W W (1) C• Z:
G~~~o--O:::~HOOGOOO:::-~G~ll:.il..O~N~---o..O..O..Li...~Z:~N~ll:.ll:.~--HNl..t..~:Z::ll:.H~W
00000000000000000000000000m00000000000000mo0000M00
0000-ru0~~~~0000-~0~~0-ru0~m~~~oo00-ruM~~~~0-ru0M~~~~oooo~0
~m~~0~0~~00~~~~~~~~0000000000000000000000~~0000000000000000-
~~~~mmmm~~m~mm~~mmm~m~~mmmmmmmmmmmmmmm000~~0~~~~00
n I I c; I·:; PF'fl--•'.;T\'L F FCU-1TBflLL. \'(!l_I ~I I LL f:[ THE
01.lf-tRTEF'f:FICl Htffl DEFE.tt~:; I' I[ ::: I Cit1AL -·OiLLEF:: FOP \'Cit !P
TE fit· I. '/(II.I Hfll I[ l 4 OFFE:ll:::: II.IE PL.ff/:::: c:::=.: PUN:::;; (, PA'.:/:;;[::;;)
i=it!Tt 4 l!EFTt1::::11.1[ !::1LICitlMEl·IT'.:::.
THFF'r T·:::: Fl n1c1-- t·I J t IUTE l·JAF.'.N I tJCi I;[Ff!P[ THE FJ III
OF EACH Hf-tLF. FJ U[ TC1 '.:'.;[l.)Et! PLfl\':::; APE LETT Iti TH[
HALF FIT THAT F'(JHIT.

JIO ';'OU ~·lrnrr fl L.J ·=;T UF' F'LJl'r"::;


CFILL PL H'r':::: f-1:::: F(1L.LO~·I:::;:

F'.Utt:;::
1 :::J! I 1.J[; ·~'.::::OFF Tr=1c1:1 . . r; J::::::::c I ·:::::::OP'.:::; 4=TF~·i::1p
1
:'1=::::~·-IEEP; f.:::OF'T I Ot-1; ?:::F'EU[F'::E; ::::=ItPml

·::1::::•:::IDEL.HIE; lO=LC10~::-1t1; l 1=POLLOUT


12=SCREEN; 13=,FL\',; 14=,POST,
,,·rc-v:::::
1 '3==F I ELD COFIU 1 E.::::FtltlT; 1 ?'=i~!U I Cl. KI Cl

CFILL IIFFEti:::;E:;:: A:::: FOLLC!l·~:::::


1 =, F'PO, i: 4-3) ; c'=, OK TE , ( 5--;::'. 1 ; ;:::::: , ·::HOPT--\'TJC, ; 4=' PPEIJEJff'

JETS WON THE TC~S.


DO \'OU ELECT TO VI Cl< (JP PF.CE I' .JE"7K I CK

i:.·::1 \'!=iPD ~,-I cv:OFF


TOUCHBACK
BALL rn1 RAMS 20 \'ARD LINE
FI F'.'.:::T DOWN RF1M:::; '"f°rn:;::n:: TO (iO: 10

DETEtt:::E?4
:::~·~EEP
E: 'r'FIPD LOS:::
HOLDING PENALTY ON .JETS
PENALTY ACCEPTED: l':i \'AF.'.I6
BALL ON RF~S 35 \'APD LIME
FI P::::r Dm·JM RAMS \'FIRDS TO GO: J(I

DEFUt::E?c'
::;I DELINE
INCOMPLETE
NO GAit·1
BALL ON RAMS ·::!:; \'F!Pfl L HIE
:::Ecotm DOl·U·1 \'ARDS TO GO: 10

DEF'Ett:;E?c'.
DI I.)[
1 ';'f"iRD GA H1
BALL ON F.'.f'iM:::; 36 'r'AF.'.D L nu:
THIRD DOWN \'ARDS TO GO: 9

721
FUNDS 1:
DESCRIPTION
Funds 1 performs financial projections for an investor. Funds 2 is used to
plot the data from this program. The program is normalized to allow various
investment plans to be compared.

USERS
Individuals and companies engaged in financial speculation and investment
would have use for this program. In addition, it could be related to any
homeowner, as a home is an investment. With this program one could do e-
quity projections on a home for the purpose of loans or additional invest-
ment value.

INSTRUCTIONS
The program is self prompting and requires no maintenance prior to execution.
The program normalizes all investments to $100 and makes projections for a 50
year period. In order to correct for other investments the investment return
need only be scaled by the ratio of $100 to the true $ investment. For example:
if the investment was $14,100 then the investment return projections should be
multiplied by 141, and so forth. The program can be listed for additional op-
erating information.

LIMITATIONS
Funds 1 uses two dimensional arrays, starting in line 100. Line 910 contains
a TAB ( ) statement and starting in line 950 Print Using statements are used.
The source code requires 4K Bytes for storage. Execution is a function of the
length of the projection as set in the DIM statement in line 100. With the
present setting the program will require 37K Bytes of memory for execution.
This amount can be significantly reduced if the A(32,100) table is reduced,
however this will reduce the length of the projection. The program is pre-
sently set for operation without a storage file for the tables. If the re-
sults are not to be plotted with Funds 2, then there is no loss, however if
Funds 2 is to be utilized, it would be advantageous to convert this program
to use a storage file. Instructions for utilizing a storage file are given
under Funds 2. This program has been written without file statements as most
small system compilers do not have this statement and the object of this li-
brary is to be as universally compatible as possible.

722
f.

4':';F:'.EM
c_"iCIREM
60REM~•••••••••••••••••••••••••••••••••~••••••••••••••••••••••••••
180 UIM A(32,1~~J,Tf60J,Bf l

1 t:!Zi I 1··1F·IJT E;::~


1 ?O PF'. HIT II ~·!Hf!T Pff!F !JF '.:;F'Flffl I hCi L:; E:!_ITICETED II ;

jen IiiPUT P2
1 90 F.'.EM u:::;ER ::PE:c IF I[:::; E:>=:PECTED RATF OF RE1l.iPN F.' f!tffl '.::;TD DP) I fH IO!··! ·::;
;::·0t1 t?EM U=LOG ( 1+P1 J HF1:::; DI::;TPIBUTIDl·I UITH [;:<PECTED UFil.UE Uc'. FIND
;::'.1 (i PEM UAR IF1t·1c:E: :.::;;::·' ~·lH I LE Pi HAt:; t·iEAH F' fir ff! 1..JFIP I Fit-ICE :::; i .
220 REM DEDUCE S2 FlND U2 FROM R AND Si
240 LET S2=LOGCS1/(1+Rlt2+1l
;::'.50 L[T Uc'.=LOCi ( 1 +R) -· r 1 ..··;::'.):,;.:LOG ( :::; 1 / ( 1+R) ·tc'.+ l .,
260 REM NUMBER OF PERIODS N
;::'.7(i Lr::T r·1=~=i(I
;::: ::::0 PEM MUMBER OF :::; I MULfff Iott:; t·i 1
;:::90 LET Ml=i1X.i
::=:00 REM SIZE: OF rutrn THRE.E PPECETIHiG '/EHP:::;

320 DATA 100,100,180


::=:30 PF:Hff "AT L·~HF!T HlTER1.. 1AL.:::; DO YOU 1-ll':;H Tl.'''.::;";
340 I 1··JPUT I 1
3~::;(j IF IMT(!'i/Ii):::::tl.··11 THEti 3::;::0
::::: f,(i pp Hff II
1·111~::;1 T:F F'Cs::;:=nt:LE TO DH.II DE ItHE.F'.1.JALS F.J)EJiL'1' HffO"; ii
::::70 GOTO ~:::=:o
380 IF 11)4 THEJ~ 410
?:90 F'PHff "
I MlTP' iAU:; Mt 1:::;r BE GPE:ATEP THAH OP EOUflL. To 5"
4ti0 GOTO ~:::;:--:;::o
4 10 LET Mc'.=tt.··· I 1
420 FOR I=i TO Ni
430 REM LAST PERIOD FUND SIZE Y3
44(1 LET T ( 1~1 :i =\':?.:
450 REM INITIALIZE E3,G1,H1

723
4i:::,o LET ·c>==(i
.:.f?~?.1 LET Gil=-· 1
4::~:~::t
l.E:T H 1 ~<:
490 F.:EM DF' ~·J RATE OF RETURM AND COMPOUND FOP~.JAF.:D N '1"EARS
~i00 FOP K=1 TO t·i
5 1 0 CiOSUB 11212(1
520 LET TCKl=TCK-1J•CR1+1J
~;:;::121 F.:EM COMPUTE Cot'fTPIBUTIOtiS F·tt·rn HITHDF:'.AWALS
~i4(1 GOSUB 1100
550 LET TCKJ=TCKJ-E1+C
560 REM PLACES SIZE AND WITHDRAWALS IN MATRIX. ACX,YJ IS FOR INTERUAL x,
570 REM SIMULATION Y.
580 IF K<5 THEN 600
590 IF K/Il<>INTCK/Ill THEN 610
60(1 Go::;tJB 1245
6 iO HE::<T V
6i:'.O ND::T I
E. 30 F.:EM PUT MFITR I:=< IN F1:::CEND I HG ORIIER. fl C:=<, "f' J I'.:;; \'TH LAF.:GEST FUtfft SIZE,
640 F.:EM H·I ::HMUL.FffION :=::,IF >=: r::; onn, \'TH LFIF.:GE~:T PAYOUT Iti SIMULATION
650 REM x, IF X IS EUEN
660 FOR P=l TO CN2+4l~2
670 FOR 1=1 TO Nl-1
680 FOR J=I+1 TO N1
690 IF ACP,Il<=ACP,JJ THEN 730
700 LET Q1=ACP,IJ
710 LET ACP,Il=ACP,JJ
720 LET ACP,JJ=Q1
?::::f1 MD::T J
?40 NDff I
?5[1 NDff P
70::.iJ F'F'H-IT 11 1'-1 11 ' lb 11 i'H"' t·l:L' II Jl 11' I1
??0 FOR I=1 TO CN2+4l*2
780 FOR J=1 TO Ni
790 Pl? I t·ff 11 Fl ( II ; I ' j; II ) ::" II ; t=I ( J ' .J)
t·4E::<T j
:::121(1
i"I F:>::T _I
::::i 0 .
820 FOR I=1 TO CN2+4J•2
:::JO LET B CI ) =O
::MO FOF.: .J=1 Tot·H
850 LET BCil=BCil+ACI,Jl
:360 t·IE::ff .J
870 LET BCil=BCIJ/Nl
:::::::(1 t--ID=:T I
:::90 PF.'.It~T"

II

-::ioo PPHff "TOTAL F:'.ETur:;;:r-.1 rut-in AT Etm or:"


9 1~3 PF.'. I MT TAB (61 ) ; AUEPFIGE II II

·;.12(1 F'F.'.IMT PEPIOD 11 ' "UF'PEF.: :E:OUND",


11
II MEAt·i", "LOl·JEP BOLIMII", "SPEMDIMG"
-;.i::::o FOP I=1 TO t:l"ic~+4:1 :<i:c'. '.::TEP 2

724
940 IF I>:::: THDI 9t.::::=1
·;:14? LET I9:.::=I9+1
948 IF BCIJ~399999.99 THEN 954
9 '5(1 PP I t·n U'.:; Inc i ;:::· :::ci ' I •j ' fl f I ' n l ) , I: ( I ) , \::! r I , 1 ) ' HI I + 1 )
·::1~;;:: GO TO 9::;;:(1
954 PRINT USING 1290,I9,ACI,N1J,BCIJ,Afl,ll,BCI+1l
960 GOTO 9:::0
969 LET T8=T8+I1
972 PRHff u::;HIC 1;:::::0,r:::,flfI,tHJd:;c1:i ,A1I, l) ,t;!I+i'I
':'.)74 C~C1 TCi '::1:::(1
976 PRINT USING 1290,rs,ArI,NlJ,B(I),AfI,1),B(l+i)

·::190 PF·InT
1Ci00 PRit·lT
i 0E'.0 LET F:':::=i~i
1030 FOR B8=1 TO 12
1 Ci40 LET F::::=F.::::+F.l!T) ( ><)

1070 LET R1=EXP(U2+SQRCS2J•(P8-6JJ


1 vi:=:r-1 LET Pi :.:::F.: 1-.. 1
109(1 F.:ETUF.'!I
1. H30 IF K< >1 THEJI 1140
1110 LET C=EE~CCY1+Y2+Y3l/3)
1120 LET Ei=CCY1+Y2+Y3)/3J•P2
113(i GO TO 124·0
1140 IF I<<>;:: THE.ti 11 ::)21
1150 LET C=E2~CCY2+Y3+TrK-1lJ/3)
1160 LET E1=CCY2+Y3+TCK-1))/3)*P2
11 ?0 CO TO 1;::4ti
1180 IF K<>J THEN 1220
1190 LET C=E2•CCY3+TCK-1J+TCK-2ll
1200 LET E1=CCY3+T(K-1l+T(K~2))/3)*P2
1;::: 1(i GO TO 1240
1220 LET C=E2~C(TCK-1J+TCK-2J+T(K J)/3J
1230 LET Ei=(CTCK-3J+T(K-2J+TCK-1))/3)~P2
1E: 40 F:'.ETUF.'.t·1
124'.'.:; u:r c 1=G1 +E'.
1250 LET ACGl,IJ=TCKJ
l c55 LET H1=Hl +c'.
1260 LET ACH1,Il=E1
l ;:?(i F.'.ETUPM
*F#######. ## :fl:#######.## t~#######. ## #=t!=######. ##
l 29(1: ## #. =tMt###lllll #. :if.####lt""t'"lt' ti: • #####l"lll"t· fl:. #####ll·M·t·
l3~X1 END

725
1.. 1Hfn FIRE [:::J>r:.:cn:n p;::1n:: or F'.FTUl~:'t-1 i::n In ::;Ti:'li irn=1PT1 [l[U I AT'[ Cl! I ) 1 •::;, • 1 :=.:
u

AT WHAT RATE DO YOU EXPECT NEW MONEY TO BF ADDED ?8


WHAT RATE OF SPENDING IS BUDGETED ?O
fff i"·IHf!T Il'IT[F.'l.)f:IL5 DCI 'r'OU 1. 1ISH TU,·:;; ?r.'';

UPPEF'. LO!·IE:F? nui::1:.>f1CE


PERIOD I: Cl!. I!" IIt l"IEJ:ll"·I i:::OUl"ID :;PFl!II I !'IC,
1 141.1·::. 1. 1:::•. :::::-; ::'.:r;;:1 u i:'.f. J u Ci1a
134. :Li::. :::: ~=l u ~::i :~::: u :~:!!J
l::·3::i 11 !::;121 1:~:;;::~It ~;7 ~:'.·i 7 n '.:'.1 j • i,)0
4 ~~:'.·:~11~?1 0 'S1;:;:: 1. 7i::.. 1;::'. 1
=~j ?I o 1 ~1. 7
t::
"-' 406. ~::;•::; ;::01::. (~9 l i~'.11~=1 n ::::: I?
11::=1;::~1::1. II i:;1"? 4·i='. 1 a ;::7 l 1 ~;II '?~J • (:'H21
E'.'.;:'.'. ::1:::::" ~:i:;:
1
:::4.c:. 71~1 ;:~i::I~:.: I :5!~, a !J!?t

'.::I:::: f.1 ::: a £:, {' 171E,.5::: !:~4.~:1 Sf '37 1


• (:1~;=1
l 1:.1:,,:-l:~: 11 ~:;~::: :~:7 3':~::. ~;5
11
4"'::•'S1 ::::·;::1
u • OCI
'?f,7"?. 7·::.: ·7 :~:: E, • l ::: C! l]!~:i
::::·?i:'..::?::;:: .. 1~1·7 1~i '? ~=i ,:1. I I~~:::: .00
1!:i~::I~;:;::::;111·r :~:(11:, ·::1,:;1. ::f.E,
1
i? ;::: '31 ::.l 0 {' l a !?iCl
"3°3:~: l l 1. • 1:.::::i 1:, l E, ;:: 7 a :;: 1~:1 l:'.1 1{1 ~'.:J :::; a =.i ;:'.'.
1
, C10
f.:,~l(!l( ::1;:~" :~:.:.l
11
1 ;:~1:':1 1~·!51:,. : :.: 1

726
F:'l..H··I

l·~HAT FIF.'.[ E:>::F'F:CTETI Pf!T[ OF" F'ETUF'.h r:11· 1n ':::;TT!! !TIFIF'D [![!)I 1=11 I on ? . 1;.:i::::, • I)?
1=1T ~..!HAT F'.HT[ DO '-1'0U F':OO:F'FCT l·IEJ·I !·Kl! IF'\' TO nrn:1r11 ? • 0 i
1. .1HAT 1~::FnE: or :::;;p[J-ID I!" iCi I·:::; [:I iDGE.T[fl ? . c14~::;
f!T 1...IHAT I J·ITEJ:'l..JF'.1L:::;; TIO \'OU i·I I ·:::;I-I Tll, -::; ? l 0

l.JF'F'E:F'. L. f1t..1E·.e
PE:F.'.IOII BO!.li"-!D F:C1tJilD
l 4 11 ~:;i~'.!
·i r:::--::•
'"Tu .~. 1 I

J. 1:-1- ::::1 . (~1 !:'.'. J. 1,::1. = 1~'.,i?I :~o ;I ?;::J


4 i E.:?:. ':'1 i 1 ;:'.l!~.~l" ~:1.1,::i ::l ti l=~li:'.j.

Jt::: ¥;:~ a ':11;1 74. l l


~:; 5€:1
1
0 7'i21 ;~: .~;.:1. u t'.1f1
1
"?1~1. :::·?
1 l ~::1 :=.: :~: ~=;
11 ;:·j.(:'. 1 ::~ a t:1 1:l 1 ~:=1~.'.1 u f1~~?
1'::1~:::1:1 7 lu
1
i I~.:::; I i::~ '.~'.!
·:.:11111:::7

727
FOOS 2:
DESCRIPTIOt:I
This program is the plotting routine for Funds 1. It may also be used to
plot other data bases, if they are formatted for this program's input.

USERS
Users of Funds 1 will have the most use for this program, however Funds 2
can be used to plot the results of any financial analysis.

INSTRUCTIONS
This program is also self prompting and will ask for all necessary inputs.
For additional information list Funds 1 and Funds 2.

LIMITATIONS
As in Funds 1 this program uses two dimensional arrays, starting in line
100. In line 1331 the TAB ( ) statement appears and is used throughout the
program. The source code stores in 5K Bytes of memory. The execution length
is a function of the reserved table size. With the DIM statements as present-
ly set, it will require 38K Bytes of memory for storage and execution. This
amount may be significantly reduced by reducing the 11 A11 table. Due to the
length of the tables it may be more convenient to store the data from Funds 1
in a use file and then have Funds 2 read this use file. If your compiler has
file statement capability, the mods would be:
FUNDS 1 120 FILES: PLOT 1
128 Scratch #1
760 Write #1: N, Nl, 11
790 Write #1: A(I,J)

FUNDS 2 120 FILES: PLOT 1


125 Read #1: N, Nl, 11
150 Read #1: A(I,J)
155 Rem

728
4':ik'[M
::iOPEJ1

DIM B(35),A(35,100J,ur351
F'F'ItlT JIIi·IPUT n, r·i1:. IlJI
.-.,c;:·I
1 ....
l,,.,,,. - · Ii !F'UT I ! , !'-I 1 , I 1
U:.:T !·!;:>:ti/I l
FOR I= 1 TO C!!2+4J•2
140 FOR J=1 TO N1
1:-::i1:.:1 F'F:I!rr JI Il·!F'LJT n (JI; I, J; JI) JI
155 INPUT ACI,Jl
1 r::.~:1 i!F::O<T ._I

1 qi::-i I MPUT !<$


c'.00 PP I NT JI AT HH I CH PEP I OD DO \'OU HFIHT A HI :::TOGPAM JI ;
210 H-IPUT B
220 IF B<=0 THE~ 1860
c'.c'.2 IF B·CS THEt·I c'.3(1
224 IF B/Il=INTCB/11) THEN 230
c'.26 PPHff "MUST BE Ot··!E: OF THE PEFUODS FOF' ~·.11-IICH Df!Ti4 FIRE PF.:OUIDED AI:Ol.IE. JI
E'.c'.::: GOTO c'.1210
c.:: ::::121 PP I NT JI DO You 1·.1 I :=.::1-1 r o F'E'.:WACE" ;
c'.4(i It~PUT 1.)$
25(1 IF U$:=Jit··IOJI THEJ·I E'.HO
c'.60 PRI~ff JIL·lHAT EJ-IDPOINTSJI;
270 INPUT u5,u4,n5,n4
i.:'.:::~:::1 LET Z= 1
290 PFUNT II

II

292 IF B>4 THEN 300


293 IF Z=2 THEN 296
294 LET C1=2•B-1
295 GOTO 37(1
c'.96 LET C1=C=c'.*-B
297 GOTO ::::60
:::mo LET C=B/I 1+4
310 IF Z=2 THEN 340
320 LET C1=2•C-1

729
:::·\-!) LET C1=c'.:i;i:C
:::r:::.o LET C=:::~*C:
.::1::,~J JF AfC:1,1~11?):::::~~1 ..f,~·!E~!i i5C'.~1
.:;:;::;.i:i IF I:= 1 THE:Ji i ':i;::'.O
~::?'~'! I!=- !J$:=="r·!0 THEJI .:.1.~:~0
11

380 IF Z=2 THEN 410


39ti LE.T !)i =11)4-!.Ji::5) / 10
400 CO TO 4E:0
410 L.ET !Ji= CD4-D'5J/11,~1
420 LET D=ACCi,100)-A(Cl,lJ
440 IF 1L:·10i~ii;:il;'.i THU I 49(1
4 '50 IF D>"5[10(1 THEJI 4 70
.:.lt:=~3 c;;·c~ TCi 5~]~3
47(1 LET f):::=D+.05
,~1.:::1z1 c~c1 Tei ~t(1(1
490 LET D=D+1
:::;00 LET E:::=UB=IJ?=C?= 10 E + 7
:=; 1 ~J IF !):$=II !10 II THFl·I (.";:r1
520 IF Z=2 THEN 590
530 IF AfC1,1J~U5 THEN 570
540 LET E:::=U5
::;50 LET E::::=t. l':'i
:::i6[1 GO TO 650
570 LET E=ACC1,1)
::=;:::0 GU TO 650
590 IF AfC1,1JCD5 THEN 630
6ti0 LET E=D5
1:.1 [i LET E?=Tl5

630 LET E=ACC1,1)


650 IF U4<.A fCi, H:Jm THEll 7(10
660 LET l.)::;:::::1.)4
~~I 7Ci Cil] TCt ·7~JI]
6B0 IF D4<ACC1,100J THEN 700
690 LET i. 17::::1.)4
7 iX1 LET F =H=(i
71(1 LET F=F+1
? c'.O LET B i: F) =ti
7:;:(1 IF l.J$=" \'E::; THEH ?'6121
11

740 LET E=E+D


? 5~J IF !)$:==II 1·10 II TH El~ 1 190
760 IF F<>l THEN 880
770 IF Z=2 THEN 830
780 IF E<>U5 THEN 810
7·31[1 LET E=E+l..Ji
:::0(1 GO TO ::;:;::0
::: 1 ;~1 L.E1' E =•..J~~
:::2(1 GO TO :::?[1

730
830 IF E<>D5 THEN 860
U40 LET [::::[+1..Ji
::::~'.i0 GO TO 870
::::1~~,iz1 LE.:T E===It=:t
:::: 7'~~1 CO TO :::90
:::::::o L.E:T E=E+1_11
:~::9(1 IF F j THF.J I UJ'10
900 IF Z=2 THEN 1010
910 IF [::'.:=H:i E+? T!·IFll 9t:.0
·;1;:'.~) LET G6= 11
930 IF U8=10 E+7 THEN 1100
94(1 LET G6=10
9'::i0 GO TO 1100
·:.160 IF !J::::::::l(i ? THEii 990
':~17(1 LE~T C!Ei=--= 11
·::•:::0 GO TO 1100
·:.190 LET G6=E'.
1 ~-=-·n1f.i GO TO 1 i 00
1010 IF E7=10 f+7 THEN 1060
1 (i:3i) IF- I..J~?:::: 1 ~i E+·'"? T"t-IF~t ·I 1 i ti(i
i (14(1 LET G6= i !21
GO TO 111:10
1 ~-=-1~vi
1060 IF !)7=10 ? THFJI l(i90
LET GE.= 11
1 (i7(1
GO TO 1100
1 [:180
1090 LET G6=L:'.
1100 IF F<~G6 THEN 1190
1118 IF Z=2 THEN 1150
1120 IF U8=10 E+? THEN 1180
113(1 LET [=1)4
j 140 GO TO 117\-::1
1150 IF U7==10 E.+7 THEt"-1 11:::0
1160 LET E==D4
11 ?'(i GO TO 11 ·:,10
1180 LET E=A(Cl,100)
1190 FOR I=H+1 TO 100
1200 IF ACC1,IJ>E+.01 THEN1230
1210 LET BCFl=BCFl+i
1 E'.;::121 LET H= I
1 ; : '. 30 HE:=·::T I
1 c'. 40 LET I) ( F) =E
1 C'5f1 IF 1. )$= II \'E~~=; I! 1·t-·IEJ··I l ~~~:=~~?.1
1260 IF F <>10 THEN 710
1 c'.7(1 CiO TO 1 :::oo
1280 IF F<>G6 THEN 710
1290 CiO TO 1540
1 3(10 IF Z=2 THD··I 13'.::i(i
1:::: 10 PF-'. I MT F ut·m
11 11
; K$; 11
ti I ·:nF 1t:UT I m·1 OF n_1tu1 1..1AUJE:S Fff 11
; B; "'r'E"f1F'.::; 11

l 32~3 PP I MT
1330 LET G=INTCAfC1,1J)

731
i ·:;·:.: 1 F-'F~ I r~1r c;; ·rF:rt.:: t i C' :t ; " : "
1340 GO TU 1·:::::::~_::-i
1 J5l:i PP Hff" F·ut 1n " n=:.$; " DI 3TFU BUT r m··1 OF i·H THIIPA~·mLs AT" H:; "YEAP'.:;"
1 J60 PPHH
1370 LET G=INTfACC1,1J•100)/100
1 :~:·71 F'F.~It··JT c;; TFLB f l;:::t; 11 : 11
1380 FOR I= 1 TO 10
1 :3=3~.:.1 F1 F.~ I t·1T TAI~ f l 2) ; II : II ;

1400 FOR T=l TO BCIJ


1 4 10 PR I t·ff ffiB ( 1 ·::: ) ; I! *II ;
l420 !iD<T T
1430 PRHff
H 40 IF Z=c' THEt I 147\'l
i 45(i LET G=:G+D
1451 PRit-ff IMTce;:i ;ri=rni:1::::i; ": 11

1460 CiO TO 14::::!21


1470 LET G=G+D
1 4 71 PF'. I t·ff r tff 1: c;:i:i: 11210 :r / 1121(1; TAB c1c'. :i ; 11
:
11

1.::i ~:::(1 nr:::-::r r


14'3(1 IF Z=2 THEJ1 1 ~;;::·0
1 ':i0~:::1 LET 2'.=E~
151(1 GO TO 2'30
l 5E'.O F'P nn "
II

l ':;:;:o GO TO 200
1540 IF Z=2 THE~ 1630
i':i50 PF.'.IMT". Flltffl 11 ;K$; II flISTi::::IBUTI0t·1 OF FUMD '-..lflLUE::; AT";r::; 11 \'EAPS"
1560 PPIMT
i::i70 IF E0::::=10 E+7 Tl-IHI 160(1
1580 LET G=INTCE8)
i ::;a1 PRHff G; TAB i: 1c:::i; 11 : 11
15'3(1 CiO TO 17'1 (1
1~~~ LET G=INTCACC1,1JJ
1i::,01 PRIMT e;; ri=1B r: 1c::J ; 11 : 11
i t=. 1 Ll i..:iU TO 1 71 0
1620 IF INTCA(C1,1J•100J/100 =0 THEN 1860
1630REM
164(1 PRINT" F·ur·m 11
; K$;" nisTi:<:IBUTION OF ~,HTHDPmmLs FIT" ;F:; "Yt:APS"
1650 PRINT
1660 IF INT £AfC1,1J•t00J/100= 0 THEN 1850
1670 IF E7=10 E+7 THEN 1700
168(1 LET G= Hff C[7)
1681 PF.'.IMT c;; TAB ( 1;::'.) ; I I : II

1 6 9~3 GO TO 171 0

1 t=. qn GO TO 1? 1 (1
1700 LET G=INTCACC1,1l~100)/100

732
1 7'01 PRHff c;; TA'F.: 1. i;:·:i ; II~ II

17'10 FOR 1=1 TO G6


1720 PPit·ff TFIB ( li=:'); I I : II;

1730 FOR T=1 TO BCIJ


1 ?' 40 PP Hff T1=1B ( 1 :;:: ) ; II ;Q; II ;

1751~1 t-!D::T T
1 7'6(i Pl? Hff
1770 F'F.'.Hff Hff(l.J(I));TAB!i;=::i;":"
1 7:;::(1 GO TO 1:::oo
1 7-90 PPHff nrr i:1,1i:1 :i :.:•' l lili+. os:i ./ H:-io; TFi:t: 1 i;:: :i ; 11
:
11

1 ::;:(10 NDO::T I
1810 IF Z=2 THEN 1840
1 :::20 LET Z=2
1 :::30 GO TO 291;:'!
1 :=:4C"i PR H-lT II

II

1 ;;::50 GO TO 200
1:::60 EMD

733
This example plots the results of the first problem from the program FUNDS 1.

l:ll·""1:rc:1,i
r··~1·r rr1I1 !Jf'""i :i..1r11..J r 1-·1 1-·-!T'.:~; . r·r··ir::~ 1 r·:1r,·1
DC1 \':JU \,if·:;! I TU l,:'F >'i"I! I

ICll
:.,:
,··:

: ••• 1
,··:

';"":'

1,,1
1''1

734
'This example plots the results of the second problem from the program FUNDS 1.

L'-IH I CH Fl 11· ID ?I:CD


:=ff t·.IH I CH PET' I OD TIO 'r'C!U i IH!·IT F! HI ·:;TOCiF<:r=1M ?l
DO \'OU !·I I '.:::H TCI F'E};::F'fiCE ?tiU

1('14

10?

11. i2I

114

735
GO-MOKU:
DESCRIPTIQJi
This program is a simulation of an old Chinese game. It is played on a 9x 9
board and the object of the play is to place 5 in a row without being block-
ed by your opponent. Your opponent is the computer.

USERS
If you like a game offering a fair degree of skill you will enjoy playing
GO-MOKU. The game can be analyzed and the methodology may be reduced to an
algorithm as in TIC-TAC-TOE for those so inclined.

iNSTRUCTIONS
Upon execution the program prints out all necessary instructions and game
rules. All inputs will be prompted by the game program. The playing board
will be printed after each move.

LIMITATIONS
This program uses two dimensional arrays; see line 90. The source code is
SK Bytes long and the game will execute in llK Bytes of memory.

736
,::oeiF'R HIT "'r'Cl!JF' U 1:: JFCT Ii.JF I·:;:; TC! F'l_.f!CT '"'• !·1HF'K.=·;"
Jr! PFnlff"Hi 1=1 :;::;TJ::::1=1Jr-,;HT LI!·i[ (tJTHEP HnF.'IZCllfff·!!... ,. UE:FTIC1=1L, OF TIHIC·-·"
4 0 PF.'. I nT "rn !FiL :i or 1 1=1 9><9 t.:OAPD, PLAY I r·1c HCH :r 1·t:::;T THE coMPUTEP. Et HEP"
::,o F'F'.Hff"'-f'OUR MOIJ[ F1'.;::; ? HUMI:EF'.'.::;; THE PO'.::;ITIO!!'.'.:; AC:PO'.;?;'.;:; AttD 11
i:.c1 PP r t·ff 11 THEH D01·.1n FPot·1 THE UPPE:P LEFT coF:.rff R OF THE :t:OAF'.D. THE: coM-· 11
?('1 Pf?Hff"F'UT[P ~·HLL T~!Fli TELL \'OU IT'.:; f'IC!ll[ flt!D PRHff THE I:Of!PD. '"1''"
::::o F'PHff"l'.:; \'Oil; "C' T·:; TH[ CCW!PUTEP. corn1 LUCl'. Ii
90 DIM AC27,2?J,P(50l
l 00 LE:T L'?-=;:.'.0!2i
1l l~i FOP ._ !:::: i TO ;::·?
120 FOR K=l TO 27
1::1~1 LET f!IJ,i='.:i=:::
i 4Ci MD<T K
1 ':i0 t!D<T ._I
1 t. 0 LET ·=;=:fi
170 FOR J=10 TD 18
180 FOR K=10 TO 18
190 LET AfJ,Kl=8
C.'.CiO nc<T f::
i?'. l 0 t!D<T _.!
;::'.;::121 IF. S= I. THE! I ;::::400
;:: 30 L[T '.;'.;=: 1
;::40 GOTO ;:.:60
;::5(1 CiOSUB ;::~1:::(1
;:'.'.6(1 PF.'.Hff
Z:'.70 PF.'.IMT
~:::::0 I MPUT J 1 , Ki
;;:•9(1 IF .Ji+K1 =Cl THEll 1?0
30(1 LET .J l =.J 1+·:;t
::::1~:1 LET K1=K1+'3
320 IF ACJ1,K1J<>0 THEN 2380
330 LET AC.Ji,K1J=2
34~21 LET DE'.=E~
350 LET I :=:=:~1
]6(1 LE.:T D4=(1
370 LET Li:'.=81
:~::::0 c~c1~:;LrB ~::4~7;
3·;.n;:1 LET D5=D4
400 IF D4>7'3 THEN 1930
4 1 (1 LET Di::= i
4C::~:1 LET L2=6~i
.:.1-::::0 LET D4=l1
44(1 GOSUB S40
450 LET DE.=D4

737
460 IF 05 1 ~~EN 480
470 IF D6<31 THEN 770
480 IF L3>0 THE~ 1958
490 IF DS<1::.5 THEl'I :::tc'.0
51210 LET D;::=c'.
5 10 GOTO 55(1
~:'i2i2! LET D;:'.= 1
::;3(1 LET u=.·=':i5
540 IF D6<55 THEN 580
':i60 IF L3<:: THEJI i:'.'.OH1
~:; 70 GOTO ;:;J):30
580 IF DS<55 THEN 660
L.E1· fi;::~=2
::;=;n~;
60~) GOSUB :::40
6 l 0 LET Lc'.=31
6;:·(1 LET L9=5':i
f;'.i :;: ~z, c;c1~:;1Jt: ~:::4~::1
t:, t:.l~~i 1:;;c1~=;~_t:B 1 E:~=~121
6'.:::1(i GOTO E:i21t0
66~3 LET L2=31
6 7 !21 GC6UB :::40
680 IF L3<2 THEN 700
6 90 GOSUB 16:::0
7~:i0 LET L3=(1
71 0 LET DE'.=c'.
7;:~121 f::;C1~:;1J:.B :::41~1
730 IF L3=0 THEN 780
740 IF L3=1 THEN 1gq0
75t..~1 1E.::a]
C~C1~:;i_1·t~
7 6(1 GOTO 2tf::o

7:::0 LET L2=D5-·:::~


?90 LET L3=0
:::t1~~1 C:iCl:=;t.JE~ :::4(1
810 IF L3>0 THEN 2030
:::;::0 F'RIMT 11 DF.:AL'h II;
a3t1 co TO .:::06121
840 FOR J=1 TO 9
860 roR K=1 TO 10
ff?ti GC6U:B 112121
::::::121 t·1D::T !<
::=:90 MD::T .J
900 FOR K=1 TO 9
910 GO::;IJB 1610
920 FOR J=1 TO 10
9:30 Go::;UB 11E:1~1

9"':i(i MD<T V
96ti FOP L=4 TO -·4 ::;TEP -l

738
·::17i;:1 GOSUB 1610
980 FOR J=l TO 10
990 LET K==J+L
11a00 e;o::::uF.: 1 i :::o
1010 ME::<T J
1 i~iC~(1 t·1E>=:T L
1030 FOR L=5 TO 14
1 :2J4(i Gcr::;UB 161 (i
1050 FOR K=1 TO 10
106li LET J=L·-+:
j O?ti GO:::;UB i i ;~ti
1 ~y::t:1 MD::T V
1090 MD<T L
110(iLET L9=c'.~i0
11 10PETUPti
1120 LET B=ACJ+9,K+9)
1130 IF B=0 THEN 1460
1140 IF B=D2 THEN 1350
115(1 IF 1)1 =a THEt-1 11 ::;:0
1160 IF C1=66 THEN 1180
1170 LET Ci=Ci-10
l 1::;:(1 LET S9=0
11 •j(i LET I.) 1 =0
1200 IF Cl<=C2 GO TO 1220
1 c'. 1(1 LET Cc:=C 1
12.20 IF C5>=5 THEt·I 1;:·50
1 c'.30 GOSUB 1610
1 c'.4(i RETURM
1250 LET C5=0
1260 IF C2<=D4 THEt-1 1280
1 c'.7(1 LET D4=C2
1 c'.B(1 IF C2< L;:;: THEt··I 1 c'.4(1
1 c'.9(1 IF C2>L9 THF.:t-1 1;:;:4(1
1300 IF L1=0 THEN 1240
1310 LET PCL3l=QCL1-1)
1 :::;=·i::-1 LET L::::=L::+l
1:;::30 LET L1=L.1-1
1 :;:4(1 GOTO 13(10
1350 IF U1=1 THEN 1400
1360 LET U1=1
1370 IF ::;;·3=0 THEN 14(1(1
1 :;:::;:0 GOSUB 176(1
1 :?.:90 LET '.::;9=0
1400 LET C6=C7+C6+1
1410 LET C7=(i
142(1 LET C5=C5+l
1430 IF C6 >5 THEt-1 1c'.40
1440 LET C1=C1+20
1450 GOTO 1240
1460 IF U1=1 THEN 1490
1470 LET S9=10*J+K

739
j_ ::;[i~) L. ET I J1 =12~
1::~1 [1 L.ET c·5=C:~i·+ 1
1 ':'ic'.0 IF C 1 <=0 THD I 1 :::;.::1.(~
1 ':·30 LET C7=C?+ 1
1i::,4~3 IF C1<=C2 THFli 1:.::::0
1 :::;51~1 LET C;::=C 1
1560 LET Cl=Cl-4

1 r:;::::o IF C:1 >=Ci THO! 1560


1':!'30 LET Ci=O
1 :::i)(i C~t) TC! 124~1
1 61 ~:-i LET L 1 =0
l 6;:::0 LET Ci=-10
1630 LET C2=0
1 r:;,4~:1 1.~ . ET C:5=(i
1650 LET CE.=O
1 (;1Er(i L.ET c:·?=[t
1 ::. 70 F.'ETUPN
16:::0 FOR H=fi TO L:::::-;::·
1690 FOR I=H+i TO L3-1
1700 IF PCHl=PCil THEN 1140
1 ? 1C1 HD::T I
1 7;:::0 r·tD::r H
1730 PETURM
1740 LET P(0J=PCHl
1 75(1 GOTO 1990
1760 IF C1<65 THEJ·! 1 ::;:;?0
1770 IF Li=0 THEN 1820
1780 IF L1=1 THEN 1870
1790 LET QC0l=Q(1)
1:::00 LET Li=L-1-1
l ~:! 10 G~t]Tt] 17;::~~1
1 ::;:;?0 IF 39=(1 THEll 1:::50
l ::::;:o LET r! ( L 1 ) ::::'.:/:~1

1850 LET QCL1J=10~J+K


1::::60 LET L1=L1+l
1 :::7(1 RETURM
j :=::=:n LET ..J=HIT fF'
(0) /10) +9
1890 LET K=PC0l-10•CJ-9l+9
1900 LET AfJ,KJ=l
1910 PRINT J-9;V-9
1·:;:12(1 RETUF:H
1930 F'F-:Hff "YOU ~,!Hl"
1 '34~.:.i GOTO c'.060
1 r~i!=if-1 (~l]:::;IJJ:: i !=::::i21
t :;1 t.0 1~ce:::1_1i:: 21 ~:::121
t 970 PF.'.IMT "COMPUTEP 1..~rtt:.; ! "
1 9:::0 e;cno E:('.160

740
l 990 GO'.:;UI: 1::::::iz1
c'.000 GOTO 25(1
2~10 LET prol=P(J)
;:::1212(1 GOTO 19·::ic1
2030 LET L9=INTCL3~RNDCXJJ
2040 LET PC0l=P(l9)
c'.050 GOTO 1990
;;:'.(160 PPINT
;:'. ti?[i F'F.~ I t··IT
c::'.o:::o PPHff
C:'.09(1 PF.'IMT UOULD YOU LIKE TO PLA\' FICAH~ ;.:.;;.:.; II

c'. i (iO PP I MT
2110 It··!PUT
212(1 Pl?IMT
PF.:INT
·=-· 14(1 PF.:IMT
;:'.15t1 IF F~$= .. \'li CiO TO 170

c'.1 70 GO TO c'.450
c'. 1 :::0 PF.: I MT
2190 PPIMT II
c'.200 FOP .J=-~10 TO l ::;:
c'. i:'.10 PP Hff .J·-·'3 ;
;:;:;:;:2c1 FOP K=10 TO J::::
2230 FOF.: L=K TO 1: ;:
2240 IF ACL,Jl<>0 THEN 2270
c'.c'.50 ME::-::T L
226(1 CiOTO ;:~::::1c1
c'.27€1 IF A ft::,
J) =~:1 THEtl ;::::::60
2280 IF ACK,J)=1 THEN 2340
E'.290 PF.:Hff "Y ";
E'.::::i~10 r·1o::r K
c~ : : 1(1 PF.: I MT

E'.::::40 PF.:Hff "C 11


;

;::350 GOTO 230(1


2:::::6(1 PP I MT II. II;
i:'. :;:7(1 GOTO 2::::0(1
2:::;:::;:(1 PF.'.IMT "BAD PLA\', MFtKE A MEH OME"
2390 GOTO E:60
2400 LET AC14,14J=1
c:·
c'.410 PPHff "COMP. PLA\'S 1ST !..HTH I
r::·11
·~J

c'.420 LET ::;=0


c'.43(1 GOTO c'.5(1
c'.440 ::TOP
245c1 nm

741
JACK:
DESCRIPTION
Calling all gamblers or would be gamblers ~ this is a simulation of the
game of Black-Jack. The program adheres to the same house rules as used in
the Las Vegas gambling casinos and is an exceptionally realistic version of
the game.

USERS
Persons who like to play cards, gamble, or just play games will enjoy JACK,
and if you've always dreamed of sitting in a casino in Vegas playing cards,
with this program only the setting will be different. The winnings obtained
with this program are very close to those obtained in the real casinos, ex-
cept you can't spend your winnings but then like wise you don't have to make
monthly payments to repay your losses.

INSTRUCTIONS
To play Jack simply type RUN after the program is loaded. The program will
ask if you would like instructions. A response of 11 011 will start the game
immediately, any other numeric response will cause a detailed listing of the
instructiohs to be printed. The program is instructional and will prompt for
all inputs.

LIMITATIONS
The source code requires 7K Bytes of memory for storage and BK for execution.

742
ii

··:::i=::. F'F:'Hff" :·+lflCiEF'.:THF f·ICl!.I'.::;;[ L HHT r·:: ~':'{:10, ·:::;c1 .T'f'F't Hi A HUMF:EP "
:=::=: F'PHff" FF'.OM C TO ':-!Oi?l. T:=i lEPMIHATF- f;F1ME> EtffEF ZEPO."

4;:::· F'FIHT" >THE DFf:L_;; T 11Ef"!L tiY::::ELF ;;:: cF1PD'.::: F1tm ·:::;~1rn. 1 You onE. THHI I"
4.:i PF.'.Hff" I!CAL '·:'CIU H!Ci CF!F'.D::::;, i'.:jt·m A:::;~: IF YOU ~o.IA!ff ;:::! HIT fF1t·10THEP"
46 F'F.'.Hff" CF!F.'.T!'!. 'i'CU : 11=0E ::::EUEPRL OPT Iott::; Dt:PEllDir·!C OM THE Cf!RDS"

"50 F'P I t·ff" ;.;:-: :::;THtffi -·· F:Y TYF'IhG A ZEF'.O"


i:;;::: PPIHT" ,,,, T1=:1r:T r1 H 1 r -· t:Y TYP rr-K:; Fi m-1E· 11
::i ri~ Fif:~ I t··!T B ;.:.~ en DCl!·li I n~IF.'. DOUBLE'.::; ·-· :D\' T\'F' Inc 1=1 THO ii

':';6 PF.' Hff II .;.: ·:'.;F'L 1 T r1 PR IF'. - B'r' TYP I 1··-ic; f1 THF.'Er"
•:; ::::: PP I rff
60 PPIMT 11 >Iti::::;1_1pAMCr: IF MY UF' CRPD I·::; At·i FK:E:~ I ;·.!ILL f1:::;K IF \'OU"
6c'. PF'H!T" l_,JAMT HY:::!JPFIMCE. IF '/OU DO T'r'PE A Ot··fE:. f:ETTH-iG Ot·IE-·HALF"
64 PF.'.Hff" OF \'OUP l·IFIC:i[F'. THAT I DO HF!U[ HLFICK.JACK. IF I DO, I F'Ff1' 11
t:.t. PF-'.Hff" .::'.-T0-·1 Ott \'OUP H6UPAtiC:E F:ET. \'OU Lo:::;E \'OUP OPIGHiAL ~·~AGEF.'. 11

6::::: PP Hff" ::::; I MCE I HHUE BLACK.JACK, SO ~·~E. APE. EUEH FOP THE HAMD. 11
?O PPHff 11 IF I l1orr T HAUE f:LACJ::.JACl:' \'OU LC1:::;E \'OUP Itt:::;IJPAtiC:[ BET"
7;:· PF.'.Hff" At·m THE CAME crn1rn1uE'.::. "
?4 PPHff
76 PPIMT" IF YOU f-"'.E:Ft1·::;E Ht:::;IJPAMCE CE:'r' T\'F'HlG Fl ZE:F'.0) THE cm·1[ 11
7:::: PPIMT" COlffil··llJE'.:; A:::; t·IOPMAL. II

::::;::· PPHff" >THE PLfi'l: 1.. 1HEJ·i You F-niALLY :::::rr1t··m ct:v r1'F'HiG A ZEF.:o:i 11
::::4 PPHff" I i·HLL. DF.'.l=i~·~ CAPD::::; UMTIL: II
::::6 F'F.:Hff" c?:I HFIUF AT LEF6T A HARD 17 0-IAPD MEAMS THE TOTFIL"
:::::::: PP IMP' IiOES t·IOT IMCLUDE At-i AC:E: BEH-IG COUtffED m:; 11) 11
9Ci PPHIT" :i;i:r H1=:11)[ 1=1 ~:;OFT 1::::: c:::OFT t·IEFJt1::; THE TOTAL IMCl.JJDE'.::; At·I"
·::1;:::· PF:'.Hff 11 1=1cE coutHE:ri 1=1::::: 11 ·,"
94 PPIMT" =<q 1:;:·EF1CH Fi TOTAL OF c'.1"
96 PPHff"
9::: PPIMT
l 1210 pp I MT II >I TEJ·t::;: II
j 02 F'PHff
11
:i;i:J F'FI\' i ·~;-To-1 on BLflCK.JF!Cf<""
0

1 Ci4 PP I t--!T 11 ;;;.: r rio1 i, T F'ECOCM I ZE s-cAF'.D::;-·mm-ut·mEF:'."


1r1.=:. PPHff" :.;.:\'OU MA\' IOUBLE Dm·~H OM A :::;PL_JT HFIHD"
10:::: PPHff" :i:i=\'OU DCtrPT LOSE or~ A TIE HAt-m ••• ~'~[PUSH"

743
I!

l L:· PF:'Hff"THE. f-.~lkl I·:. Tl-![ UEFiLEF.'. AMD GET':; !=i F:F:'EFW: AT 1945 HOl_IR:::;. !·IHF!T"
114 PPHff"TIME: I::; lT i·iOl•I";
116 LET ~<=O
1 l ;::; L.E:T ~:.i l =Ci
1 I 1··iPUT i·i
1,:::c.· FOF.'. I == i TCi ! !.···~:.·

t·iE>::T I
I~ Ir;1 I~ f
1~~ FOR A=1 TO 52
132 LET DCAJ = 0
l .3E: IJ I t1"~ C~ f 5~~)
138 FOR A=0 TO 39 STEP 13

1 ~i-4 t·iE.:=<T C:
l :~·E: t·iE::-::1· A
14a PP Hff
1::;0 LET l<=K+1
152 FOR P=1 TO ~
l ::i'~:t LET E f P) ==O
15E.
1 r.:-.=·
._fr_t LE.T T t:P) =~?i
160
1 i==.;=· LET 1.1f3) =1
164 PP I HT
j 1:.:,i::;, pp Hff "~·~fiCEF.' II ;

1 i::-;.;::: LET P"'-" 1.

i ?'C~ L~ET t,~ f E~) =~1 .i


174 IF W<=0 T~EN 582
IF W<=500 THEN 182
F'PHff "THFIP '.:; TOO MUCH - HOU'.:;E LIMIT E; :;:51210."
1 :::o GOTO 166
1 :::2 F F.'. I t·-fT
1

I!
1 :::4 PF? Hff " I ::;HOL·~
1 :::;::. GO:~)J:t: :::66
i ::;:a IF E ( l :i =O THEli
LET I):: 4) =1
1 .:::i:::-1
1 92 LET I) ( ::i) =1
194 GOSUB :::66
l 96 LET M=>=:
1 ·:;1;;:: LET P=;::'.
;::c10 F'PIMT 'TIF:'.'.::;T CflRD E;",

744
i:'.~~14. L.E~T (~=::-::

C:'. l 4 IF !.JC?:)<> 1 THEJI ::::6;'.:'.


;:::16 IF T(F')< l THEl! ;:::30
~:::· 1 ::: PP 1 r·ff ":.:i:~:i:i:t:u=1cK._ 1F1cJ::;.;i::i:i::i:~"
c::c::0 PPHff "M\' HOLE CFiPD ~·jA'.::; "

226 LET W1=W1+1.5~W

230 IF UC4J=0 THEN 250


C:::;:2 PPit·ff 11
11"-!'.:::UF.'.F!t°K:E f"ltf/Or·E (T'r'PE 1 OP €1) "!I
;::34 HiPUT I
236 IF 1=0 THEN 250
238 IF TCil<>21 THEN 246
i?4Ci LET L·H =i·H +~·J
;::: 4;:: PR r NT "YOU ~·l I t-1 :~:" ; ~· 1; 11
ot--i \'OUP I r·~SUPflNCE BET" ;
;:A4 GOTO 250
246 LET W1=Wi-W/2
i::'.'.48PF.'.Hff"YOU Lo::::T $"; l.•.!/i.:'.;" 0t·1 n1:::UF.'.At'K:E I:ET - I nonT Hf'il..JE BLKJAK"
250 IF TC1J<>21 THEN 262
;:~':i2 PPIMT HAl.JE BLF!CJ::.JACK*-9:"
11
:<i::<i:J
E:54 PFUMT, "M\' HOLE cnF.:D r:::: "
C:'.5E. LET :=<=t·i
i:::.i:::: c~ce::;tJ~B 4:34
C'.E.€1 1:;;c1TC1 5:34
262 IF TCPl<=21 THEM 278
264 IF ECPJ>0 THEM 274
;.::66 PRIMT "'r'OU BU'.::TED~ II;
c'6::: PRHff "YOUP TOTf!L I'.:: ";Ti:F')
IF UC2J=1 THEN 328
.-, -:i--i
C.. i C GOTO 494
C:74 LET E f P ) =E ff' ) - i
C'.?E, LET TCP)=TCPJ-10
·:1?r=• IF !..H 1:1 =2 Tl-iD"i C::6:::
1.N.1 •-t

c~:::t1 LE:T I) ( :::: ) =i) ( :::: ) + 1


·-11'..1·-·
c..1=1c_ PF-'.IMT "HIT";
c::::4 INPUT I.) Ci)
IF UC1l<>3 THEN 350
IF UC2J)0 THEN 346
290 IF UC3l<>2 THEN 346
2·32 IF QCGJ=Q(S) THEN 298
2'3.:.t PF-'. I t·ff 11 Nrn·J I'.:; THAT A PA 1P "
2';.tE,
C'.'3::: LET I) CC:~J =i
300 IF QCGJ<>1 THEN 304
:;:(12 LET U C1 ) =;::'.
304 LET P==3

745
r::-1; r :: i!
r r: . l !1 r
~~::t~i:::! FF.: I t"·rr
1
H F-1 Ft'.:;1 c~ r-:1F.:r1 J::; £! ,

:: 1 C L.ET ~,~ C3) ::::i i

,~;:: l4 C~()::;Ll~B ::: 1 ~:.!


-~: l f; C~C1TCi ~=~~]E,
·:.: 1 ;:: C~Ci~::;IJE! .:1-14·
:~::·;:.~Ci C~CJ:=~lJf:; 4,.,34.
.~::;:~2 LET t) f: :·::) =1

LET iJ 1.2) =,::

340 IF Q(Gl=1 THEN 344


·:.:,:};:
1
~~ET i... i (i "l =~7'1
:344 !=~C1TC1 ;:'lit:.

:;::~50 IF II ( 1l < THD-1 ::=:6(i


352 IF UC3l=2 THEN 358
:::::54 PRINT "TOO L.F!TE TO DO!Jt:L[, CHFIPLJ[. II

:~::5E= 1~C1TC1 ;::;=;;~


358 LET W(F'l=2*WCPl
360 IF UC1l>0 TH[N 206

364 F.'.EM DEflL


368 LET TCPl=TCPl+C
IF !) ( 5) =0 THEt·I
~·,-.,,.

-.:: 1 t' C•
::.:"?2 LET t) ( 5 J =[i

37S PETUF.'r·l
380 LET N=10 ~C1+ABSCCOSCN+W1JJJ
3:::2 FOF.'. A= 1 TO I l
384 LET X=I~ITC52.9999999•RNDCYlJ
386 IF X=0 THEN 384
390 IF DCXl=0 THEN 410

394 IF R<50 THEN 380


396 FOR A=1 TO 52
398 IF D fA l =~=: THEJ·I 40;:·
4~:10 LET D( A:I ==O
.:.l ~~1;.::: t·iE:=-::1·· F1
4 134 LET f'.=[i
406 PF.'.Ir-rr i! I F.'.[::;HUFFLED"

746
,:l 1a ;:: CjCtT"Ct ,::~::(i
411'.'..i LET P=O
4 1. E'. LET D ( >:'.) =+.
414 IF QCXJ~>1 lHFN ~?2
4 1 6 LET C== 11
418 LET ECPJ=ECPJ+1
·~ 20 F.:ETUF.'.t~
4;:::2IF C! C:<J >11?1 Ti-!EJI 4E'.:::

4::;::z~ PEM PRHlT C1=-1F:D


4 34 GO::;!JB 440

440 IF QCXJ<>l THEN 446


442 PPHff " i4CE II;
444 PETUPN
446 IF QCXJ>10 THEN 452

452 IF QCXJ>11 THEN 458


4 '54 pp I MT II _lf!CK II ;

4'.:'.i6 F.ETUF.'.t"i
458 IF QCXl>12 THEN 464
46(i PPIMT ii C!UE:EJ1 I I ;
46i:'. F.'.ETUPn
464 PPHff II K H1C II:.
,:l f..E. F.~ETt.IF~t"i
46e F.:F:M PR Hff ::;u IT
470 IF X>39 THEN 480
472 IF X>26 THE~ 484
4. 7 4 IF >=: >1:;: Tf-IEt"~ I~,::::::
4?6 PRHff "OF ::;PADE::;"
4 78 F.:ETUF.:H
.:.H::(i PPHff "OF CLUB::;"

4:=:.:1. PF: Hff "OF HEf:Pr:;"


i::1. ::~E= F.~ETtJF.~t·i
4:;::::: PF'.Hff "OF. Dffll'IOt·m::;;"
490 RETUF..'.t"i
492 REM DEALER PLAYS
494 LET P=c'.
496 PF.:Hff "M"t' HOLE C:AFffl I":; II

4'j::;: LET ><=M


':'iO(i GO:::;UB 4::::4
502 IF TC2l<22 THEN 508
':'i(i4 IF 1.f (2) =(i THE:n "':i::;::4
506 IF TC3l>21 THE~ 534
SOB LET P=1

747
~::: i ~i IF T ( ) <' ? 1
T~-lE"f··f 54.;:;
512 IF Tf J> 7 THEN 516
~ilt::, IF T f i Ti-IE:t,,i ;::;~54
~:; 1 :~; LE:T P=i:'.
:::i~:~~i F'F.~It·iT Hr:'f-( rci-rt=1L" r::; n~l'"(1)
IF' T ( F 1
) >C~ 1. 'TH Eli 5:;:4.
524 IF T(l) 1 THEN 530
526 IF T(1J)T(P) THEN 534
528 IF Tfll=T(PJ THEN 536
530 LET Wl=Wl+Wf Pl
::; ~:.:c~ C~fJTCi s::~r::.
~:; . :::4 LET t'-! 1 =~'H -+Hp I
~:;:::.;E. IF. t) C~?.~1 >!~i T~·IE~l""t '.::.;,::·~~:::
'.5 :~::::; 5E.t:1
i~c~~::~L1F:
;:; 4~~i C~t]TCi 15(1
~;::.i;=: L. E:T F =·3
1

':i44 u:::T !.J(2l=O


~5 1 ~"EI C:!CiTCI 5~~2
~::;4;;:: PF.'.Hff II I DPi:l~·I "
~:; 5te c;c1~:;fJE! .~!E:E1
~;5;:~ t:iC1TC1 ~i(t~::
554 IF ECi)= 0 THEN 562
556 LET EC1J = EC1l -1
558 LET TC1l=TClJ-10
~t1:1Ci t:;C1TC1 5(i:::
':i i:.2 Pl? I MT I! I Btl::;T[D:<i::<i::i:i: II ;

::;i:_:,4 t~C1TC1 51.~::


::::;i::.6 IF ~·H<0 THDI ;:i?4
::'i 6::: IF H1 =~.::; THD I ':i?:::
~:'i70 F'PHff"YO!Y PE FIH[FID ;$:"; L,H
'::i?::: PETUPti
::;;74 PPHff "YOIY PF: BD-!HUI :~~" ;-1,H
'5?6 RETUPM

':i::;:(1 RETUF.'.t·~
:;;::2 EMD

748
>!·.lf!Ci[R: TH[ HUU:::;r Lt MJ T L:; ::;::500' :::;o TYPF. HI n t IUMf:ER
FROM 0 TO ~00. TO lERMINATE GAME, ENTER ~ERO.
>TH[ D[FIU I DE1=1L. MY::;[LF ~:'. CF!RI6 At·ffi ::;HO~·J \'OU Ot IE" THEJ I 1
DEAL YCU TWO CARDS, AND ASK IF YOU WANT A HIT (ANOTHER
CF1Frn:1. \'OU HAl..1[ ·;::;[U[RFIL OPTIOtt:; DE:PElfftH-IG on THF CARJ:i::;
\'OU HOLD rn·m M\' UF' CFIPD:
;.;.: ::;TAtm .... f:\' T\'P I HG A :?ERO
~ TAKE A HIT - BY TYPING A ONE
:;;;: GO DCAJN FOP DOUI:LF.5 -· B\' T'/F' H-!G A Tl·lf't
:; ;: SPLIT A PAIR - BY TYPING A THREE
:::· H{:;URAt1CE: IF t·I\' tJF' C:APD IS AN !=iCE:, I l•I J LL 1=1:::;K IF ';'OU
l·JfiMT I rt=;l.JRANCE. Ir YOU DO TVPE fl ot I[' t:ETT I t·IG om-:--HALF
OF '(OUR WAGER THAT I no
HAUE BLACKJACK. IF J no,
I PAV
~:·-T0-1 Ot1 \'OUR Itt:=;URAt1CE BET. YOU LO::;E YOUF'. ORIGit·1flL ~·JfiGER
::; INCE I HFIUE BL..F!Cl'..JACK, :::;o l·JE APE E:UD'·I FOR THE HAND.
IF I DOW T HFll.JE 'E:LFICK.JFiCl:, '/OU LOSE \'OUR nt:;uF.:At1CE F:ET
AND THE GF~E CONTINUES.

IF '/OU PE FUSE n1::;UPAt-IC:E f BY TYP HiCi fl :?:ER ft) THE: CAME


CONTINUES AS NORMFIL.
>THE PL ff(: L·~HD I '/OU F Hi FILL 'r' '.:;Tfltm ff:\' T'r'F' H1G A ZEF'O)
I HI LL DPA~·J CfiPD'.:; Utff IL:
:.;.:r HAU[ AT L[f6T A HAPD 17 (HAF'II MErn1:::; TH[ TOTAL
DOE::; t10T I t·iCLUD[ AH ACE I:E I NG COUt'ffED Fi:::; 11 )
'*'IHAUE A '.:;OFT j :::: i: ::;OFT MEAt·t:; THE TOT1=1L INCLUDES Ati
f!CE COUNTED A'.~; 11 )
~I PEACH A TOTAL OF 21
~I EXCEED 21 AND BUST
>ITEMS:
~I PAY 1.5-T0-1 ON BLACKJACK
~I DC~~T RECOGNIZE 5-CARDS-AND-UNDEP
*-"!'OU MA"f' DOUBLE: Dm·JM OM A SPLIT HAND
:;;.:\'OU DOM~ T L.O:::;[ Ot--1 Fl TIE HAND ••. L·IE PU:::;H

<<<CiOCtD LUCI<>>>

749
LIFE:
DESCRIPTION
This program is a very detailed version of the game of 11 Life 11 as written
up in the October 1970 issue of Scientific American. It has been modified
to allow one to play either against the computer or against another player.
The object of the game is to destroy your opponents life units while saving
at least some of your life units. This is more then just a game as it
actually follows patterns found in real life environments.

USERS
Game enthusiasts of all types will find something of interest in this game.
11
Life 11 will be of special interest to individuals involved with population
projections, economic growth situations, and the problems related to over
and under developed areas.

INSTRUCTIONS
The program is self prompting and should be listed for a full set of instruc-
tions before playing your initial game. Program instructions are available
when the program is initiated.

LIMITATIONS
The source code for this simulation requires 13K Bytes of memory for storage
and 21K for execution, this does not include the amount of memory required
for storage of your Basic compiler. This program uses two dimensional arrays;
see line 106. Line 108 has a MAT A= ZER and 110 has a MAT B = ZER. Lines
104 and 122 contain Restore statements.

750
71~:' F:EY!
::: Ci l?F.:t:1
9!:'.I ~'.FJ·I
112!0 F.'.Ell
l 0 1 E=:E9=!J
F'ic'. PEM *:i:i::i:i::i:i: '.::;FT UF' r:::Of"IPD fltffl HOME r'lCiI 1Y1·::; :.;.;;.:;::.;.::.;.:
1 ;~:14 RESTOPE:
11216 DIM Af13, ) ,:t;113,
1 1~j Mf!T I: = ZEP
112 FOR J = 4 TO 2 STEP -l
114 FOP I = 2 TO l2
116 READ ACI,JJ
1 1 ;:;;; 1iD<T T

1. ;~'.C~ F.~E!:;TC1F.:E:
124 FOR J = ~3 TO 31
126 FOR I = 12 TD 2 ST(P -i

1 ::;:: ME::·::T ..J


134 IlfiTA1, 1,o,l1,1:;'!, 1, 1,121, 1, 1,(J, 1,c-1, 1,~~i, i,i~:i, 1,i;::1, j,(i, 1,1~--i, 1, j,(1, 1, i,0,121,1~1, j, i
l :3fi IIFtTFJ 1, 1E !I l , E'.(1, i ' ;:'..i::L, 2' i Ez, i ' 1 =.1, 1 , 21 ' :L , ;:~::.:, 1 , ~=t~;, ·3 :r 1Er!! :~:, ;:~[J, ::~:' ;:~z::t-, 4, 1E,
1
1

1. ·.::::: TIATA 5' 1E·, 5' c:121, ::i' i~ &:-l, E.' i I~' E,' E~ 1 ' f,, ;::l ·3, l:~.:, ~=:5, 7' C~li, 7' c: I~' 13, C:(j, r:=t' C:4, 1 ~~I' 1 '3
1

140 DATA 10,21,10,23,10,25,11,20,11,24


142 PEM THAT i·~F1::::; THE F. I F.'.::::T MACH I ME PATTFF:'t"·I

146 DATA 1,21,2,20,4,20,4,25,5,20,5,21,5,24,5,25,7,20,7,21,7,24,7,25


14:::: DATA 8,20,9,25,10,20,11,20,11,21
1 :=;~:-; PEM THAT L·.iAS THE: ::;;[COMD MACH I HE: Pf!TTEPt~
152 DATA 1,16,11,16,5,17,5,i8,6,18,6,19,7,18,1,23, 1,24,2,22,2,25,3,21
154 DATA 3,23,:::;:,25,4,21,4,24,5,22,5,23,7,22,7,23,8,21,9,24,9,21,9,23
1 ::;:::.
1 i::·,-.
',...!
~:~!?EM THAT L·.IF!S THE TH I F:D MACH I ME PF!TTEF't"i
l 6(i F.'.EM
1 ('(1 ~'.EM
F.:EM
19121 F.'.EM
;:'.0(1 PF.'.IMT
c:: 1t1 PP It-ff
E'.2~::1 PF.'.It·ff
c~~:::~•
PF.:IMT
E'.40 PF' I MT
;:::50 PPit·ff

751
F>~~ I r"iT ii
F;~:If·fT

L I FE, T :::: E:FJ::::E.~[J Dt ! THE CiRl"lE L. I FE c I!

440 PPH!Tn UNIT rs n·mrcRTED RS R ZEF!:J ot-.i THE F'F:Hn'ED c1Rl"'lE E=DRF:D. On THE l:oRr:;:r.::i''
4':'10 PPHiT" ERC:H LrFE-Ut!IT r.=:: suF:F:DLJNDED E=Y Fl rr1R><IF1u111 L!F EIGHT r·!EIGHE:oi:;:::::. (fiL.L"
11
460 F'F.'.If'iT" FLJRCEtiT LiHIT:::: RFE COL!MTED, H!L.L.UDIMC:i DIRGOt·.JRL NEIGHE:DES)
470 PF'.IMT
4.f;CJ PF'.I hT" THE: C:iFlflE:':: F1F:DCEED:::: FF:DFI Dt.JE GE.t·ff~EF'lT r Dr·! Tl:J RNDTHEF:. THE: L. r F'E- Ut1rr,:: 11
4'30 F'F:'.H·iT" THEl"lSE'L'·.'ES Dl:J MDT P101•..IE; THE'Y WILL EITHEE LI'-..IE OF: DIE. lHE: CUF>:F:E:t·.JT"
•:=; 00 PF'. I r!T" POPULF!T I Cit·! DF' RN RF<:ER WI LL DETEF:f"l J t·.JE THE F'OPLJLRT I OM OF THE THE r·.JE::<T"
i::;l!Zl PF'.I!'rf"' GE~ME:Fi:Fn'IDr·.I. E>:ISTH!G LIFE-Ut·HT:::: f'!RL; 1 DI!::::, OF: NEW ONES r!RY E:E: E:OF:t·.J F·i"
~:;;:::·~] F'F'It°'!T" EP1PTY ::::PFIC:ES, F1CCOF:DING TO THF FDLLOL.IHIG F:ULES:"
~:;::::o PPHff
~=~; ::.lti F=F.~ I t·rr fl I!Efi1li i:! LTFE-"UtHT kiIL.L DIE IF IT HF!S LESS THRN T!i.10 t·lE~IGHE:or:;;s • • • II

! FFrJf'1 I SOL.RT I ON) ; OF f'l[lf::E: THRt·~ TH!'i:EE NE I GHE:CJF:S ••• (FF.Cl Pl


11
"'' i:;o PF'. I hT"
Li'.'EF:CF-:Dli.IOit·~G)."
::i "?ft F'F.~ I t··~T
::;~:::CJ F!F.~It·iT 1 l L.IFE. -· H l. I Ft:::-Ut-i IT WI LL. L I 1...'E' l F IT HRS TWO OF.: THF:EE t·.!E I GHE:[JF:S.
11

:1 :)ti F·F.~ I t·iT


1

.::;.O(i PPH·lT" HIPTH ·- H ~IEU LIFE-t.itHT !.;JILL E:E i:,::QF-:f'.l If'~ F-it·.J Ef'1PTY ::::PFICE Ti-H::::F-:E: FiF-:E"
6i0 PF'.Hff" F'.:::fKTL \' THF'.EE. r~EIGHE:f.1F:H~G LrFE:-UNITS. 11
t:, !~ t1 F'F.' I r··f T
i:::, ::::1:1 F't? I t··iT IE E:=<F!t'1F'L. E:~:; ~ ll
t:, s:.1 [1 F=F.: I t·iT
f:, sia F=F.: I r·.,IT 11

~~I r_::,~:1 F ~~
1
I r-1r
1~:1 '((i F=F.~ I ~···1T II THE FiE:u•. .IE LIFE·~Ut·.!IT:::: UJL.L E:UTH DIE E:ECRLJ:::=E ERCH HR:::: CJt·.IL.Y
11

i::, ::: ~~1 F'F.~ I r~1r Ii c.1r iE r·IE. r c:;Hi;:::oF:.


11

6'30 PF'.Hff
?(:!(! pp Hff II

? i ~1 F'!?It'!T"
'? ;:= ~i FtF~ I t·rr JI
'? ·3~] F:F.: I t··fT
~·PHff
11
?'40 T1,.HJ DF Tl-IE: RE:rJ'...'E L I FE~--IJt·I IT::: Lt! T LL DIE FEDl'l 0 EHCF<:o1.i.1D r NG.
1•.. 1 TLiJD t·.1E:1.t1"
L.I F'E'"-l.lr·.~T-r:::: f.tlIL.L. r==E E:Ob:t·~" n

752
F:F t·iT. 11
1

rir1 r.JTlf .-:1H


{"' r: ! ! i 'i

::~ Ci~.:.i F f? t··\1" JI


1

r·ff" THI::· rs STFJf:::LE:, E.FIC:H L IFE-·UttIT HRS Tu.to t-.iEIGHE::CtF:::::--sc:i IT"


F'FtTTE::i:;:t·.i
MT" LI 1-H~::::: --·- F!ND t-10 ::.::PACE HA:::: t::<FlCTLY THj:;:EE t-IEIGHE:[]F::=.:--:;::o t.ICI NE:w"
t·ff" LIF·;::::-1 lt·HT"::: RF:E f":OF:N."
!::: ~;i~t F·F.~ t·iT
:::: t=:.J~1 F·F:~ t"i T "
MT
t-IT"
i::: ·::1i~1 t"·iT 11
F~F· ->
::1(10 ~·f.~ t··!T 11
1

::; j 0 PF.' r·ff


11
[if:JTIL:E: THFlT THE' Ti...ID Ut"HT'::: OH THE" E"MD OF THE E:LH--11-:'EFi.: CtIE' RMD THRT

11
THE Cit-IE H4 TH!: C:ENTEFi: LI'..-'E:S EEL.RUSE IT HAD TU.ID t·.lEIGHE:[JFi:S. fLtJrJ MEW

·:;:140 PPHff 11 L.1 F"E.:-l_it"H T::: UEF':E E:O!"N NE:>::T Tn THE: CEt-.iTEFi: E:ECRUSE THE"r1 HRD THF;:EE
11

9'50 PRIMT" t·.tE.: I Gl-tE:oi:;:::::. "


960 PF.:Hff
970 PPit·ff 11
·::1 :::ti PF.: J MT
99ti PRINT"
l 0~30 PP Hff" (i ~:} i~i I!

1 ~i1[i PPIMT" (1 Ci !.~i (i c~IJ

1 ~x:'.(! PR r MT" ~:-:1 ~~i 11

1 iJ30 PPit·ff
1 (:14~:1 FR I MT II
1 (i5(1 Pl? I MT
1060 PPHff
l ~~1 ?t1 F·F.~ I t·~T" SctrtE: PRTTEF:t·45 f"'.EPF:DDLICE THFr1::::1:.L 1._.tES RMD , Mo•.,.rE:, RCFi:O:::::::: THE E:DRF:D: I!

1 cc:::o pp I MT II THIS r.::tt·~E I·::: CRL.LE:D R GL.IDEF~;: r;

1 09ti PRAMT
1 1 \'.'.°iC"i pp I t·ff II
,-
= =H
'
1 111 PP I t·rr " -> 12J -· :·: -· -- (i
1 1 ,'.:'.(; F'P I MT II 2i i-~1 -· ~I - ia Ci
l 1 :3121 F F.~ I t.11· 1 11
Pi ~Zi (i ~:1 i~i
i 14Ci pp I t·ff II I!

i 1 ':iO PP I i"ff
1 i 6fi PF.:IMT
11 ?O PPHH" f'inT I Cl::: THAT THE CL I DEF: , Mo 1...1E::::, ONE S:O.LJAF-:E DOLIN AND Dt·-IE ::::auF~F:E I!
11 ::::0 PR I MT" TO THE.: F: I GHT E 1•..tEF.:Y FTJUFi: C:iE:t·~EF-:RT I ON:=:; JT I:.::.: :3R ID TO !110'.·'E RT ONE'.-
11

11 '30 PPHff 11 0.LIFlFi:TE:Fi: OF THE :=:o.LlAF:E.:-·i:;:ooT C:IF' T!.UD TI 111r::s THE: SPEED OF LIGHT. II

1 c'.(10 PP I MT
1 ~~'.1 ti PF.: I NT
1;:~;::'.0 PRHff" THE F'LA\': II

1 ;:::;:(1 PP I MT

753
- - w
-
z .J =. -ll't
II ::: • IL U:: II 1.1: z ~
U::zrr:a: .J 1-1 1.i.i D ;"1..1 1-'4
- = i:c:. z
1/i Li.I CJ _.I
iI J- H H W
I lI l:J E ~
11
iJ
1-
H
..::.
::
J:
I-· l::!
H
w
I
i- --1-J-
l/1 w Ii
i
1
= =•
=
Ci

::
.....,
-r
.J L.! H il, 1-- H lJ.J I- Ct:: H .J W H iJ: ::- i.iJ Lt: ..:..
!I :: z _j w
Ll:'.
ll.!
J-
ll.. LL: Iii il.
..1.. l.i.1 U::
>::
Ld
Li
-. i.i.i
I
Lt..
l·-4
_j

;J.:
• E
LL:
3
0
i--4 !I
t-Ii
=I
Li..
LL [! t--l
i-..J
f·· II
:J Cl
Ci U:;
I~
,.;:,
fI w ED IT: i- 0 D _J H W Ci::
_; [[ D C I Le. -r -"l'<-
..i:.. ..L LI:: :Z.l-l1J..Dr-1J-
z 0 w r.
;:l_ LJ..l I l/1 I-· i.!'1 D l.J Q 1--1 u_ 1-t i.J I w
IL .J I•<
w
l.i.. I.fl ..::i I_; ll iI I- t- :z:
I, " 1.11 !ti z .J Li.! 1- V1 U z 1-l
LJLUt-U3 H
,......1- _j G:: l/1 HH[,j~~w H i.i.. I
Jf:E2;HQ :::; I- w 1-..I:: I I I .J Li LI:: D (.)
1.ulIW_I..::.
z (.'.'.! ::.::
L!.i ,.., I/!
Lt: w
. i--
II
11
IJ Z
f·· Cl
I
I
• -, 3 I- 0
..:..
1--
Z E II
Cl .J
LI:: a..
i.L
a..
•:C
..::...
':!'"..
is, I fl t/1 W
1...1
w E ,. ., !1.a.. l.t. I-·
iJ Cl
HI.II
Z :I Cl l.i..
I/; Cl
i! I··
,,, u i1 li.! i:r: w
z w
J- II WD l/1 D a.. Lr.: D 3 w
L[i.JEa:
:·: w H
a: 1;:1 :r: H j- H !I z i-· w a..
_1 t"' !J:: l/1 iI 1- H [i J- D D I- I J-
I/; I-· I a.. w I-· .....
. ,.. .J ll :Z: w a: Ui H J- H 1- I--
<t-iL.. 1-1
..--1iJILJ1-1
LJ
w
~I
f··
l.ti
ii'I w
..!.• 11 E:
Lt.I
=1! LI:: E I.'.:!
lJ l.i.i !-"
i:r:
lf j 1,1'1 ...
E I :i:
li..
D :r :i- .J I- w w i:r: I LI:: rr: II Lt:
Oi-:Z:CJ3 I- .J c:1 II: I·- L1- E W I- 1- I Li.I
iL iL H ((i Ci I LI:: ..., a: H Cl~ laj _g 0 1-
rr.: II' l.t'1 '' LL: LJ 1- 1- _J ~.r:: iI Li.. I . ..::.. 1:i:: .. -. :::i
;
IJJ
q !--:- ~:! '~ Li
...,. 1- D = ,..., l.i'I H LJ:: .J DI-- __, D lI W ll.
LLl 1.l! ~.. u.I U:.
u:: .J I.ii
1.1: w l.J U:d··
.....
u:
:r:
w
111
f-·
~~
H
i/1
l.J
~
..:'.!
i,:i
u
Z Ci
l•--i
J- W LL
~-
tr'
I
r-· G::
l.J
C1 ....
1::1
l/j
H
J::

,....!
Ll
j~.L.!
"""'
.a:..
l•HI
I
a
LJ
J::l-[[i-
. I- I-· ;-, ['
L! -' ....•...!, z i- iii w H l--i [f~! I- wu
i] ·-' D 1!'1 HI.fl I D a if!-:-~ ~ I !I Lil
QC iILL!i ]- u:. r·'1 :i l-i-U:: D f- E :r:
i-- il. iI .J !J.!
--:
....! i.:1 E
.J.. ..:..
w LI.! l/1 ii 1-l
ul
::i:: t- !±l
=- l,i! I [. u.. w
0 ;;::
i.i.! LJ !.t•
..:..
r:'.i 1....
i-'l
:"'
!.Li
I
!.l.!
Ct:. Z ::i Li..
P:Sl:•~-
1"" Ci a:. I .:·- w
!-::i r·I
·-1 '
Le.
D I I-· a: ""'r--
U)
} IL _i Ii'! E ..,.. !-" !I n H .J LI:: I- l/i
...,. :z::
!I
~
Li.i
1...
=~
ffiH
~ ~
H Ll.!
I
r··
l·-
0:
..!..
Li
,... 1
li..
[]

l.W .J
E !J..
c:
I- -
iJ.I
!,i';
D',
w
11. I-· i1 ..,.
:J H
0 :r
c ni:: Ew l/1
a
E
D W
;.... Li'.!
..:..
H I/!
IT: rr.
~ W LJ E Lei
..! ..
.J.. :I l/1 ~!
1.;
lJJ
,-
....1
'I
t-i -:•""I" Cl ['1 f... I:.! Cl
:::i Iii f.I: 1J: er: " j
"' t::
HOWl-0
LI r I-
II' i:'.:1 'IJJ
f1':
n:
ci·:
.J
1::1
"'I'
_t ..
1-•I
rr: ::i::
I-· ..:..
VI l.i.i
::I Li..
--
....l hi Li.I II
~t 1::1 I-·
µ:! I: .
[[' -::1
~=:
Ci 1-1
- :? .. 1-. }·
a::J" U::
l.1:! i.!:I
I- a: L! •..I ~! 1..(1 i.l1 U". E W ..!" H u:. 1-.. _..... I. _j LJ H
iJ.: C1 1-< LL iii w i.[ LI:: ;'.j IJ: D iI I··· .J IE .J i.i.i
LJT:l-·i.t.u.I ...J- :::i :r l:!:I_.. IL E i.11 L.. 11 E !I 1.... 11. }·
,•.,.
::::1 I..·~
:::::I
1.t
. .::
~
, ... Ci D
•i: :ji'" r1··
l.i .. J-
::::! ....I ,_ ...
Cc:. l!:: ld
Li.I Li.
J- C:i LI::
H Ci
11 .. J LI::
LI::
C.i
H
1- l.f1 I
Cl
·- u~..
1_! .:-'
......i}·l-0 ... ,. 1.'.:i u:: [[ i.i.I :1 II ld l/1 ::i II' Li.. Li.. ,.,.. H
...,. rr:I._.,.
::::i I-"
!l! l/l ~ i.i.; J- 0 J- H
!.w I Ll:~
U.i
"'-
i·~-> 1- ,l.iJ..., I·" iSi
..UJ,.. rr. :r.:
_j }·
W... I r.- "1-
H
u.. ..L I- !- Ii! 0
LL
li.'
.i:••
..... I- ii'
i.:.: :J L! i··.. LI !I ;rr-· 1::;:~ r~ [L w u:: w rJ -r !'""'I
(~ '"'-
.I-· ....! tt'. H t-t Li.I •'- 1....1
'....I le: ,_
1:i: M"
l.L c:i l..L.. !.Li I 0 If! Z :'., n:: 0 :: ~j rr Li..
LI- :!- i::J c.: ~) [1 ::! Lu t: Li tt1 i-i i/! Lt i:r: c::i i- :~:i
r- ~ ~J ;J) l:.. iL
.
H p:: Cl I :z: J.. H w i.i'! [[ :J
w:: i.I.! u:: _..
.J· , [J ·-' .L [[ ~
'r·· t!.! ..J Ll LL O if1 :r: i/1 H D u:: LI:: :J Ci
J- [j i,!i ::;:: Ll..! Lr.: !::.! - ~.:.I:: i.l.• i-1 lLWi!;'.~1--~ :t: ~:1~1 Ll lLl 0 :r·
.1::... :.i. !.d !-·-- i-··
I-··! . [
i...,
iI . ( :k: j~~.:. l.J
u::
!_!.: \.J
E.
iii
:J 11
.J.. '-"·' I- W .1..
I- u:: !.J.j
LL
w
(S)
(;;'~!
J- ]-
II II

::i::
~:: t::
!J.J
_; ...,.
,:~~~ :'.,.f:: :~:;:1
E GJ iI I [[ _j i.t. ::::.: l,!'1 I l~'.;:1 _i .J i.t. i/j
[ h!
.J..
I-· 11 ...;
::1:: iii I-·· [[ [\.. 1:1: Un H
.i...
l•-1 f·"" If)
.,.. _,
•r·•-1
LI... CL. "'"'' i.[
Ii
... - -
i..- I·- !-· .. i···· !--
- ·- :::
1--.. ~·· l-... I··-· i-·- 1-... f.-- 1:.::1 i I 1--.. 1-·· ~... 1-·.. ~- ~-­ 1-- !-·- I- 1-... i..... 1-- 1-- 1-- i--
- - - -
............
- - - - - -
1-.. I-·- 1-.. 1-.. c,:1 I··-· l".,J 1-- I-·· I-·· 1-.... 1-- 1...... I-·- I-·· !--
!:::~
:;~::: ~:: :::~::: :;::.: ~~:::: __ _
.~:
"~I'"
,..... :;-~::: :;:::: :;~:~ :;:~::· :;:~·: :~:::· ~;::i i:::::; :z:: ~i::::· :~~:· :;:...: ~:~·:· ~:.:: ~~: :;:::: :z::: :;:'.~: :~: :;:~:: z~: z: :;-:!:: :;:;~: z:: z:: z:: :;:;1 :;;::: .r- z: z:: :z.:: ~~:: ~~:: :;!~:: :z::: ~;::: :;:~
1-.. 1 1--1 1-.. 1 Jo...., I·"-! !-·•-! \ i... --1 l•....I 1..... 1 I·-·! 1-..1 1--··4 1' (°\ !·....\ t-....l 1..-1 ........1 J.•"4 l-·-1 --1-lHHl-ll-l-l-l 1-1 l-MI ,.. ,.., lo·-! I.I ,I J-1 f-4
l-..J. .-..; !-"•+I J.--; !-..•-\ f-•-1 \-•! (•,.>+!
Ct:. 1:t:: et:: i:J::. 0.: 1J;~ Ct:. Oc. tL Ct. U:. 0::. {:;1 lJ.. 1:t:: 1:t:. Cle. Oc: Ct~ LI::: i::t::i::t::i::t::i::t::i::t::i::t::i::t::i::t::i::t:: 1:t:: LI:'. Ci::: Ct: Ct Ct:: W C.i::: Cl::: LI::: et:: Ct:: l~t: CJ::: Cl::: Ci:::
CL. Ci... 1:L 0.. 1:1... Ci.. 11.. Ci... Ci... CL.. CL LL l'...~:i 1-..1 LL Ci... Cl.. CL 1:L •i.. 0..LLLL0..LL0..LL~~ LL. LL L1. 0... CJ 0... _j 11- LL ~ LL 0... LL LL LL LL
t'~:;:i i:~:. 1~:~. (S:1 ;~~·; (~;:i 1~:;:1 (~:~1 1~:~1 QQ~QQQQQQ !~~I ('.;:1 (!;) 1'.::~1 i:S) 1S) 1~;'.1 (~~1 QQQQQQQQQQQQQQQQ
i"·- i:o er-. .,...... 1:S:i .,._, (lj
·:~r 1••L:1
i""tJ (i..i 1"\J OJ (\.1 , .. ~" 1 :~:::: ;~:::; ~~::: -rum~m~~oo~
~~~~~~~~~ 1J':1 IJ~1 if"1
"::I" If'• •.,[.i
If) Ln i.f"< tri !f)
f"- ((1 ~o-ruoo~m~~oo~0-ru0-
m~~~~~~~~~~~~~ 00
·:-·i ·:--1 -:-·..:i -r-·: ~ ·i-l .,.....-;: .,-i ....-! ·r .,......., .,....-; ~ -r-t .,......., -r-1 ·i--i ·:-1 "r'_, •t-l T"""'I .,....-!.
--------------~~
':""-i- ~ ·i-·! T'-i -:--·1 "t·-i ~
C:'.020 F'~'.HiT" \~~!RT I:? F'LFi'T1E.F:. 0ME's t·iRf'IE ";
~:? i~J::3t:.:.1 I r-1F·trr f~:;:
i?-'Ci40 CiO'.:;IJB 140(10
;~::Ci 5(1 PP I NT
i:'060 PPIMT" ~·-IHRT r:::: PLAYEFi: T1i10'·:: r·IF-iriE: 11
;

;: C17f?i I t'iF'LIT "E:$


1

;::o::::t1 c;o~:;u:t: i 4~:100


i:'. o·:.i~=; PP I MT
2100 IF Z = 1 THEN 2170
E'. 1 1:21 PP I MT
i:.'120 P~'.Hff"
11
THE :f:oFJr:D HHTIRL.LY LOOJ<S J_Il-::F THIS:
C'. 1 ~3Ci F'F~ I t·iT
;::~ 14~3 i::;Ci~:;trB 1~i~~1t1~)
;::~ 1 5121 F'F.~ I t·i T
;:: 160 PP I tff
;::: i 7(i pp H-!T I! fiTTENT I CIM II ; r=1::;::;
;:'. l 75 F = 1 1

c'.1 :::o IF T::::121 THF.J l c'.C' l (I


t~'.l9f1 F'F.'.Ir-iT" i INPUT 'iJCJUF: CDDFi:Dii'~ATES R:3 E::EFDFi:E."

;:'.i.::'.10 PPIMT" ~ Your~:


11
Pt-ER:::E 1::;n.1E f'lE INITIAL.. Pl=tTTEFi:N GF LIFE-·Ut-nTs.
c::c:~2~:1 PF.'.Hff" Ir·~ i:1i=mEr=;: To PL.Rc:E R LrFE-Ut..irT FIT PcirNT A, i:cRPTEsIRN cooi=;:eirNRTEsJ" r:
;::;:;'.:30 F'F.'.ltiT" TYPE: THE '·..'ALLIES IN SEPRFi:RTED E:Y R CDl'lf'lA. It~ OTHEf:: liJDFi:DS --· T 1..-'PE THE"

c'.c'.4\21 PRHff" ;,:: [TJC.lF:DINF-lTE' A. FoLLDli.I IT 1,JITH Fl r.:::r.JF-IMA. THEN TYPE THE: y CDDt=::-·"
c'.25li PPH·ff 11 ein.ir-1TE:, B; FDLL[JWED E=Y R c.RFi:HrFIJ::iE Fi:ETUHN. 11
c'.c:E.o PPIMT" ~·~HEM 1.r•[1u 1-1FJ•.)E FnnsHEei YrJuF: INITIAL PATTEF:N' TYPE IN ~~,, 0. 11
c'.c'.70 PPHff 11 AL.SCI, fiFTE'P YDUF': :?.OTH LIFE-UNIT IS POSITIOt··IED' I WILL RSSUfflE"
c'.2a0 F'F.'.IMT" THRT YDLI AF>:E FINI·SHED, Flt·~D I 1.i.IILL GD ON ••• 11
c'290 PPIMT
pp I MT II I
::=:::::(1(1 Flf'l t-.lOLi.I J;;:EF'IDY FDFi: INPUT OF YDUG: L. I FE-Ut-n T:::. EACH TI fTlE I TYPE Fl ' ·::·, II

~:'.:~: 1~:1 F·F.~I t·iT 1 t·~ ot·-IE PRIFi:


11 11
PLEASE 1·YPE or cr.1or=;:c• rt-4FITES.
0 0(12320 T = i
0 0f12~:30 F.:EM
(1(1(12::::4~3 ::.:: = i
0002350 INPUT M,N
0002360 IF P = 1 GOTO 2400
121t1f1C.'.:3'?f1 c = it.
~21(11.]2:::::::1-~1 1) = :::::(1
0(1(12:39(1 GO TO ;::'.420
00(1240(1 c = 4
0002410 D = 1 r.::... .;... ' }

0002420 IF M -- 0 THF.J·i 2500


00(12425 IF 1·1 < c THE:tl c'.45~3
(1(1(1243(1 IF M > D THE ti ;~A5(1
(1(102435 IF M > 1 i THEti 245(1

~~!00244~3 IF t~1 ·!._ 0 THE:t'i E'.450
000;::445 1...;u Ti".:! c'.4.?\::t
i?10(1i=:450 PPHff" ! ! 'r'OU CFitP T PUT fl L.IFE-·UtHT THEPE I I"
0002455 PPHff" You F1F.:E LIMITED To Y FPOM 11 ; c;" ro "; n; 11
AMII"

755
'. ~ F'C!M l T!~! 11 i II

:=1c1:nh. "

0002473 LET A(M+1,N+1J=1


~J121t124::~€i ><=:=<-t~ 1
(H~i!~i~~4 1 ?-[i IF :=< <" ::::
~:1t1i32~~t1~~i IF f:: = C: T!.. ~El··f 1::1:,?li
~J(i(i25i(i F:F~It"iT!i I!; fi:~:; I! I::; ~:;ET tIF= ~ u
1?1tH;:1c~52t1 F===c~
f1(i[i25~.3~] I~- I~~~: l! i'iHCH I MF" THD-·i c:s::::0
~?i12.1t1;=:54[i IF II i"lRC:H I 1.11::::" THG·! E.'.~'5B(i
CiCi~~i255fi F'F:~It··iT
1?1(i(i~=~~!t::fi F:F.:It·iTu f1rTEJ!l.,.IC1t·f u ~ f.;$;
0002570 GO TO 2180
1~::112! c12s:::~f1 r=1i:)== 1
i2!fif12s:::~s F. = F.t1r.1 r - i )
1

coo;.=::5'3ti GOSUB 1 :::ooo


1~:1t1(i;~fo:~2~t1 IF F~ < = THEJ1 2640
0002610 GOSUB 13000
00~7-12620 IF' F'. =· • t=.i:".,6 THDI c'.tA!J
e1 li~i2f:~::ti c~c·~=;iJF.~ J "::'.:i21t1c1
0002640 MAT A A+ B =
12i~10C~E=4~; F=F~If·iT
!~:a~iOc:6st1 PPHff" THF r·iRcHn~E. rs F:EADY 1"
0002660 GO TO 2680
('1002670 PRHff 11 E 1• 1EFYDt-!E IS ::::ET UP! !I
OOOC'.6:::0 PF.:Hf'f" THE. I;ATTL..E EEGHt::; ! II
~~~j ~~i~]2Er!=!5 FcF.'. I t··~1·
0 002690 PR Ifff II HE:F'E , ::; THE CfiMPLETE I::OF!Pil ~ II

12! (~ ~~iC: i::0J.~i F:F~ I r~ir


0002710 CiC6UB 15000
00(12720 PF:'.Irff
II
1~i(·H;::-1c-:'.730
PF.'.HiT" Hrn,1 r-u=n·~Lr' GENEF:RTIONs DC! '-i·'DLI !JJRMT
0i;::10E?4(i PPHff" E:EFoF:E PF:rNTrt-K:i THE E=DFiF:ei F1GRIM ";
000275(1 PEM
C:;Ct TCt t.:~·?:::1~1
[1(1€127t:iti
000277(1 PF'.Hff 11 l-irn_,1 f'1Rt-tY GENEF:P.TIDHS tirn... 1 11
9
HiF'UT E
1~:1ot:127:;::e
0002785 E9 E9 + E =
0002790 IF E = 0 THEN 3000
(10t:12eot1 PEM GENERATION CHANGE LOGIC
00(1281€1 FOP H = E. TO 1 '.:;TEP -1
0002815 MAT B = ZER
0002:::2(! FOP J ::: ::'. TO ::;:; i
ll [i ~~i2 ~=::~!~3
000;?::::4(i L.ET S=A(I-1,Jl+A(I-1,J+il+A(I,J+1J~ACI+1~J+1l
00(12850 L.E.T ::><~;+A I I +1; J) +fi (I +1, _1--1) +A f I, J--1) +A ( I-1 ~ ._l-1)
(~00287(i IF S =2 THEN 2920
~~ t1~]2~::=:=az1 IF S =3 THEN 2910
~~11210;::::::9(1 -A (I,_!)
000E."~Ot1

756
- -ilJ,J.!
~~:1i'JC1C~~'1-C~[1 t-iE"':::,r J
0002930 ~~XT J
0002940 ~AT Fl = A+B
000c'.9':iC1 tiC<T H
0802960 GOSUB 15000
r10i;::1;::970 GO TO ;:?? 1 ~;
(:10029::;:(1 F'.EM
1~'100;::991~1RF:M :<i::<i::¢: E:O:: J T OP ACiAI t·1 :<i::¢:'<i:
01~1(13fK10 PF'. I MT
0OCr:::o10 PP I MT
(1(103020 PP I l'ff
~K10::::~3;:0 PPHff" THArn=: ':'OU FOF.'. F'LA't'ING ,LlFT, ";!=i$:
0003040 IF M9 = 1 THEN 3060
~}~103(150 PF.'. Hff II \'OU TOO II; .E:$
0~?1(1:3(16(1 PRINT"

II

noc13c170 PF: Hff" 1. mu1_ri \'OU L. IKE TO ~:;TFiPT F1MrtTHEP CAME 11


;

0003080 GOSUB 19000


(1(1(1J(1'3(1 IF 0.. ::: l THE:t-~ 3150
(i 0(-13 1 (1(1 PF'. I MT II
"
00(1:;:104 PF.'. I nT
0Ott:::120 PF'. I MT
1~1Oft;:13(1 t.:TOP

00031 S~j GO TO 100


00130~:::1(1 REM
i~;1131:;:010 PEM :.;.::i:r::<i: ROUTit~E: TO :::ET UP MACHH·IF.:' '.:; LIFE-·UMIT~:; :<i::i:i::<i:
~?10 1:;:02i;::1 F.'.EM
0013030 MAT B =
ZER
0013040 FOR I =
1 TO 29
0013050 READ u,u
0013060 BCU+l,U+l) = 1
(10 13(17~3 f"iD::T I
fi01308r:t PETURt··I
0(113(19(1 F-::EM
0 0 1311210 l?ETUF.:t··I
0 ~3 140(1(1 F.:EM
121Oi4€11 ~3 PEM F.'.OUT I t·1E TO CHECK ' STF.'.14 I CHTt-~[::;;::;;' OF F!M I t-1PUT MAME
0 014(120 REM
001. 403~3 REM
0 (114(14(1 F£M
0 014050 f;'.EM
0 014•Zl60 REM
~?1014(17(1 F.:EM
0 0 14€180 F.:EM

757
(:1~~-:!140'3li ~~F-TiJh't··I
C11oi 15000 F'.EM
~·'.!~Ji ·:.o
10 F'.D·l:;;,::,;.;:.:i: HDFH?II pp nff n-11::; ~f!UT I f'i[ ~i:;.:i;'Q!
~:1~J 1':it(:'.O ~:E"J1
Ci Ci 15~2r~!(i I ~-fr
5040 PF: I !ff
!;'1 ::'I i

8015070 FOP J = ~1 10 2 STEP -1


~::1!)1 ::1f1:::~~1 IF J l·"IE: ·J l ·rl-iE~r i 15 l 1Ci
l~~l ~Ii ~!Cj·~t(i F:F.~ I r··11·· 11 :::IZt : 11
;

~at11s1 ~3f1 CO TC! i •5·;:00


CIO 1:::_:,11:;:1 IF J NE 26 THEN 15140
1::~01 '5120 F'F.; I l"ff 11 1:· :::5 ~ II ; 1

1;-,=101 ::! 1 "3i3


IF .J f' iE' c:~ 1 ·r\-iEt"i 15 i 7t~i
F:F: I J··rr :::'.!Zi ~ !I ;
fl

ij ~J 1.. ~: t ~.~:1 c~ci ·rcJ i, ::i·3!2JC-!


~:i~) 1s1 ·?~3 IF . J ~· lE" J. i::: l .. ~ i[J·f i ::~;:'.[i(i
~JCI 1.S 1 F>F~r1··rr I! 1 ~~ = ! I ;
~::1 Ci i ~~ 1 =.n~~
1

~:i~315~~i]~J
~~:i 121 i 521 (i F=F:'. I !"il" H i ~~!: l£;
(l (~ l :5 22~3 Cii] 'Ti] i '.:1.JC.:iCi
~~:1Cr1.. 5;~~3t1 IF' J l",JF~ ;:'., Tf-JE~t·J 1::;;:~1::fi
e11~11s2:4?3 F;F.;Jj"iT"li ~;~ H ~

1;.=i ~:1 i s;=:5Cj C~Ci . I. C1 1 r::;;~:~=i~~1


c:1(i 1s;~f:0 IF . .J r !E~ ~:::: ·rt-~Ef"i 15C~r3ti
C1~115;:::?C1 F:F~ I r··i T I! l : 11 ;
i?(:f 1 ~52;::0
i;::11~i 15;::~r;-:(i
~::1 (~ 1 :5:3ti~3 FC¥F.: J := C: 1"'1] 1 E~ 1

IF F! f I :i ._I ) == i "f~- 1Et··i 15-3::f[1


Ct Ci i ~;~32t1 F'F.' I 1··,iT u ·-" !1 ;
0015330 GO TO 15350
i 5:34.(1
ia~~i F'F I t··t"r 11 c1
1
li ;

0015350 NEXT I
!21CJ 15·31:.0 F~~· I t·i1" II :
11

12i IZi 15~~:7~:1 t·1E::·::T ,j


1~:1 !] i 5:3~:!t.3 FiF.~ I t·iT 11 : _. .. _. _ __. _ _ _ _ _ _ ~-----------·--·-·,·- ~ It

l 5

12: Ci 1':4E'.0 F-ETUF-'.M


1900(1 PEM :i;i::.;.::.:i::.:i: \'ES oi:;: no FETCH PmJTrr1E :i;i::i:i::i:i:*
i ·::1:;:=1ua IMPUT !~!:$:
l '3(12[1 IF C~$ - u /t~~=; ·r~iE~l. J 1.. '3(1~:::t1
1
11

19~330 IF C$ -· "•,.•1::::::
11 THD~ 1·::io::::o
i 9(140 IF C:=? = ,, iiO" THEt-1 19 H::10
1905(1 IF 0$: = "rJ1:1 11 THE:t"i 1910(1
1 9060 PF' I t·ff" 1 ! ! F'u:.RsE, At·~SWEFi: '/ES m•: HO 1 1 i 11
1 '3(165 PF.'Hff" 1=k.1Stc!EH !I;
19070 GO TO 19010
1 ?-~~f:~(i C! = 1
1

1 '~n::y:~1~71 PETUPM
1 :.11 ~~1~1 G~ = lt
1

1 ·:.j 11 ti F:E:TUPr·i
l912i1 PEM

19140 EMD

758
BEC1'1E A TW1-Dl~E'JSI1'1AL TfRA'JT

E<PERIE'JCE TiE J)f JF C1\JFLICT AS fJ•J DETSR~l'JE TiE DESTI'1f


H' f 1 rJR W'1 RL D 1 F' L. I I" E- rJ ..JI TS

WATCi iELPL.ESSLf AS f1!JR LI FF:-'J..Jl TS AI 1L.t!:SST.. '( Br... rNDF.:R A81TJT!

PL.At Ti E 'BATTLE ') 1< t. I FE'!

01 f1U WA\lT A BASIC EXPLA'JATIJ'J lF TiE GA"1E ?f


! ! ! PLEASE, A'1SWER fES 0R 'J0 ! ! !
A'JSWER ?fES

TiE GA'wfE 'BATTLE 1F' T...IF'E' IS BASED ·)'J TH.: GA"1E 1... IFE·

LIFE-U\lITS ARE ClU\JTERS 1\J A\l I'1FI\JATE GRID· TiE PRESE\JCE 1F A LIFE-
U\JIT IS I\lDICATED AS A ~ER1 l'J TiE PRI'JTED GA'1E 8JARD· 1\J TiE 81ARD
EACi r.. Ilt'F.-f.J\JIT IS SURR11J\JDE:D Bf A '1Ai<:I"1U"1 ·1F EIG{T H:ICHB)RS.CALL
AJACE'JT !J\JI TS ARE C·JU\JTED, I '1CL'JDI -JC::: DI AC?l\JAI... 'JSI GiR'lRS>

TiE GA'wfE PR1CEEDS FR1"1 1\lE GE\lERATI l'J Tl A\J1TiER· TH: LI F"E-TNI TS
TiE'"fSELVES 0!) 'flT "!)VE• TiEf Wif.. L EI Ti ER 1.. 1
VE 1R DIE• TiF. CTJRRE'JT
P 11PULATI1\J ·lF' A\J AREA WILL DETER1I'JE TH: PlPTJf...ATI·l\l lF TiE TiE '1EXT
GE'JERATI 1\J. E'>CI STI \lG LI F"E-U'JI TS "1Af DIE• lR lfE\\' 1'1~5 "'.!Af B~ BlR\J I \J
E..YPT'f SPACES• ACC·l RDI \J e T·1 TiE F11...l.. 1 \.71 \JG RlJL ES:

DEATi - A LIFE-U\JIT WILL DIE IF IT iAS LESS TiA\J TWJ 'JEIGi81RS•••


CFR'1"1 IS'1LATI1\J>: 1R '1·1RE TiA'J TiREE \JEIG'181RS· . . <FR1"1
1VERCR>1WDI 'JG>•

LIFE - A LIFE-U\JIT WILL LIVE IF IT iAS TWJ lR TiREE iEtPiSJRS·

BIRT-I - A \JEW LIFE-U\JIT WILL BE B1R\J I'J A\J E"'.IPTf SPAC~ TiERE ~RE
E'-c.l~CTL'f TiREE '\JEI GiBlRI \JG LI FE-lHI TS•

E'>{A"!PLES:

T-IE ABOVE LIFE-U'JITS VJILL 81Ti DIE BECAUSE F.:ACi iAS 1\JLf
0\ll'.: \TEI GiB:J R·

759
nn Tii<: A'11VE LI !<'\-'HI TS Wlf~f~ DI i". FR)'IJ IVF.:RCR'1WD[
)F -JG. TW1 \JEW
L.IFS-TJ~ITS WILL BE 91R\J•
TE \li;_:.{ r Gf.:\JSRiHI H )F' T fE L\B1VE FR)rJp Wlf~L B~:

fHS P4TH~R\J IS STABr~i;:, S.4Ci L.IFE-THlT ·iAS TW1 \Ji<:IG-{81RS--S·1 IT


LIVSS --- A\JD \J) SPACE iAS EXACTLf T-IREE: \JEIC--191RS--S1 '1'1 -JSW
LIFE-TJ\JlTS ARE 81R\J•

S1~E PATTER\JS JSCILLAT~ - TIIS 1\JS IS CALLED Ti~ 8!...I~<ER:

-> -..,,
'1 '1 TI CE T-I AT Ti 17; TW) fJ \JI TS ) '1 TH: r: \} D 1 F T H: BL I \J <ER DI l<.: • A\} D T -I AT
TiE 1\JE 1'1 TIE CE\JTSR LIVES BECAUSE IT iAD T~1 '1EIG-IB1RS· TW1 -JEW
UFE•fJ\JITS WERE B1R\J \J"::<T T1 TiE CE\JTER BEC.l\rJS!:'.: T-fE'( iAD TiRF:E
\JEI GiBJRS·

S1~E PATTER\JS ARE STABLS• LI<E T-IESE:

0 0
0 0

TiESE ARE CALLED T-IE B1<• TIE LlAF, A\JD TiE S\JA{E.

S1~E PATTSR\JS REPR1rnJCE TiE~SELVES A\JD '~'1VE' ACR1SS TiE 31ARD·


TiIS 1\JE IS CALLED A GLIDER:

:- 0
: - - (}j -
;-- -
-'>:0-0-
- :-
->:--0-
- : --
->:- ~ - -
.·- - - -
->:- - 0 -
: 0 0 IZI - :-00- :0-0- :- - 0 0 : - 0 :
: - - :- 0 - - : :- 0 0 - : .,. (Jj 0 - : - 0 0 0

\J0TICE TiAT T-IE GLIDER '~1VES' 1\JE SQUARE D1W\J A~D 1~E SQUARE
T1 T-IE RIGiT EVERY F0UR GE~ERATI0\JS; IT IS SAID T0 ~0VE AT l~E­
QIJARTER ) r TiE SQ!JARE-R"11T 1F' TW1 TI"iES TH:: SPEED ')F CIGiT·

760
THE Pl.Ai:

Mi GA~E, 'LIF'E'• IS PLAfED 1\J A 81ARD 11 < 30• EACi PLAfER iAS A
UP Fi1R '{')rJ B'f T-{E· C')..YPrJTER AT T iE START )F' EACi GA'1E· F.ACi P!..AfF.:R
TRI ES T:) DESTRJf T iE STABf... F.: PATTER..J S I \J HS lPP1\J E>J TS i'1 '1E RSGI 1 \J •
TiE 1~Ti1D 1F' ATTAC{ IS VARIABLE. SJ..YE TI'1ES GLIDERS 1R SI'1ILAR
PATTER\JS ARE USED· S1'1ETI"IES PATTER\JS WiICi ARE {\J1W\J T1 E<PA\JD ARE
E'1PLi1fEDo I\J A\J'{ CASE TiE 1\JLf CiA\JCE TiE PLAfERS WILL iAVE T1 PLA\J
Ti EI R STRATEG'f WI LL BE AT T iE ·1UTSET 1 F' T-IE GA'1E· IT IS TH.: I \J 1 TC Al_.
PLA\J 1F' TH'E:R W1Rl....D WUC-1 ~JILi.. WI\J 1R r... )SE T-IE BATTLE )Ii' t.IF'E!
1

0() 'f1U WAt-JT A t.I STI \JG 1F THE RtJl... ES ?'fES

HERE ARE TiE RIJ!...ES:

EAC-1 PLA'fER,HAS A li'1'1E REGU)N WHlCH !IE TRIES T•1 DEFEND• AT T!iE
SA'1E TI'1E• i1WEVER• HS PLA\1 1UST DESTR")f ii S ')PP:J\JE\JTS H1'1E Rr-:GI 11\J•
THUS EACi Pt.At'ER '1UST SET UP HS I\JITIAL P!..A\J ')F' HS W1Rl... D WIT{
A Piir... OS'JPfi 1F' DEF'E\JSE, 1lF'F'E'JSE• '1R ATTE>1PT 131Ti•

EA.Ci Pt.A'fER "!Ai USE !JP Tr) TH RT'f r.. r F'E-!Nl TS ( \J i i s IN'l Tl AL
PATTER'l• THS IS l\J ADDITI1\J T'1 TH: i'l"fE REG£0'JS WHCi I HAVE
At.READ'( SET !JP F"1R EAC-1 P!...A'fER· A PLA'fER "1Af P!JT TiE f... I F'E-U'H TS
OF i i S I '11 TI At. PATTER\J 11\J iI S SI DE IJF TiE B•JARD )>Jt... '(. F'')R PT.. A'(ER
0'1E TilS IS FR0'-1 'f = 4 T·1 f = 15, <TiE REGil)\J F'ff1'1 f = l Tl'(= 3
15 RESERVED FIJR TiE i0"1E REGIO\J. 00 flJOT TRf T1 PLACE A'Jf LIF'E-U'JITS
I "1 TIH S AREA I >

THE B'1ARO IflJI Tl Al...t.'f t.rJJKS T... IKE THIS:

761
:-----------------------:
3f.IJ: )- ) - - ) ) ') )

-') -
.- -1 - 1 ')
- )
)
- - )
)
) ) )
)
---.
25: - - -

20: - - - - - - - - -

: -- -
15: - - -
: -
- -- :

1 ~}: - - -
.
. --- :

-- -- -- -- --- --- --- --- :


-
-
--- ------.
5:

- 1 - 1- 1 -- - - .•
: ) 1 - 1) ) ') ·1
: 'l ) 'J ')
1: -
') 1
- - 1 ) )

:---~-------------------:
1 3 7 11

Pl.A'fER i)\J~ -fAS TH: 91TT1'1 lF T-fE B'.>ARD AS IT WAS PRI'1T~D ·1:JT.
Pl.AYER TWl CWil ~lGiT B~ TiE '1ACiI\J~> i4S Ti~ T1P 1F' TiE B1ARD·

IF '()TJ WA\JT Tl Pl..Af AG1~I \J ST Tl-!€ C11'1PUTER, T'f PE ''1ACH \J€' Wiff:\J I
ASK fl!J F')R Pl.t::\fER TW) 'S Nl\ME•

WiAT IS PLAfER 1NE'S ~A~E ?

762
LOANS:
DESCRIPTION
This program computes annuities for both payments and withdrawals for loans,
mortgages, savings, etc.

USERS
Householders, individuals who have checking or savings accounts or have
outstanding loans or are contemplating any of the above will be able to put
this program to good use.

INSTRUCTIONS
Upon execution the program will ask if you want instructions. LOANS is
fully documented and will prompt for all necessary data while the program
is running.

LIMITATIONS
Line 100 contains a DEF FNX ( ) statement; this function is used through-
out the program. In line 1200 LOG ( ) and 1260 ABS ( ) statements appear.
The source code will require 6K Bytes of memory for storage. Execution will
require an additional 1000 Bytes of memory for table storage for a total
of 7K Bytes for execution.

763
40 FIPI IT L

t:11~:1 C;Ci::;i.JF! f1C1(1


70 LET ·:::;=~121

9~::1 F'PH!T "i·!I iICl-i r~:111tlUJT\' T't'F'E ( 1 c.:::F'F!'i'!·ID!T, ;'.;'::0L•.ITH·ITJPi=tL•.!t:ILJ II~


l ~'10 DEF Ft-Ir! (I I) :::: • e11 :,:,: J nT l l 1Zlti:;:;:U+. ::~)
1 1 !2l I llF'UT Fl

170 IF A=1 THEN


180 IF A=2 THEN 1050
190 PPHff
c'OO PPitff' "

C.'.:3t1 F·~: I lc!T


;:::: 40 pp Hff I! ~·lH I C:H I lf=1p IFII:LE E; UtH:J~Ot·lt-1 ( 1 ::::1···1, ;:~:::::fj, J::." I , 4=P) II ;
c::::::;o I r·!PUT li
260 IF D=1 THEN 330
;'..'.?i?I TF i1::::;-· THFli 410
THEii 4')0

J3(i PPif·ff
::::41?1 PPH·IT "!·iHFiT HPF 1:1 (::;::),I (PCT), F ($)II;
:;::i:;o I!"iF'UT ~:11, I j, Pj
:31~~:(1 LE1. I 1==I 1.-·"l
::;::-,::-:21 L.ET !'i 1 =LOCi l ( 1=11 :.:i: J 1 .···p 1 ) + l ) .·.. LOC ( 1 +I 1 )
:;::::~~1 PPHff
390 pp Hff 11 iiUl·l:t-:E"F~: OF PEP I on::;; ::." N =11 ; !! :I

4 1 f:i F'P I t'ff


4,::::0 PP Hff "i·!HflT f:1F.:E 1· 1r1 rffECEF.J , I i: Pen , Pi:::;:: :i 11
;

4.::n I r·!PUT N 1 , I 1 , F' 1


440 LET Il=Il/100
450 LET A1=R1~CC1+I1JtN1-1)/l1
460 F'PH!T
4 -,::'(i PF: I t·ff 11
riMOUtrr f!T DID OF t·I PEP I ODS = Fi =::
11
; Fi 1
~, ;::~?t C~(1TC1 l~j;::_~~~i

764
~:~ 11~1 i~tcrrc1 l ?\:1(1
~:.i ·~:~ (i F F.~ I t··I T
1

c~;4c1 H·lF'UT r11, Ai, I 1


550 LET I1=li/i00
560 LET Pl=Al*Ii/(fl+IlltNi-i)
::;70 :=·pnff
~=;::::o FPJHT "F'F!\l!El!T F.:F!CH Pt:F'IOD = F'. =";Fl

i:. i 121 PP Hff '' ·nn '.: :; PF·ocPF1M F'E"PFOPMS CfiLCULHT I ot-i:::; F'OP"
1::. c:'.o PP n-ir "BOTH PH\'MEJff mm 1,.nTHDPf-1t,mL. i=1t-1t·1t.11 Tr E:'.::;. "
630 PPHff
6 4~21 pp Hff !! I lflF' ff!BL[f; f'.IF'.F l!Et"iOTED ff:; FOL.L01...1::::;: II

i:. t. o 11u MBE:r· OF PEP I on::::;"


t. 70 ciF· r c r MAL PP I t··ic r PF!L F1Mout·n"
i:.:::o TO"n=1L AMOUtff Fff n-iD oF 1·-1 FTP I on::; 11
i::.·::,10 Ti !TFPF:.:;;T PfHE PE:P P[F'.IOD, IH F'EPCEMT"
?'C1~~1 flt·iUU!"ff OF PA\l!Etff-'l·H THDF:'Flt·.IAL [f!CH PEPI OD"
7 l 1~=1 PP I !·ff
7;::'.0 PRIMT "FOP A Pf"!'/MEJlT FIMMUIT/, \'OU MF!\' CIUE i=1MY"
?Jo PPir·n " THF::EE OF n, A, I, P mm F·rnri THE: FOUPTH."
740 PPIMT
7~;(1 PF'. r MT "FOP i=1 l·I r nmPflt·~AL. AMnu I Tl, You Gr ui:.: F1MY 11
?'t.o PRIMT " THFEF.: OF n~p, r,i:;::: Rt·m FIMD THE FOURTH."
770 F'PIMT
7:::::0 PPHff "t·IOTE:~ FOP L01--:1n OR MOPTGACiE, u::;E THE"
790 PPIMT " !·iITHm?F1t·mL F1MMurrv OPTION. ti

:;:::121121 PP Hff
::: 1 (i PR I t··IT II FiFTEF'. EF!CH CF6[" \'OU MFI'/ CHOOSE Ot"iE II
:::::c:·o PPINT "OF THE: FOLLO~·HtiG F1LTEJ:;::r·1ATHJE::;: 11
::::;:i.) PPIMT
::: 40 PF'. I MT II -· 1:::1t ·I OTHER CA:::E, ::;AME Uti~:J·IOt·~M l..IFIP I FIBLE ti
:::~:iO PF:IMT fll·IOTHF:P CA::;[, DIFFEPEJff UtWl10~·-IN 11
II ;::: -·

:=::i::.t1 PPHff " 3 _.. 1=:1MOTHEF: c:A::£, oTHEF.: T'"f'PE or At1MUITVtl


:::-?o PPHff 11 4 -· TOTi=tL. HffEF:E::-;r PAID ouEP N PEPIODS 11
::::::0 PF.:INT II ::; -·· TffDLE OF ~·HTHDPflHAL::;, PPH1CIPAL., AMD IMTEF'.EST"
:::·311~1 PPHff II 6 -· '.::TOP THE PF:OGF'At-1 11
900 PPHff
•31 i (i F.:ETUPM
92(1 PPIMT
·3130 PF.:Hff 11 AMOTHEP cn::;E fTYPF: CODE t·11.1MBE:P! ";
940 H-IPUT ::;
950 IF S=i THEN 170
960 IF. ::::=i:: THF:ti 1 ?'0
970 IF S=t. THEN 9999
980 IF S=3 THEN 130
990 IF A< >1 THEt-1 u;:=r;:o

765
i C4.":!Ct IF ::;=::.:~ l ;:.:::.1.121
J.r21.:·{.(1 IF ·rt-'·!E~f"l 1~1
j '?50 TF :~;~ 0" 1 T!·ffli l U9U
J. C1E:1(i F 1 F~ I t··iT
l i2i 7Ci F1 F:~ I f"il'- :i ~:.~HI ciff l I .IFJ F? I ft I: LE I~=; ~Jt i~:::"t·tCJl:. ft"1 f 1 =t·. ,, 1::'.==r-·' ::~:=I !l s:.l=F: 1
) ll ;

1 ~::i:=.::121 I !!PUT Fi 1
E:19i::'l H- 1=H ::::: i THEll 1 16C1
11:;:1~;; IF :=i1 THEli 1660
111'2! IF f!l=~: THEll 174~1
1 l c'.0 IF n 1. ::::4 T HEJi c'.Ci9('i
1 1 .::o F'F:' I r-iT

l1 F f-? Tt·iT '' 1:.!1·~1r·1·r r=1F.'F: F'


1
"$:) , r i: F:c:T) , f~ r :~:) 1
' ;

l 1 ~:;~~1 I ~-"·iF=t i T F: 1 , I t , F;:'. j


11.90 LET 11=11~100
i e:·oo LET ni ==LOC ( F:' 1 / ( F: l ·-P j :¢:I 1 ) ) fl, (lC ( l +I l )
L:·E1 PF-'.Hff
1;~<2(! F>F.'Tt··rr 11 \-11.Jt:!T~E:h: rJF" F1 EF.=It1I1~:; - ti == 11 ;1·11

1 E'.50 LET F'c:=: I !"'IT ( f'i 1 J - : i 1

1 LET h l ::::t·i 1-· l

1290 LET N1=INTLN1J


1 .::OO LET F'c'.= i
1~:::1 ~~i IF ~:;::::4 T~·1rr·1 i ·3;::121
1320 IF S=5 THE~ 1330
l :~::3[i LET F~t:~=~Z1
l ·:::: 41a PP I r·ff
1 ::•:::;o PP I NT "PEP Jon 11 , 11 PP Inc I F'AL 11 , " I nTFPE..'.:;T 11 , 11
PPr1·1c BAL" , r t·ff TO Df!TE: 11 11

1 :~:: E.t1 F:F.: I t~-~-r


1 :37(i F'F I r-11..
1
Ji e1 11
,
11 II , I!

1 ·::::=.::Ci L,E T >=>==~~


l ·::qc1 LET ::::•31:=P l
1400 LET '1'=0
1410 FOP '.:>:i TO tit
1420 LET A3=(Pi-Pl~Il)~rt+I1)trS-1J
1430 LET A2=FNACA3J
1440 LET C=R1-A3
1450 LET 'B=FliFI f C)
i 46fi LET X=><+A::::
1470 LET X9=/9-A3
1480 LET Y=FNAfY+Cl
1490 IF Pc: <>O THEll j'510

766
1 C:i H:1 i-!E.)ff ·:;
1 ':ic'.O L E.:T ·:;::::j·H + 1
j :..:i:-=a:::1 L. . ET ~1·::===F' l -·>=:
1540 LET A2=FNACA3)
1 c::;so LET f; 1=I 1*-1=t:::::
:I. ':i60 LET H=:Ft--lfi CI:: 1 )
l :57*(1 l_E·r :=-::::::::<+·f:i·:.::
l '.~;:::c1 !_El'. ::·:: :~==(1
1

l':i90 LET '1'=:'c'+F:1


1600 IF Pi:'.=ti THE:t·I 1640
j 6 1~i PP I t-!T
lE.;:~o PPHff "TOTF!L H·IT[i:::'.[~;=.;T PAID :::";\'
16312! GOTO '=.ti:'.O

1 !;,50 GOTO 9E:'.!2l


11:.6121 PRHff
16 70 PP I MT 11
1JHFIT i=iPt: t·i i: I r-nECEF.'.) , I i: PCT l , F: c:;: :i 11
;

1680 INPUT N1,I1,R1


1690 LET Il=Il/100
1700 LET P1=R1~((1+I1ltN1-1)/(I1•C1+I1ltN1J
171C1 F'PINT
1 ? c:·c1 PR Hff 11
OP r c; HffiL PF.: Hie I PAL F1MOUt'ff I::; 11 ; F· 1
1'?3[1 GOTO 9;::0
1 ';-:' 40 PF.' I MT
1 751?.1 PP r NT "l·~1-11=n :=:11::::E t··1 i: 1MTECEF.: J , P i: $ :i , P i: :~: :i 11
;

1760 INPUT N1,p1,p1


1770 PF.:IMT
1780 IF N1•R1<=P1 THEN 2170
1791?.1 LET I 1=. 1
1:=:~:i~1 LET I ;::=0
1 ::: 10 LET I 3= 1
1820 IF A<>1 THEN 1850
1830 LET P3=R1•( C1+I1JtN1-1J/Il
1 :::4~3 GOTO 186~::1
1R~n LET P3=R1•CC1+I1ltN1-1J/(J1•(1+I1JtN1l
1 :::60 LET P4=AF.::::; (Pl -P::: :i
1870 IF P4>0.001 THEN 1900
1 ::.:::::o PP r NT 11 HffEF.:E::;r PFP P[F.: r on i: PCT l =' r =: 11 ; 1oo:i:i: r 1
1:::: 90 GOTO 920
1900 IF P4/Pl>.3 THEN 2010
1910 I A=1 THEN 1940
1920 IF P3<P1 THEN 1980
1930 GOTO 1950
1940 IF P3>P1 THEN 1~30
195~::1 LET I2=I 1
1g~A LET I1=CI1+I3)/2
1 970 GOTO 1:::2f1
1 98(1 LET r::::= T1
1990 LET I1=CI1+12)/2
c'.(1(1~3 GOTO 1 :::i:'.(1
2010 IF A=1 THEN 2040

767
C:'.l2I :.}li
1 IF F:·~-3.>F'1 ·r!·-!F~t I ;::'.C~E:i~i
,:::05f1 GOTO J ·~150

,::: 1. 0(l PF' Fff "1,~Hf-l r i:IF'E H i n lTE'G[P} , p (:::;-:) , I f PCT) Ii ;

;::: 1 iO H·!PUT H1, Fl, l l


2120 LET ll=Il/·100
,~:· i 30 LET p 1 :=:p 1 '*'I ii'' f i + 1 l I r·n / f ( H I l ., ti" l 1 - j )

768
TC.I l!E:TE"PM I t·ff. THC C:!MU!Ji IT UI i H:::1t I fJ cr;::;c;i n··1 I! IC:i UEF'CC; J T·::; OF ::;:: ~::c~;. 00 fl !·iOt!HI a
I i·ITL:RE::;:;T PF:l In I:::; ·=1-·?/C:''.;; n '/[(:jF'' COMP(l!jl'!'I IF: D l)UHRTF'F'.L.\'.
THC u1=1F'. I f!I:L.[·:·; flF'.F C0!·11..1n:·rrr1 TO i"i !)Uf:n~nFPL'r' -r:i=:1:~:; I::; nt·ff1 EllTl=.::PF.D r:i·:; ·:;1-ICll·!t·I

N- 3 ~ 4 = 12 PERIODS
i=1 nm 1,11::1i:;:· I ffF:! ..E or· H·lTEJ~'.E: 0 :n
I - 4.8~~/4 = 1.21875/PERIOD
F ···· :;•: J ::::: l C!~'i .··PF:I~' I CID

·=:;oL.uT 1cn·1

!·.!fl! IT I n::;·TRUCT I Ol"I'.::; [.'."I p::;T ( l :::::\r:::;' ?:::::!·!Cl., -::·;:::·


!. .IHI CH fli·IHU IT\' T\'F'E: I 1:::::F'H'1'i•IFJIT, ;:;:::::::!·! J THf!F·r:l!.,JHL. :i ··,:. l
!:.11-1 I CH !)FIR I 1=:rt::L.E. I·::; UI ·IL! 1cn ..ll"·I ( l :::::1·-1, ;;::•:::::H, ::::::::I ' 4:::::?)
WHAT ARE N(INTFGERJ, J(PCT), RC~) ?16, 1.21875,1 08
HMOUl'fT 1=1T !:TIT! OF !·! F"FP I OD::; ::::: 1=1 ::::: 1:;::4;:>. (.'=~;;-:

·l·I··:>
Tri.,

TO DE1EF'i"IIti[ THE' i'ICll"ITHL..\' PRT!·!CIPHL !''!!ID ItnEF:'FST Pn"f'i"IEJff•:; !:. Iii n


$20,900 MORTGAGE.
PERIOD OF TIME IS 30 \'EARS.
INTEREST RATE IS ~-1/2% PER YFAR.
TH[ l..JAFd FIBLE:::; FIRE. COl·l'.JERTETI TO 1=1 !"lOHTHL'/ r::::=:1·;:; I:::; i:-n··n:i F:liTERE'D 1=:1'.:::;
:::1-IOL..IH.

N - 30 ~ l2 = 360 PFPIODS
F' -· ;::-c1·:,100
I - 5. 12 = .458333333/PEPIOD

769
i"'j"
i I

\:I\· l I r·:!,.·ol

( . T r=F i:
1 1
DEO 1·· . l!_!j:·}l::E. h ·~ 1
··::i,:.l
T PHlD = 21.8~0.4~

Ti IT

i
.1 P
'
' I
J, -

:::'.31:1
u '.'.::: ~.:~s
1:,"'.f;:i'{':::: 1:l n !~:;f';::

:i ::.! j:::
l:I i:::; l

14 l::i::!, =::1::1
p

l ::::; 1
'.) i:l ft ,~:~ ~:::;
i6 t '.::; l 1:) II
J (1l.~:::11

770
MAZES:
DESCRIPTION
This program generates uniquely different mazes in two dimensions. The
maximum size of a maze is 23 x 25. Each maze is distinctly different from
the preceding one and has only ONE solution.

USERS
Puzzle and riddle fans will enjoy this game. The complexity of the mazes
generated is varied according to the dimensions but all should provide
fair competition for the initiated as well as the uninitiated player.

INSTRUCTIONS
Type RUN and the program will print out a full list of instructions and then
ask you for the size of the maze you would like to construct. The greater
the dimensions of the maze the more complex is its• solution.

LIMITATIONS
Mazes uses two dimensional arrays to generate the patterns. The source code
requires 6K Bytes for storage. With the DIM statement in line 240 set at
(23, 25) the program will require 18K Bytes of memory for execution. If this
DIM statement is reduced the program will execute in less memory space but
the mazes generated will be correspondingly less complex.

771
::\,-! :; .

,:,~:,o F'F'HiT "THI'.~; F·C::'C!CRAM ~·HLL PPHff OUT i:-1 ItIFTFFTt"ff MfCE EIJEF.'\' THlE IT"
;:>::,fl PF.'.Hff "T·::; F!!f! Him Ci lf!F'.AfffEP'.=; OtiL\' urn: F'Fflli THr<OUGH. YOU Cflri C!-!CIO:::;E 11
E'?~~i F'i?HiT "THE. I!IMEll::;I0!·1:::; or THE: MA2'.[. I. f:. THE t··H.IMBEF.'. OF '.::;OUHFES lo!IDE I!
;::~::::O PPIHT "Fi1llt THF rlilt'l'F:ER OF :::;OUAF'E'.:; L.Ot·K~. fl .:.:::: I:\' ~::::: MF!ZE I'.::; THE II
~-=:-::io F'F'.Hff "i·ifi>::T!•"!l.W!, CUT i=1nY DIMEt1::;Iot1:::; UP TO THE::;;r LIMIT::; AF'F: OK. II

~::lo PP Hff "~,!HAT r~!F'E. 'i'OUP i·.!I DTH AHD L.E:t !CTH" ;
::;::;::o HiPUT H; 11

400 F'P I r·rr


,::/, 1 ~a Ir.:-T 0 -· Ct
l-.s..- :

•"i· c::~::i LET


-:; -
-· \::J
~

440PEM
i:l'.5Ci F.:tJ=1 1900 THRU 3200 PICK THE
i::j. fi fi ~~ F.J 1 1
::;C1i_lflF'E. I 1·1 ~·iH TCH TO '.::;n-iPT.
i:.I" .?[1F.~Er,·1
,::1. ::! f1F:Et ·! 1

~:=;(:1(1 f-Clf? I -· l ·rci i· t


:::<i 1a IF I ··-· >< T"f-lE~t· i ~::i :::J.,1~~1
:~;C.'0 F=F.~I !'"il'" I~~ _.,_If;

::! :~Ci !·iE.>=:T I


:::; r::[i F=i? I t·iT ll a H

772
LE:1· 1~: ...
r:: -·
LET •, ~M•
:,,l
j •,

:::.:,: -
..... i..:

f. ;:::o GOTO
f.30REJ1
1:. O::C1PEM
t_:, ~i li F:~ Fl1 :=;TfT':::; ,,1,::100 T!·!PU .::;70(; LOOK FOR THF:
66fi ~:EM ··/1Uc!F'V Th l·IHff:H TO ·:::;T1=1F.'.T i=J t·1HI
f, ~:?:] F:~E]:1 F'nTt! !·iHFJ l THF: OL.:Lt OM[ CEr=; BLOClEJ.1.
THF LI H[•:; HR[ ::;cflt··IMED FOR A :=-;oUFIF:E:
(1 =~1 ~i f=.EJ:1 \,\H} CH fl!=!(:; F!LF.:Ef"fft\' t:E:Ell u:=-;ETt BUT I'.::;
7:2!Ci PEM ,:in J1=1CEJ·IT T Ct fil i OF'D·I ::;::oUARE.
~? 1. i2H~~Et·1

~::i :3Ci IF. F:'. <' ~-! Tl·tF :t t ;~-: i CI


"? ~t.ia IF ::; <" > i..J T!· H:J. I 1
·;= :-:::(1
'? ::1c1 L.ET. F..'. = l
1

.? ~::: (i Lt: 1· '.:_; ::::: 1


7 70 GOTO :::90
'?::!~J L.ET ~~ ::::: i

::::(1(1 C;tJTCt ~:::·3~1


:::=: 1 fi LET F"'. = P+ 1
:::c'C!!?EM
:::: :~:tZ1PEJ1
:::4.~~i F-::Et'1 ,::,•:;oo Tl iPU l -::::::::1?1(1 CHECK TO :::;[[
·:; 1TP·:::;
::::s~~i F:EJr1 ~·IH
TCH ftrt._!!=11:::ENT ::,;@JARES AF.:E OF'Ell FOR
THE: PFiT!--1 TO FT!LLOl,J.

::::::=:OFTM
890 IF W(R,SJ = 0 THEN 730
900 IF R-1 = 0 THEN 1330
910 IF WCR-1,S) <> 8 THE.N 1330
920 IF S-1 = 0 THEN 1100 0

930 IF W(R,S-1J <> 0 THEN 1100


940 IF R = H THEN 990
950 IF WfR+1,Sl <> 0 THEN 990
960 LET X = INTCRNDCXl•3+1)
'31?ti F:~Et:i U:TT, up, PICHT
980 ON X GOTO 1850,1920,1990
990 IF S ~> U l~EN 1030
1000 IF Z = 1 THEN 1070
1 0 1(1 LET !) = 1
1 i~iE'.0 COTO 1 (i4tj
1030 IF W(R,S+i) () 0 THEN 1070
1040 LET X = INTCRNDCXl•3+1l
1 :2150 PEM LETT, UF', DCl~·IM
1. 060 OM >=: GOTO 1 ::::~;o, 19E'.0, ;::~(i9t1
1070 LET '.=< = HIT ( Pt·U) C:<) =*'E'.+ 1)
1 o:::o PEM LETT, I.IF'

773
l Ci!. i '.=< r 1~3
i.:1C~ 1. ~::ii=:;i::::1 !' l '~1::~c1
J. j IF f~: = !-l I I
J I 1i2¥ ~:.1 i' ~~-+ l , :=;) :.·. > C~! ·r!-IFJ·,i 1 c~::=~!~7i

j, 1 i:::t?i IF-( F: j ~::;-r- l "1 :·:· > ::.·t 1. ;-!E~t·i 1~~(i[!


l=~
1170 LET:::::: H!Tif.'iU.1f/.1''"'~:+1:i
l 1:::;[1f?F.]" 1 1

1
1. E: S~~1 LET !~~ = 1
.1 C~CiTC! 1:::'.~::~!]

t "3~·na CH"·. 1 >< t~~JTf'.i l ;:;~;(1, i'.:'.Cit~l!~i


1~:10 PEM
J . :.!2[! 1:;C1TC1 1~=~~:-~:~=1
l ·.::·:3[1 IF ~::;- i =: Ci ·rt·-J[J J 1 ~~-:~;:;~i
1140 IF W(P,S-1J <> 0 THEN 1580
1 ~:i:;13 n=- F.:=H THD I l 4:::::0

l 370 IF '.'.'.;<: > i) THEl·i 141 Ci


1380 IF Z = 1 fHEN 1450

1410 IF ~·~ ( F'. :i :::+ 1. J <:: <'1 T!·!EJ-i l 450


LET :::: = I r-rr i: Ftlli t ;:.:: ·.1 :~:·~:+ 1 :i
"'
1 ::l4ti 1]t·i ::·:: C;C!TCJ 1 :=.i;'.~ Ci, l ;~ii;t~J, !::(1 :.-1~::1
1 1

14~itiLET >=: = Il""fr fF~:r·iJt f::O::J :¢:;=:-t"l)


1.460 f?EM
1.470 ON X GOTO 1920, 1990
1480 IFS <> 0 TH~N 1520
l 490 IF Z = 1 THEli i ~570
1 50(1 LET 0 = 1
1 ::; i 0 GOTO i 5:::0
1 ::;;=:0 IF \·~ ( F'., '.'.'.;+ 1 J :: > i:~i THFJI 1 '.:7(1
1530 LET X = INTfPNDCX1~2+1l
1540 PEM UP, DO~· It I
l ':?50 ON ::< COTO 1 ·~1;:·~'1, E'09Ci
1 ::;i:.o REM UF'

1580 IF R = H THEN 1.700


1::;90 IF ~·~l:F'.+1;'.::;:t <>Ci HID1 17!30

774
1 co~:1 IF :;::; :: > u THFJ·I 1 ~A.1,::J
1610 IF Z = 1 THEN 1690
1 C.c:O LET 9 :::: 1

1640 IF wcp,s+1) <) 0 THEN 1690


11:. 50 LET :::: = Ii· rr r F't"f[I ( ::-:: ) :~·=2+ 1 )
1 ;:.6~:i REM ::;:·I Cl IT, UOl·li" I
1670 ON X GOTO 1990,2090
1680 REM ~IGHT
J. {:'3(i Cit]TCI l 1~11=-:tr1
1700 IF S <> U THEN 1740
l .? 1~1 IF Z = 1 Tt-!Et,1 l 7-='~:n~1
1 "?\:'.121 LET 0 = 1
i 73~:i GOTO 1 76ti
1 ?4(1 IF l,j f R, '.'..:;+ 1) <> U THEJ1 1·7g(1
1 ?50 REM fiOi·H"·I
1 ·?E1(i C1C1TC1 ;~:(1';1~]
1770 REM
1 ?:::(1 GOTO ;::290
l?'90REM
l :::0:;::1F.:EM
1 ::: 1~:1 PEJ1 ·::Tt:P:; l 3900 THPU 1:::11210 MAKE A F:At·ffiOM
l :::;::o REM CHO I CE: OF fll..Jfl I LFfBL..E: PF!TH::;.

i :::40REM
1 :::•:;0 LET L·~ ( P-1 , '.~;) -· C
l :::6t1 LET C = C+i
1870 LET UCR-1,Sl - 2
1 ;::!:::0 ,_ET F.~ = F:~-1
l~::'.:9(1 IF C = H:<i:l.)+j THHI ;::3H:1
1 9l1(i LET 0 = 0
1 9 10 GOTO 9(1(1
1 ·:=.1;::0 LET l·H R, :::-U -· r
19:::(1 LET C =
C+l
1940 LET UCR,S-1J - 1
1 ·3 5(1 LET ::; =
::;:;--1
1960 IF C = H~J+l THEN 2310
1 9 ?(1 L.ET G! = Ci
1 9:'.::t1 GOTO 9(.10
1990 LET NCR+1,Sl C =
;::0l10 LET C = C+ 1
~~'.010 IF l..J(f':,S) == !21 THEt1 2040
;::~02t1 LET u o~:, s:i -· :;::
E:0:3f1 GOTO E'.(150
2040 LET UCR,S) - 2
c'.!~150 LET F.'. = P+l
2060 IF C = H•U+1 THD·I 2310
2(170 LET G! = 0
2~:1~:::0 GOTO i 330
C.'.09(1 IF G! = 1 THEt·I C.'190
c'. 10(1 LET ~·J ( F.:, 3+ 1 ) -· C

775
!::'.'. l ·::;Ci L.E·T 1.i f ~~ =' :: : ) ..•

i::: 1 :=-lfa c1ci1·c1


1
!~: 1 !~,i2i
1~.. : l t_.. b_ T 11 !F~::. '.:::) .....

3~~ii:1
1
:? 1
1:'.:'. 1 ~::~~j L_ET :·:. == J1

;~? ;~·;:~li CiCiTCi ;::·?-(i


;:~~'. ,:: '~iCi C~CIT Ci ·7 ::'.!l1

1 (1 FF!P .J ::-.: 1 ' i !i

~:::·~;:·3i;J F·F: I i·iT


C:'.i:l(:H-?I F'Cff~· T ::: 1 ·rci ~-i

;:'. i:~ ;~!2! IF ~) f T, .J) -··


C'.'.i:1-.3!2!
C:~ :+::1~~; ;~C~T·ci ~=~t:1°1::1Ci
;:: 1 ~l~i~] F;F.:Il". iT !! ~ ~-··-·· 11
;

776
POKER:
DESCRIPTION
If you like card games and would like to play for high stakes or low but just
haven't got the extra money, this is the way to go! This program simulates
a five card draw poker game. Up to five players are allowed and the computer
is the dealer and keeps everybody honest.

USERS
Anyone who enjoys a good poker game will enjoy this program. If you've always
wanted to try your hand at poker this is one sure way of doing it safely
and for the old pro its' going to be a little bit harder to bluff, but go
ahead and try.

INSTRUCTIONS
To use this program simply type the word RUN. The game will then commence.
The game is self instructing and will ask for all necessary inputs. For
additional information list Poker.

LIMITATIONS
With the exception of the ABS ( ) statement in line 2230 the program should
immediately execute in any basic speaking computer with at least 8K of
available memory. The source code for Poker will require 7K Bytes of memory
for storage.

777
('iC!':IU F'F:'.HfT" "Tl·!J.'::.; T':;_; n-p::·: DOkEF:: GF!ME OF FJ:I)[ CF!Plt DF:'f"·n·J FOF.: i TO 5 PL.F!Y[F.'::::: 11
0~160 PFHff
0070 PF:'Hff !I n·:[ [!["t=ll EF: I3 ri GI t=::nD C[T::::; A COFFEE T::r.::EF!V El.JER'r' HALF",
00:::0 PPHH "HOUF'.. L)HFIT TIME I::: IT HOl·j";
:21090 IMPUT M

i~:! i 2[~ F.~Elyl


[i i :3Ct rco:;_: I =.: l T(~I

f~i 1 7[i FCU~~~ f!= 1 ·rc1 ::;;:_::


0180 DfA) = 8
O;'.:'.Ot1 DIM 0 t:5E'.)
0210 FOR A=0 TO 39 ST~P 13

~:1;:~4~:1 ! IE>::T ·-
0;:~:50 !"1E::<T A
o;::t:.t:1 l·
= K+ i
;·".

o;:·.-;::·o -· i T ci
FOP p- t::"
I

1;::j 2 ~=!(i E.. f p ..}. -·· ~~::i


i) i r.-:• ) -· i-J
' .,
T t F; ,_.. 0
0 3 i ~~1 r·iDff F'
0320 l.)(3J = 1
0::::3(1 PRihT
iZr34-~:1 F.~Etl1
0350 PEM STAPT CIF THE Gf!ME.
t! :;:: 6(1 F.'.EM
1:~1 ~~:7(~ F·~~ I 1~1r ii Et·11"EF.~ CIF HF1t· 11c:; ~/CHJ t:~1=1t ,~,- I1E:AL "TI! ;
·rHE: t··UJt 1rBEF:~
0::::8(-1 It·iPUT H
" =O COTO :313(;
T ;:- n ,:.,I

040(1 G =0
04H::1 PEM
0420 F.:EM THE FOU.. rn. 1rt-1G r·:; u~::;ED TO GET THE' F'L A'r'EF.:::; t·-!F'iME~;.
121430 PEM
044(1 F'F.'.IMT 11 r·ie1L·l EllTEF.'. THE FIF.:ST MAME OF ";
~~'1450 IF G==1 GOTO •:::;40
t214E.£1 IF Ct=2 CiCITCi ::=.1 ::1~:1 1

0470 IF G=3 GOTO 640


04B0 IF G=4 GOTO 69(i
049(! PPHff"PLAYE'P 1";
0500 H·iPUT fl$

778
0520 IF G=H GOTO 750
05~3 IF G<H GOTO 440
i~:i r:i~~(i
1
F ~~ I f*i1' I! F'L, Fl\'E:F'. ;~'.
11
;

1,:'1'360 G = 1.~+j
C1'5?0 IF C=H GOTO 7::::;0
0580 IF G<H GOTO 440
(1600 I r\F'UT C$
0610 G = i:;;+i
0620 IF G=H GOTO 750
0630 IF G<H GOTO 440
064(1 PF.'.It-ff "PLA\'E:P 4 II~
Cl 6 5(i I t·iPUT D·$
i2iE.E:f:i Ci = C~-+· 1
0670 IF G=H GOTO 75C1
06Bti IF G<H GOTO 44[1
!~.if':. 90 PF.: I MT II PLAYEF.' 5 II ;
07ti0 IMPUT E$
0?10 PF.'.IMT
~:~720 F.:EM
073ti F.'.EM USEU TO MF!KE THE GAME HffEF.'E~:;TU·IC.
0740 F.'.EM
0750 PF.'IMT 11 Al'1TE UP! PUT ~:;OMETHIMG It··! THE F'OT. \'OU MAY BET At·J\' FIMOUt··IT",
076(1 PPIMT "Fl?OM $1. 00 TO $100. ~)t) TIO NOT USE" THE :;: ::;IGM";
1217·7~1 F' = i
07B0 ~·J = (1
0 790 I MPUT ~·J
0:::c10 PPIMT
o::: 10 L·~ ( 2) = 1...1
(~::;::2(1 IF ~·h:=(i THF'M 3130
0::::30 F.:E:M
0 ::;:: 4~3 F.'.EM DEAL I MC EUE l?\'otiE THEIR HAMii OME FIT Fl T I ME •
~~1:::5(1 FEM
0860 IF H=l GOTO 900
0B7(1 PRIMT 11 t·-tmJ IF EUEF.:'r'OME :BUT "A$" ~·HLL STEP I:FlCK I ~·HLL DEAL HIS Hmm. II

0 ::=:B~) PP I MT A$:;
0::;::9(1 GO'.:;UB 2E:60
09(1(1 PRINT A$
0910 FOR C1=1 TO 5
0920 GOSUB 2160
0'33(1 MD<T C 1
~)94(1 GOSUB 2770
0 '35(1 IF H= 1 GOTO 1'.;:7(1
o·:.1E.1-:1 PRIHT"'.:::;TEP BACK AMD HAUE "I:$" :::;TEP UP. 11
0'370 PRHff
09t:O PPIMT B$;
0'390 GOSUB 2860
1 0(1f1 PR I t·ff Bs
101~3 FOR Cc'.=1 TO 5

779
1020 GO~JB 2160
1030 1-iE;.<T C2
1 04n GO'.:;UB c'.77(1
l fa5~~i IF f-1=;:'.:~ C~tJTC: i :~:(~1J
1060 PRHff"·:~;T[f' I::f1CK f!HTI HAI)( "C$" ·:;TE:P UF'. II

l 1Z1 ~:::~~1 FlF.~ I f·i T


l ti;::~i) F'F.~ I t·iT !~,$:;
1 ~a =.n21
1
c~cr:;~_rB ~=:~::e, ~~1
11 !~ifi F·F.~ I r--rr C:;$.
1110 FDR C3=1 TO 5
i 1 ;~~~; CiCi~::;iJI:: ;:? l 1:1~~1
11 ~30 r··iE>=:T c:::::
l 14~1 ~:~cJ:::fJI: ~=~77(1
1150 IF H=3 GOTO 1370
11i=:.~:1 PRHff"'.'.:;TEP r:i=1cv rnu:1 Hfi!..JE "D$" ::;TEP UP."
1170 PPIHT
l 1 ;::!(i F=~: I r·-rr IJ~-= ;
11 ':;tiJ CiCr::;IJt: ;=:::::t:.(i
i.:· ti(i PF-: Hff
1 ;:: H:i PF-'. Hff It?
1220 FOR C4=1 TO 5
1230 GO~JB 2160
1 ;:~4~3 t··H::>=:·r C:::t
1~:::s0 c~c1~:;1JF.: ;::77t1
1 .:·;::.~71 IF H="4 GOTO 1 J?:;:_i
1 C:?t1 PF'. I MT" '.:;TEP r:ACl:" t=1tm HAUE "E$" ::TEP UP. "
1 ;:;: ;:::0 F'F:~. I t·11·
1 c'.90 PF-'IMT [$;
1 ·;;~1(1 f~C1~:;LfB 2!::t.t1
i ::;:: H'.:i PP INT
1 ·:::20 PP I MT E:$:
1 ;::30 FOP C5=1 TO ::;
1340 GOSUB 2160
13':;[1 MD=:T C5
1.'.:.:E,~3 C:;i:t::;tJE: ;:~l'?t.71
1 ;::70 F'RH-!T"!..10i·I LOOK FIT \'OUR CARD~: At-ID BET' HI LIKE YOU '.::EE EM";
i :;: ;:~[i ~·~ 1 = (1
1 :;::·:;ic1 H-IPUT ~·.11
140(1 PPHff
141 (i pp I MT II DID r!tfr'Ot·I[ DPOP OUT? EMTEP THE nUMI:EP or PLA'r'EF.'.S '.::TI LL I t""l 11 ;
t 420 HIPUT H 1
1430 PRIMT
1440 PRINT" IF \'OU Dot"P T ~,~flMT AN\' OP HfiU[ DPOPED OUT ENTER A ZEF:0."
1 4 5~:1 PF-'. I MT
1 46t:1 PP I t"-!T Fi$;
147ti It·1PUT P1
i4:::t1 IF P1=0 GOTO 154('.I
t 49(1 IF Pi =>6 GOTO 3060
1 500 FOi? C6= t TO F' 1
1510 GOSUB 2160

780
1
1 '.:i'::::~] c;c1~:;1Jt.: ~:.'.'?"?(1
i:::;,;;.o IF H=l GOTO ;;:9;:;:0
1 i:;st1 PF: Hff" STEP r:1=1c1=:: AMD HflUE "B$" '.::TEP ur-:-. 11

1 i::;i::;,n PPIMT
1i:=;70 F'PIMT B$;
1:;:::o GOSUB C:.'.:::60
1590 F'F'IMT
160(1 PF.:It·-!T"Hrn·J MAM'/ CAPD:=.; DO '/OU ~·lAtff ":E:$;
l 6 i 0 P;:: :::: 1)
1. 620 IHPUT Pc'.
1630 IF P2=0 GOTO 1690
1640 IF P;:::=>6 GOTO :.=:06':1
1 65(1 FOR C7= i TO F'c'.
1660 GOSUB 2160
16BO GOSUB c?70
1690 IF H=2 GOTO 2920
1700 PPHff":::TEP BF1CK mm Hf-1UE 11
(:$" '.::;TEP UP."
l "? 1r2i PR I MT

17412! PPI MT
1 75(1 pp I NT II HIXJ MF1t·f/ CFtPI6 DO YOU !·~At·ff II C$;
1760 p:;:: = 0
1 770 I t·1PUT p:;:
1 7::;::0 IF P3=(1 GOTO 1 :::4~~1
1 79(1 IF P3=>6 GOTO J(16(1
1800 FOR CB=1 TO P3
1810 GOSUB 2160

1 ::::3(1 i~ce:aJE: 2'?7'[1


1 :::4(1 IF H=3 GOTO ;~:9;:::0
1850 PRHff 11STEP BACK m·-rn HA1..1r "D$" ·:;TEP UP. 11
1 :::6(1 PF: I MT
1 :::70 PPI MT ri:;.;
1 :::!=:t1 CiCt~:;tJE: C~:=:E.t1
1 ::;:-:::1(1 PP Hff
1 9t1i.::1 PF.: I NT "Hm·~ MF1t··1Y CFIF.:n:: DO You ~·JF1MT "D$;
1910 P4 =0
19i:'.t1 IMPUT P4
1 ·:.i::::€1 IF P4=~3 GOTO 1990
194€1 IF P4=>6 GOTO ::.:;:[160
l 950 FOP C9= 1 TO F'4
1960 c;o~:;uB E'.160
1 970 MD<T C9
1 980 GOSUB 277(1
1990 IF H=4 GOTO 2920
;::(~c10 PPIMT"STEP BACK mm HA'..JE
11 E$" :::TEP UP. 11
201(1 PPINT
E'.Oc'.t1 PF.:nff r:;.;
c'.03(1 GOSUB c'.B6(i
E'.040 PRIMT

781
I t·iF·~JT F=~
;:~. 121·7~,
2080 IF P5 = 0 GOTO 2140
2090 JF P5 => 6 GOTO 3060
;:~ 100 FOP F 1 = 1 TC! r::·i:,

2140 IF H=5 GOTO 2920


2150 REM THIS IS USED TO DEAL THE CARDS.

2170 TfPJ = TCP)+C


;:'.1 ;E[i I) (5)
1
= C1
1:'.;:~i-~·na F.~ETtJF:t·~

c.:'.2;:'.0 PETUF:'.H
2230 N = 10•(1+~BSCr~3(N+WiJJJ
2240 FOR A=l TO N
C.'. c'.50 '.::: =I 1···IT 1. ::::;;:::'.. ·:)·;::1 9999•3:.:.:~:HD C'r') )
,:::C'.fr[i IF. ::.:: == ~~i C.lf).fi] E~C:::::~~1

2280 IF DlXl=0 THEN 2350


;:~2'3~3 F.~ = ~'.+ 1
;::'.'.3iaO IF F.'.<'S(i THDI ,::'.;=.~30
2310 FOR A=1 TO 52
IF DfA) =~ GOTO 2340

2390 ECP) = ECPl+1


2410 IF Q(Xl>10 THEN 2440

C'. t~. 4(1 c.: = i t1


24':i0 F.:ETURM
E'.46(i F:'.EM THI::; P1=1PT IS 1_1:::;ED TO PF.:Hff THE CFIP.DS.
2 4 7(1 CiOSUB c'.5(1(1
c:~4.;::t1 1:;c1~:;1_1E: 2E,s~~1
E'. 4 90 F.:ETUF.:t·~
2500 IF QCXl<>l GOTO 2530
E:510 PRHff " HC[ ii;
c'.52(1 F.:ETUFJ·~
2530 IF QCXl>10 GOTO 2560
;:~ 54(; F·F-~ I r~1T C! f ::-:: ) ;
i.~'~::!50 PETUH-1

782
C? 1::4. i=1 F Et~1
1
F:F:t I! iT ·:·:;!.J J 1
2650 IF X>39 GOTO 2700
i:'.t:: t=l1 IF :=-::
1 C~iJT'C! 1::'.~·: ;::~~:1
1

2670 IF X>13 GOTO 2740


c: E:;=;c1 F·F.~ I t·1T ti ciF· '.~;F F·n~1E~:; 11
1

c:'.700 PF n-11 "oF cL 1_rt:(; 11

? 7 10 F'ETUF.'li

c:i 7 7(1 F=F.= r r. 1r 11 11


c?::;:(1 PPH"ff"t-·iOW'
;::·79t-i PF.:Hff" r F~ I!

C'. ~::; i~f(i F·F.~ I i"iT n


C:.' ::i 1(i F'F.~ I t·iT' Ii
c:'. ::~c~(1 F'F-~ I r-1-r 1'
'i'UUF'."
: :rn !Tl"
FTTUF'.ti

i:~ '31 fi F.~ETfJF.~t·,1


;::·92[1 PPHH"t·irn·~ \'CIU CET OHE MOPE CHfit1CF TO ITT \'OUf~· HAtms '.:;o BET THF.Jol HICH";.
c"?-3(1 It-iPUT i·i;::
c'.94(1 PPHff"DID F1rf1'ClllE TlF:'.C)F' OUT? ElffEF'. THE l·!UMI::EP OF PLA\'EF.'.S :::;TILL Hi";
c'.950 IMPUT H2
c'.96t~i Z = (~·-i'*'H) + ( ~·~ l ;.:i:H l :.1 + ( l·~2"1:H2)
•.:... 11 c
C.'.970 F'PHff "THE l·.iHH!FP CET'::; THE ~·JHOLE THHIC; L·!HICH E; ..:;· :. :::_ -,.

c'.9B0 PPIMT
;::·990 PPIMT "L·iAHT AnnTHEP HAtm nYPE -.,·c:; op tm:i 11 ;
3000 IMPUT 0$
:::lHO IF ()$ = "IK!" GOTO :::130
:::020 F'PHff 11 AF.:E THE '.:;F1ME: PLR\'EP::::; rn THE GFtME !TYPE YF·::: OP no:i 11 ;
J030 H1PUT 0-?
:::(i4fi IF CJ$ = \ E:~?-; ' C~1]TC1 75(1
11 1
1

:;:oso IF 0:$ = "!·\Cl" COTO 3?(1


JOE.(1 PF.'Hff "::;o ::;OF:'P\' CHARLIE ALL \'OU Cfill DF'rn·~ r·:::; FJl)E ! I ! FIUt: THfiP ·:::; f!L ..L"
:::070 PF.'.Hff "k.!At-ff TO TP\' FlGAH1 11
3080 IF Pi =>6 GOTO 1460
3090 IF P2=>6 GOTO 1600
::: 100 IF P3=>6 GOTO l 7 1:);1
3110 IF P4=>6 GOTO l900
3120 IF P5=>6 GOTO 2050
:::130 nm

783
POPUL:
DESCRIPTION
This program calculates and prints yearly population projections for an
area. The projection may be printed for a number of years, up to 99. The
program uses compound interest formulas to generate the projections.

USERS
Individuals interested in the economics, social problems and growth factors
of an area will find this program very helpful. This could include civic
groups, home owners, engineers, environmentalists, and local government
consultants. The area of interest may be a fish tank, back yard, or entire
city.

INSTRUCTIONS
This program requires no special initialization prior to execution, just
load in the program and type RUN. Popul is self instructional and will
request all input necessary for operation. List the program for additional
program information.

LIMITATIONS
Popul will require 3K Bytes of memory for storage and 5K for program
execution. This program should execute without problems in most 4K Basic
compilers.

784
F'ClF"! 11.

1 ;::OPE l·I F'i 1F>Ui .


:I ! !21F:'EM

1 'l!~'.lF.'[i'i TlF::-:cF I PT I Cil+ -f:!l"li".IMG THE MAH\' FiF'PL. I CfH I ort~:; ClF THF. r.:·cw1Pot ltffl
l ;::;oPEM Ii i !E.F'.[:::;T FOF'MUL.A 1'.:: THFn· (IF. F'OF'ULfiT I Otl
icoF.EM Pi:;:·n_11=.:cTro11. 11 L:: i1cir FJ·iTI~'.ELY F:ccuPF!TE.. Hi
1 ?CF.'.Et'i n If !T IT !"'."j•:;'.=:uMc:.: ::-:: (·:TF.Fl [I\' 1 i!CF.'.E:fi:=:E: DiCH \'[FiF' =
1 ?'SPEM F:!.!T IT F: i.F:FFUL FOP ~~:HOHHIG F'.OUGHL\' Hrn·! At·!
i::x:1F.'.EM !!F'.F.A !'1ILL l.HCF'FFr::r' • • THI·::; F'F'OGF'AM !·HU...

1 ·;1~iF'EM
c'.l?!!~.'IF.'.EH I 1··1'.::Tf?U1~:T I ort::-·-T\'F't: , F'Ut!, 1:-::t·m FTll.LOl-.1 Itt::TF.'.UCT Iott::.
,:::[i5F.'EM
;::'.1 tiF'.EM**:i:i:**-*-***'i:,::i;i::,;.:;.;i::i:i::i:i:;.:i;;.;i;:i:>::<i::i::.::;.:i::i:i::<>::<>::.:i:;.;i:*.:<i::i:i::i:i::i;.:;.;i:;.;i::i:i::i;.::i:i::i:i::i:i::i:i::i:i::i;.::<i::<i:*:<i:*-:<i:**-;.:i;**:i:i:*-:i:i:*'*':<i:*-:<i:*-'i:i:
;:· 15 D IM F l 00)
::'. 1 7 DIM Z 1 0~))
c'.c'.i~'! PF: It-ff JI TH I:::; F'PrlCF.'.Fit'I ~·11 LL. F'PO.JECT F>OPUL.Fn TOM GPm·ffH FOP At-I'/ t 11. IMf:ET OF JI
c-::;o PR I MT JI 'r'EF1P'.::: t. J:: I t·1c THF:: coMPOUt·m r r·ITEF:'E'.:::T FOF:'M1JLF1. "

;::: ?O PP HH
!:~t:1 FtF.~ I t·iT
1
;:. •

c'.90 PPHlT "F'F.'.H·IT THE: f'."itit·IUAL PEPCEtff OF GF.'(i!·!TH FTiP \'OUF.'. F'OPULATIOt·!";
J(10 I t··iPUT P
~:::: 1 ~::; t='F.~ I t~1T
::=:;::'.O F'F' IHT !I FOP HCIU nm I\' 'r'E~F1P::: DO \'CU l·I J'.::;H TO HF!' IE DF!TA COMPUTED II ;

:;::::o HIPUT N
:~:~.q1 l_ET I =t2!
,::::~[;LE~T A ::=: t···I
::=:t.o LET Ac'. =" ~l
370 IF A < 9 THEN 570
380 IF A = 9 THEN 590
J9~) PPIMT "LI'.::r T!-lE FH:sr ·:;i \'EAF.'.S TO HE CCll'"IF'UTED~ SEPFiPATE 'r'OIJP rH.iMI:EFSJI
::=:91 PF.:Hff Jl~·HTH COMt·IA'.:::. JI
4~::'n) GO TO 5C)fi
4 1 (I PF.: I t·ff
4c'.0 PPHff
4::=:c1 PF.'.IMT JIL·~HAT J:::; THE 'i'l'.·:::F!F.' FOP \'OUF'. t:F6IC T!F1T1=1 11
;

44ti HiPUT B
45(1 PF.'.Hff
460 PF'. HH ~.j~IAT JS THE F'OPULAT I OM FOP THE: F:n'.:::;[ \'EAF'. i t·K1 COMMf.1'.:: F'L.EF!'.::E) "
11

4 7(1 I t-iPUT F'


4:::0 PF.:IMT

785
490 GO TO 6JO
::;on I !·iPUT F' (I+ l) , F f I +i:::'..) , F (I+::::) , F (I +4) , F ( I +5) , F" ( I +6) , Ff I+ 7) , F (I -i-::::) , F ( I·+ 9)
~:; 10 LET fl =: A-·9

•::, ·~:O IF Fi < 1 THD i 4112!


540 IF A ! 9 THFN 605
~:. 4 5 PF.: Hff
:?:K1 PPHff "LI'.:::;T THE HE:::O::T 9 '/EF1R::::: '/OU 1_.1J'.:::l·I COMPUTED"
~~i6(i GO TO 5[10
':i?(i PF.'.Hff "LE:;T THE "; t·i; "\'EF!F.:::::; \'OU LH::::;H COMPUTED rn·m"; 9-l'H "ZEPO::::;"
5 71 PR I t"iT "·:EPAPFHE t'·ll.JMBEPS ~·~I TH co1··1MA::::;. "
5:::::0 CiO TO 5~::t0
'.:i90 PPHiT "LI'.'.:;T THE FIF.:::::;T 9 \'[F!P::::; FOR ~·JHICH '/OU !;HSH PPO.JECTiott::::"
~)91 PF:Hff "'.:::EF'F!PFITE: THE MUMBEF.:S MITH COMMF1:::::."
600 GO TO ':iO~~
605 F'PHff

6'50 PF.: IMT


660 F'RHff A$:

6 :;:::r3 PP Hff " DFHE POPULflTIOt"i "


690 PPHff
780 FOR M - 1 TO N
710 LET X - l + (R/J00)
720 LET Y - XtCFCMl-B)
730 LET Z CM) = INT CP~\'l
740 PRINT FCMJ,Z(M)
?60 PRINT
770 PPIMT
7'.::::0 am

786
PROFITS:
DESCRIPTION
PROFITS is used to analyze the profit from various departments of a company.
With slight modification this program can analyze various household expenses
such as: phone, heat, light, groceries, etc. versus income. For business
use the amount of inventory and its' rate of change is taken into consideration
when determining the profit or profit margin.

USERS
Individuals who are cost conscious put this program to good use. It could
be used to analyze house-hold spending versus income. These results could
be used to streamline or trim the budget. Businessmen as well as efficiency
experts could benefit from using this program by increasing their departments'
profit margins.

INSTRUCTIONS
List the program for detailed instructions. Profits is self prompting and
will request all needed information while executing.

LIMITATIONS
The TAB ( ) statement is used throughout this program starting in line
320. This program will store and execute in 4K Bytes of memory in most
systems, excluding the amount of memory required to store the basic compiler.

787
i1
1 ,:'F:'E:H:.;.::i;i;:,;;::-:;.::~;;~;;:::;i::,;.~:.;.::i;i::.;;::,;.;:i:i::i:i::i:~:i:i::i:i::i:i::i:-.::.:.:****-**'i?:**-*-'l'l:*:i:i::i;.:;i;;:;.:;::i:i::.;.;:i:i::i:i::i:i:.:i:i::i:i::<i::i:i::,;.;;.:i:~:,;.;:i::~:i:i:**:<i:;.;i:**
14F.'EM
15RE~ DESCRIPTION: THI::; BR'.::;rc PPOC:;F.'.AM COMPl.ITE"'.::; F'POFITf;:iBILIT\' OF
16PE.M nEPRPTMFNTS OF R FIRM.
1. ?f~'EM

;:~i)F.'.El1
E:C.:PEM I n'.:;TPUCT r mt:;--- TYPE "Put·1" TO t1'.:;E
i'.:'.4FTM \''F'OGPAM lH LL m:;f< F"OF' r··!UMBE:P OF DEPAF.'T-
c'.6PEVi !·IFliT'.:;, ::;ALE'.:;, BEC I !··1!"1 I t·K; I \·jl.)[tffOPY, nm I t·K;
.::~ :::F~Et·:-J 1 tillE!lTCIRY, i=1HD Pl.IPCHfY:'.:Es
·~: i:.1.~~:EJ·1

1 •;::io PP r nr "HOH !"!Htr:· DE:PAPTMEtffS rio \'OtJ HH' JE" ;


i 1 !Z.i IHPUT D

140 LE:T D9 ::::: 100 :.;;: 30 :i:i: P9


1 ~=,(1 PP r nr "coMPrn !\' t·1AnE: 11 ;

II

i ;:;:~~! PPH!T 11
FOF.'. EFICH DE:PAF.'.TMEMT EMTEF'.: II
190 PPHIT " :;::;1::1L.E:::;, HEGH·lt"Ht·iC H1UElffOP'/, EliDHiG IMt.IEt-ffOP\', F'UPCHF!SES 11
;:::.oo PPHff
.-, i .-.a
1:, .i. r-.:! FOP ti -·· t
E~ c.:~~1 PRil·ff M;
C.' :::o I MPUT ::;; f i""I) , f: ( i"-1) , E (I""!) , F' ( t·i J
c'.40 LET CU·!) -· f'i:t·-1) + T:!J·i) -·F!TD
250 LET GCNl = SCNl - C(N)
z:: i:1 fi t·iE:=·::·r 1·· 1
~~I ·7~) F'F:~ I ~·iT 11

II

~='. :::o
pp I MT II·----------··-·-·-··---·------·----·-·-·--··-·---·-·----·--·---------------·-·---··-·---· II
PPHH
C.'.9(1
JOO PF.'.IMT C$
::: 1 0 PF.'. I MT
3i:'.0 PPH!T TAB f 46); "C~:os::;" 1HB i:s::: "~-~ GF:'.O'.::::;"
3:30 PPHff TfiI:(10); "SF!LF.5" TABf22 "C..···c; ....::;;";TflE:C34); "~·;;c..··e; ..... '.::;;";

788
3~0 FOR N = l TG D
.3~::i~1 F'F?I\"·iT 11
IH::F'1" 11 ; r·-t;
380 PPINT TABC10) ;SCN);TABC22l;CCN);
:::90 PP I t·ff TAf: f :;:4 l ; Ir IT f 1 i21(100*C ( H) ..··S ( H) + • •::;) / 10!2!;
400 PRINT TABf46J;GCN);TABC58J;INTC10000~GfNl/S(Nl +.5)/100
410 LET ><
_.. "· ·+· -... I !-! )
' ...-
·-· '"i ' -+ l- ( 1·1 l
:~1.·:;:(1 LE1·· Z :::: + '-~- f II !
-1
:;~

1
=l 1:+C1 ~-E~T i:.l - i) ·: r:· . i I° ·i .,
;:l~)C1 t. u::::<1" f'·-1
1 ~- ~::~:1 f>F~ I t·iT

480 PRINT TABf46);?;TABC58);INTC10000~Z/X ~ .5)/100


4· 1?:i(~ F F~ I t·iT
1

'5 ~Jr~ F: F.~ I t·i 1·


::; 1 ~i Fri:;:: I t··iT
::;;:::0 PPHH TA.F:CHfl; "F'FT:CEHT";TABC:'.2); "F'tPCEt!T";TFff:C34l; "PEPCEtff";

580 FOR N = 1 TO D
~591:1 PF-:IMT "DE:F'T"; r·i;
600 PRINT TABC10J; INTC10000•SCNJ/X + .5)/100;
610 PRINT TABC22J;INTC10000*CCN)/Y + .5)/100;
620 PRINT TABl34J; INTC10000*GCNJ + .5)/100;
630 PRINT TABC46J;INTC10000*ECN)/W + .5)/100;
640 PRINT TABC58);INT ( D9•C CBCNJ+ECN)J C2•CCN)J

6::;;(1 PR I HT II OU[Pf!LL I t·\l.)EJ!TOF.:Y TUF-'.NOUEP II ;

690 F'F-'.Hff INT i:n9:i:i: U·J . ·""c') +. 5) ..·"H:::;0; Dfl\''.:'.;" 11

?0~:::'! PF.'.Hff
~'? 1 f~i FSF.~ I t·iT I! _.. ___ ., _ _ o _ _ , . . , . _ . _ . , _ .. _•-·--'•----~--
. . - - - · - - - - - · - " - ' ' " " '. . _ _ _ _ _ _ _ _ _ _ _ ~----·~,-•--•~-- .. - · - · - · . .- - • - · - - · -
11

?\=:'.i~i Et·iI~

789
l ?.·.::::fJi~:11J;;::11J, 1 ::l,~::=i~.:1t::i('.iC1, ~~: ::1(11:.:li~=1(1, ,:::(1i;:11~.'.1C1i::l
2 ,200000

~" !
F·!~,·c1i:· IT

4Cn;'1CIOI?! ···· :I l~'H~'llc'! (lic'i


;:: C! C1 O1::'11:::1 l c:;c1 CiiJ
u '! i::'l 0 (II~'! CJ
:DE~F'T' 1;::, i;::l !~:! (l ~:1 i2l J. n iJi:'.:l ·-:!. l'!('!!;'!i'.:'ll:::,

:::·1~ . F'CEI IT F 1 E.h'.C:E~i'·-i"T F'F!?CFI rr Dt:.:i\':~~:


C!F ::;F·:LF ::~; OF (:..···e;..... :;:; I ::p .IE! iTUF:'.\' Ii ·IUEJ fTC!!~~" r'
77
D[F'T 1 a I I

I1F:F·T
DEJ>T
,, ..J

a -~::1
.~~,

;;: r::;('I

790
QUBIC:
DESCRIPTION
This is the game of TIC-TAC-TOE in three dimensions. The game is played on
a 4x4x4 board. The playing board may be printed before each move, if desired.
This is a very complex game and it will be extremely difficult for you to
beat the computer, although I have seen it done where the player solves
the algorithms with a calculator before each move.

USERS
Game enthusiasts and problem solvers will find Qubic both challenging and
interesting.

INSTRUCTIONS
Type RUN and Qubic will ask you if you want instructions. Each move codes
a 3 digit number specifying the level and location of the move. All necessary
prompts and instructions will be generated by the program during execution.

LIMITATION
This game uses two dimensional arrays; see line 315, throughout. The source
code requires 7K Bytes for storage and will execute in 12K.

791
IHJ C

1 ::OF:Ei"'I DE:::cPIPTIO!i-·-·THi:: PF:or:.;i:;:F'l!"l PL.RY:::: ]-·DirlEl'!SILlNF-lL TIC-TFIC-TCIE ClN Fl


140F.'EM 4:=<4>0::4 E:Oi'0!FD l.i.!!TH T:-iE US~Ei:;:. THL LJ:::~r::i:;: C'F~N l.i.IIt·~ IF HE PL.RYS [''.OFi:FEC:TLY.
1:soPEM
16tiPEM
1 ?'(IF.'.EM
i ::a.)F.'EM
190FTM
C.: ::;:1(1b:'.EM
c.: 1 o PF: I t·ff 110 \'OtJ 1. ~m ff r t·E:;TPUCT r rn·t:;" ;
11

;:'.;::o I t··IPUT C$
c:::::o IF C$=="t"l0" THETI :;::;::O
Z:'. 40 IF C:$= II \'E::; II THEt"I ;::65

C.:60 GOTO 2E:0


;::65 PF.'.Hff
Z::?0 PF.:Hff "THE: CflME J'.:; TIC-TAC-TOE IM A 4 ;::; 4 :=< 4 CU:t:E. u
;:::::ti PF.:nrr "EACH 1"'101.)E 1::; HHHCATED I:\' f"i J f!IGIT f"iUM:BEF.'., HITH EACH"
c:: .:::io PP It-ff 11 DIG r T t:En1En·1 1 1=iHD 4 HiCLU'.:; n.1r.
THE n I Gr T::; nm
I CATE THE 11
::::oo F'F.'.Hff "LEUE:L, POf.·h i=1MD COL.UMt·h F.'C:;P[CTF..IEL."1", CJF THE OCCUPIED"
::::05 PF.'INT "Plf!CL "
:::: ~::16 pp Itff
307 PPHff "TO PPHff THE PLA"r'IMG BOAF.'D, T'i"PE (1 C2'.EF.'.0) F!S YOUF.'. MO! I[. 11
::::o::: PF'.IMT "THE PF.'OCPFIM MILL. PF.'.Hff THE BOFtF.:D ~·HTH YOUF: MOl)E'.:; nmI- 11
::::09 PPHff "C:fffED ~·HTH 1=1 f"i') :i THE MACHI ME''.:'.; MOUES ~.UTH AM fM), Atffi"
:::: 10 PP Hff "ur·iu::;ED SC!UAPC:; 1..u TH A i: :i • "
311 PPINT
3 12 PF-'. Hff II TO ·:;TOP THE F'POCRAM F.'.Ut·!, T\'PF 1 r=i::::; \'OUP MOUE. II

320 FOR I =
1 TO 16
33(1 F::EAD "i' ( I J
3.:~o t·iD::T I
35(iFOF.'. I= 1 TO ?'6
]60FOR J =
1 TO 4
3?'(i REAllM f I, J J
3:;::(1 MD=:T ._!
390 MD=:T I
400 FOR I =
i TO 64
410 LET X CIJ =0
420 t·iE::<T I
4:3(1 LET Z=1
44fi PF.'. Hff II DO YOU ~·~At'ff TO MOUE F ff:'.::;T II ;
450 I MPUT '.::::;:
46(1 IF :::;$="t·iO" THEN 6:30

792
•i· ?0 IF ::;$::.-::II '/E~:::;" THFJ I 500
4;:::0 PF.'Hff "HiCOPFTCT ntt::;t,~ER. PLEA:::E T\'F'F Pnr"f'c:a?EM OP F.'.EMt·!OPEM. ";
:::j. ::-1(1 C~C1TC1 4.5[1
1

~:=;00 PRHff II II
r::; i 0 PP I t·ff 11 \'OUk f'!()l)F" 11 ;
•:=; c'O I t--!F'UT.J 1
521 IF J1=1 TI~EN 2770
•::=;;:'.2 IF J1 <>O THEN 525
~:i ;:: ,:::1:;;ci~::1J:B C'5~i(I
~:; c'. 4C:iOT050Ci
~.:;;:;::5I FJi <111 THErii:'.?':'iO
526IFJ1>444THEN2750
i::;::::zi c;o::;uB E'.500
:=4c1 LETK i =I !ff ( .J 1./ 1CHJ)
550 LET J2=CJ1-Ki•i00l
560 LET K2=INTf 10)
5 T~iLET K~3= J 1. ... rU. :i:•: 100 -+:z~q 0
580 LET M=16•K1+4•K2+K3-20
"590 IF >=: U·i:! =O THEt--1 62(i
600 PRH-ff "THAT ::;@Jf=1PE IS U:::;ED, TP\' AGAIN"
6 1 0 GOTO 50(1
LET ;:-:: (t·1) =1
t:,;~t1
GOSUB i 64Ci
6:~:0
640 FOP .J=i TO :::
650 FOR I=1 TO 76
660 IF J=1 THEN 720
670 IF J=2 THEN 790
E,:::(1 IF..J=::.: T~-IE~t·i ·:;t::~:(1
690 ND::T I
7titi f-1D::T.J
7l0 GOTO 1300
720 IF LCIJ<>4 THEN 690
FOLL.rn·l~::
11
73Ci PRHff "YOU hlit-1 ff:; ;
740 FOR J=i TO 4
750 LET M=M r:I, .J)
76ti G0:3UF.: i 57'ti

?:::o GOTO 14'30


790 IF L(l)()15 THEN 690
::=: ~30 FOR .J= 1 TO 4
:::: 1 0 LET M=M ( I , J)
820 IF XCMl<>0 THEN 860

840 PRINT "MACHINE MOUES TO";


:::50 GC6UB 1570
::: 6ti NDff ._I
:::·?[1 F F.~It--IT 11 , F1t·iI1
1
~1 .Jit·1~=; Fi~:; F1]LLCtL·J~:: 11

:::80 FOF.'. .J=1 TO 4


::=:9(1 LET M=M (I, J :i
900 GOSUB 1570
91ta ND<T J

793
·::i;:·o GOTO 1490
9JO IF' L.CT:t<>3 IHFJI (:;::10
940 r'F::It!T"MIC[ TF:"r' t·!FtCHiti[ MOUE'.:: TO";
950 FOR J=1 TO 4
978 IF XfMl<>8 fHEN 1010
:;1 ~::: i~1 >=: ( i•t1 ) == :=;
1

:.1 :)[1 C;C1':;;JJ::t: .15"?(i


1 1

l (1~~ili SCt(t
C~C1"T"C1
l ?2i 1~z~ -.J
!"olE:::.::~r
1 0!'.::ia GOTO 1 30(i
1 :21::::c1 FOR I = 1 TO 76
1:2l4(1 LET Lt:I·1=;:.:;(i·i(T, ll ·1+':0:(M!I,E'.) :i+:<1YifJ,:;:::i l+>O:t:M(I,4l)
1050 LET L = LCil
1 2i;::,(1 IF L <c'. THE]i 113lZI
1

107(1 IF L THEJ! 1 1 :;:o


11~i::::t1 IF L>;:: THEJI c:·.z~:~=:o
109i?I FOR .J = 1 TC! 4
1100 IF XCMCI,JJl<>0 THEN 1120
1110 LET XfM(I,Jll=l/8
1 120 ND::T _!
1 1 3(i ND·ff I
1 14~".l GO~::UB i 640
1150 FOR I = 1 TO 76
1160 IF LCil=1/2 fHFN 2360
1170 IF LCil=1~3/8 THEN 2360
l 1 ~:~0 t·iE>=:T I
1 19;;::1 COTO 1 :::30
i C:'.OtiLET Z = 1
1210 IF XCYCZJ)=0 THEN 1250
1 ::'.;::121 LET Z=Z+ 1
1230 IF Z<>17 THEN 1210
1,:'.'.4ti GOTO 1 '?20
1 ;::·so LET M='r' CZ)
1 ;=~~,~:::t LET ::-:: f t·1) =5
1 ,:'.71) PRIMT "MACHI ME' MOl.t[t; T0 11 ;
1 ;:'.8t~i GOSUB 1570
1 ;:"30 GOTO 5titi
1 :::c1n LET ><=>::
1310 FlJR I=1 TO 76
132ti LET L (I)=>=: f M(I , 1) ) +;=< ( M(I, 2) ) +>=: ( M( I, 3) ) +::·:: (M( I, 4) )
1 3::::0 LET L=L t: I )
1 ::;::40 IF L< H3 THEl1 i 410
1350 IF L>=11 THEN 1410
1360 IF L>10 THEN 2230
1·;::7f1 FOF.'. .J= i TO 4
1380 IF X(M(I,Jll<>0 THEN 1400
1390 LET XCMCI,J)J=l/8
MD<T .J
14(1(1
1410 NE>::T I
1420 e;o::;ut: i E4~~

794
1430 FOP TCl ~?(T

1 44~2i IF L I =. i:; THD! ;::360


IF L I =:~!-r·o::./;~! l··!·-!Et"i C~::]E,(1
14E.li MD<T I
1 4 70 C:iO'.:;;IJt: c'.50('.1
14:::~?i GOTO 103~j
149[i PF.'.INT !I II
i ;:'i[i(i pp If-ff II DO \'OU ~·ifltff TO TP'r' AMOTH[F:' CAM[ II ;

1 '5 10 I tlPUT :=<$:

1 '.:i:30 IF >=:::;:="MO" THEJi 1560


j '540 PP I MT
11
INCOPF-£CT F!ti'.:;MEF.'.. PLEA'.::;E TYF'E PEM\'E'.:;REM OP PEMt·K1F.'.EM 11 ;

1':i50 GOTO 1510


l 560 ::;TOP
1570 LET K1=INTf CM-1)/16l~1
l S:::o LET .J;:_·=M-· 16=Q: f I< 1-1)
j~qR LET K2=INTCCJ2-1)/4)+1
1600 LET K3=M-CK1-1J~16-CK2-il•4
1610 LET M=K1•100+K2~10+K3
1620 PPit-iT M;
163Ci RETUF.'.t-1
1640 FOR S=l TO 76
1650 LET Ji= MCS,ll
1660 LET J2=MCS,2l
1670 LET J3=MCS,3)
16:::121 LET J4=M t.·:;, 4)
1690 LET LCSl=XlJ1J+X(J2)~XCJ3)+XCJ4)
1 71 (1 PETUPt-l
1720 FOR I=l TO 64
1730 IF XCIJ<>0 THEN 1800
1 74~3 LET :=::CI) ='.S
1 7.::;r.1 LET M= I
1 76ti PF'IMT 11
MF!Uiit·iE LIKES";
1 ?7(1 CiC6UB 1570
1 7::::0 PFU MT II II
1 ?9(1 GOTO 5(10
1 HtiO MDff I
i:;::: H3 PP I MT "THE GFiME E; A I!PA!,J"
1 B2(1 GOTO 1490
1B30 FOR K=1 TO 18
1 ::::4(1 LET P=(1
1 :::5~~1 FOR I =4:<i:1<-:::: TO 4~K
1 at.ti FOR .J= 1 TO 4
1:::7(1 LET F'=P+>=: (M (I, J) )
1 ::: :::(1 MD<T .J
1 B9(1 r-1Dff I
1900 IF P<4 THEt-1 1940
1910 IF P<5 THEt-1 1970
1920 IF P<9 THEN 1940
19:;:(1 IF P< 1 (1 THEM 19nj

795
=
!=l
((t l,J) I-·
( 1) if) C1
~ o:i
f"- (.{') !=.i
t~i ( 1
:1 if) !'..(• ....;.-
(IJ ... ...
... ".!) tj-
w ~
~;
..:;..
~ 0 m ~
0 --- NMtj- NM v v ru - E w
"::I" "" lf:i (•) •.[I "D •..I) - •.D •..J) If) ... "D OJ :z:
-000m ---~~-~~-voov-m w 1-•I
~---
ru-tj-ru -~~oo-oo~--m~ru~-­
~tj-tj-tj-~mmo~~----~
z::
1-1
::c
(.)
r. f"- ( ~1 !f) 1
.,.. ... w. r. lf) ... ... •.,() lf) ... -::t (S) r··- (•) C•) I
ru---
v-0-
m0-ru-vm--oovtj-v·-
~0000mm~vm---~~
C•
1I
fE
... •..() C•) If) ... ... "" ... Li") "" ... I.!"'.• If) ... ~ •~IJ (S) ·i:t CU E ...
~--- ~~m~-o--~-rum0-­ w
ru~~~ ru---~mm~~~-~~~0 E
.... IJ .I 1, I !J .!
I c-. ... r. l.i I tj'-
... ... tj' IJ l I, ! l.j_t .,.....
u-. ~.r ll'o t 1-l
oo--~ MOO~Q-~~--~---·· ((1 1--
M--~ -mm~~~tj-OOOOMM--ru- 1-l
M---
U'',
ru-Qoo
~:t· (•~! -tj·· r. sr. r. r . .,:-j'
~ruG~-ru0--~-ru~-­
no, r. -.:-j"" tj- r. i.i) f··- t~I ......t r,.()
m~tj-tj--tj-tj-~000--~ru

::c
~
Li...
l=I =
r. (1~1 (1~;
tj· a-, ·r,-j- r. r. "='J" -r:'j' r, ~ tJ'1 (1~1 (ij 'tj-
r, r. 11".
i::J::-
:::,;:: w
~ - - - -~~00-00~--ru-0~-­ l_i ( ..) E l.O
~-~~ ~rururu~MMQOOtj-0--ru0 1--1 1I en
ru---
tr. (tj (IJ
ru~~~~ru---~00w0tj-0--~v

"tj°" sr. D"• r.


mo-ru-~m--m-mru--
w. ( 1") R'· r. tj" ( 1) r, (tj
w, ..-! I, IJ tj• '-.LI rt'. r. r. ir•. !, i .l If'• go, I, I l 1, I J tr• r. "r.t lJ'1 (J ,I Ir'•

T"-i .J) 'tj"' (lj


1
=!
I-·
0
z::
w
(_'J
!'..(•
......
r-
G) :I' 1:S:1
"!) - ... ... ... 1:r" ·•::I" lf') o.J) ... 1=:;:1 - ... ... 1!.:i OJ - ... ... 1=1\ ('•"I 1-- i-:: :r 1'~\
--~m0-mmm~00rururu~-~oov (•:1 1.i,.I ..,.. I-· ·~f i:c:
-©ruv~M---ru--00--~m-- (I.I (.,;:I ..:;_, (1J :i:i: 1:S:1
~----~oo~~-~~--0ruru-000 1-·I l~(i
...,- (1j 1.1"'.1
~-~tj-ru-0Mtj-mruruoo~rutj--~ru0 z ~ w f'"':
I ·~j·
-~rutj-~~---ru--ruru--000-- w o ~ i::::: w..' I.!"'.• OJ
-~~--0ru0~-ru0-~~ru0-oo~ I
o > w ::r
((t
~oo~m-~rururu-rurutj-rururu-ru0ru ~ z:
~:
Y.
--ru~0----ru--ruru--oru--
0~--~ru0~00-oo~--0rum-0~ oo
~w
ruw
=·-:1 (..)
c;
7"
!-
......
LI...
Ld Li.I
!- :r:
·1:r --~ruo----~--0~ru--~m-
(U tj· \[I {f) (S) ...-1 0 j T""'t sr, c-. OJ -r-i er, -r-i ( "i 1r, rr. Ir.
11•, "..() 1
'
,..-.{ lf)
ruoo (...) ·""·
.,,.j-
(C1 1--
I=! '1~.r It'. a-.
Q". sr. Ir, ~() If) If) a-. "tj- If) ... r. oi::t- 1.f1 ...-1 (ij v <t::f' ....... Ii :z:: ((1 :: :: w tI ((1
i-- -m0-00---0--~0---m-~
ru-rutj-~~tj-m~-----~-m-~-~~~Iw
v~WE o
~~
z
r-.. 1
'tj·*' l
1n.-.
II
G mtj-~-~~000:0-~-~tj-ru~-0-=~~~
I--·.. -• ''"
-~ :c "··.
(S) j O"·r. l, IJ (S) !.,l.,l 1,' ,I a-. r. r. 1,.1 't -r-1 -ro-t I, lj -r-1 t.::.i_t r. a-. I,' ,1 -i:'j- \_I .I 1r, D"• 1:S) (...) i-1 \=i ~·
0000~0 0~0rutj-m0000Q-------~-~-~--mw00- f"... G: •!~• CO ·-· (S) !-- tr. (S)
~0'~~ 00tj--------rum~~---N000MN -~v~0>~ if) 1:S) :r::.:: 1J•1 ".., 1--- .,...., l-1 (S:t
OJ (•J -i--1 -i:j· (1~1 1::;:1 i:r·, .,, OJ ..--1 !J'1 r"- !"·- r. r. w. "· "· w. ((1 ··D ( w. .. •.,_. r. (1J "t"-1 ·-· E .-. :
1) t'.'•:1 :: E ...-• 1:S:1 :: -r.:i" '1'-t Z: ......1 >t:'.f' 1:U (C ·-· 1S:1
:::t::. --1 II ii (lj 1-1 Ii ·r--l ...-·i r. 1-tj (1 ~1 lf) or-I (lj ( 1~1 -i:j- -r-1 (IJ ( r. Ir'. •r-1 ..--i 1j·1 r. 1J\ r. II E ·-..· 1--1
1) (IJ Ii LO --:1 .,...; II 1-1 II (•J II II E -:· (•J
~ ~- oo - - ~- v-v-~~x~~ ~E C.LI i-·· (0 i (C •I -:1 ·-·
~~o o~ o~ ~~~-~~~~~~~~~~ ~=oz x -, ,-, 1- ~···Ir ,-·, i"-. ":·:" 1-- C•
xoo~~~~x~~~~~~~~~~~~~~~~~~~~~~~ ~ -~-~ if., i=:. ::-::
i-::i j'.:. !··- 1-... 1::. 1-·· ~ • .. ::.:: 1--·
WOOWOOWWO~~~~~~~~~~~~~~~~~~~~o~w~~o~w
=GG~~G=~0q~qqq~qqqqqqqqpq~~~~~-~-~G~~
•=• C1 LJ
(.'J CJ
O:~ C1
L.J i.J... W Ci W 0 ~ W C•
:z.:: 1:L CJ
_J 1-1 ,_J 1:,S ~ ~ 1-1 Z: c:1
q q qqqq
0000G00QQ00QQQQQQQQ0000QQQQQQ00 ~I !~I (S:t ~~I l~I l~I 1~;) (;~t !~I QQ0QQ000000
tj-m0~0000-ru0tj-m0~00~0-ru0tj-~0~00~0-ru0tj- u .• •. L• r"- '-'·' '-'" 1.,:,.1 .....~ C!J C•:1 tj-~~~OO~Q-N0tj­
00~00~00Qoo00000----------rururururu OJ Cu C<J C!J OJ C•) (•~! (:) (i~i MGrnMMM~~tj-tj-tj­
------rururururururururururururururururururururururururu (!j Clj CiJ (1j (ij (lj CU CiJ CU aj~~aj~~~rurururu
2450 LET XCMfI,JJJ=5
2460 LET M=MCI,JJ
C. 4;::~fJ c;cr=;tJt: 157f1
1
,

;:;:~ 4- i;t1-;:1 CiCITCt 5~:1~~1


2500 FOR 1=1 TO 64
2510 IF XCil<>1~8 THE~ 2530
c~::;:::[i r"iE>=:T I
;:'.'. ~~ 4li !:;;~ETtJF.t·~
;: 5~5~)FCIF.~ I= 1 Ti]4
1

;:::::;E.OFOPJ=1 T04
;?'."'i€:.2FOPI i =l TCU
25E4PRHff" II;
i::'. 5EiE.fiE>::1~ I 1
c'.~i7~1FOPK=1 T04
2600LET Q=16~I+4~J+K-20
2610IFX(QJ<>OTHEN2630
2S30IFXCQJ<>STHEN2650
II •

2650IFXCQl<>1THEN2660'
2655PRHff" Cl) ";
c.'.660IF >=: (Q) <>t . ·:::THEJ!c:6?0
;.=::665PF-UMT" ( II;

;::6BOPF.'. I MT
E'.6'3tiPF-'.IMT
c'.70t-iME:=<TJ
c'.71tiPRIMT
;::7'2t1PR I MT
;:: 7::.::ot-~C=<T I
C:: 7 4~3F-:ETURM
c.: 75i3PF.: I MT" I MCOPPECT MO'-JE, F:ETYPE r T--- " ;
c'. 76(iGOT05c'.(i
E:77tiEMD

797
DO YOU l-!AN'!' INSTRUCTIONS ?Y'f:.S

THE GAME IS Tl C-T.A.C-TO:::: UJ A li K' 4 X 4 CUBE·
EACH MOVE IS IiJDl CATEP BY A .3 DIGIT NtJMBt;:H.,, WI TH EAC~-i
DIGIT BET~EEN I A~D 4 INCLUSIVE• THE DIGITS INDICATE THE
LEVEL1 ROW1 ~ND COLUMU1 RESPEGTIVELY1 OF THE OCCUPIED
PLACE•

TO PnI~T T~E PLAYING BOAPD1 TYPE 0 CZERO> AS YOUR MOVE•


THE ?T-:·OG:)f.li-1 :~ILL PHINT THt: BOAR.D WITH. YOU:l ~-10VES lNDl•
C.i\TED FITE i\ ('{),, THE MACHX:JE'S l'iOVES WITH AN nn,, MW
Ul·JU~~LD S:)U/:1.~~E:t ':.rl TH A C > •

TO :::;TOP THE PnOGt.AH RlJN,, TYPE l f'l.S YOUR MOVE•


DO YOU !:.'HNT TO !'!OVE FI ~ST ? C
I NCOP.':~ECT t-;:~ 5r.ji!:f-:. ?LEASE TYPE r:ENYESrlEt-1 OE fU::i11JOnE:1. ?£".JO
MACHINE MOVES TO 111
YOUH MOVE ?0
CM> C > C ) C )

() () () ()

() () () ()

() () () ()

() () () ()

() () () ()

< ) ( ) c ) ( )
( ) ( ) ( ) ( )

( ) ' ) ( ) ( )

() () () ()

() () () ()

( ) < ) ( ) ( )

C) () (> C>

() () () ()

( ) ( ) ( ) ( )

( ) ( ) ( > ( )
RATES:
DESCRIPTION
This program calculates effective annual interest rates for various interests
with different compounding times.

USERS
Persons planning on spending money who may have a choice of financing plans
can use this program to determine the true or effective interest they will
be repaying, i.e. Businessmen, Housewives, Homeowners, etc.

INSTRUCTIONS
After the program has been loaded into memory type RUN and the program will
prompt for all necessary information.

LIMITATIONS
Rates uses two dimensional arrays; see line 530. Line 550 has a MAT INPUT
statement as does line 670. Line 770 contains a TAB ( ) statement and lines
490 and 1020 contain print using statements. The program will require 2K
Bytes to store the source code and 7K Bytes for execution.

799
1 to::;::D!
J ,:::OF:'EM

1 '.~;2u~~:EJt't F F1l"E~:;
1
C!F- I r-.1TEF.'.E~:;T .. .. II • :f

l t:.O?FM
170RE:M I ry:;TJ?UCT I O!t:;-·-T\'F'E , RUt~' TO !Y;:;[
l :::OF.'.EM T!·!PUT I·:=.; F'[OIJ['.~:;TED
l 9~JF'.EM
L::~'!(if?EM
;::: 10!:;'.'.EM;.;;:*-*'*''*'*-'*'**'*'*'*'*-:<i:*-:<i:'*'*-*:<i:**-*-**-:.:>:***:i:i::i:i::i:i::.:i::.:i::i:i::i:i::i:i::i:i::<i::i>::i:i::.:i::<i::.:i::<i:;i:.:~::<i::.:i::i:i::.:.::i:i::<i::.:i:*:i:i:'*':i:.~:,;.:'*::i:i:
2Z~fiF.'.EM
530 DIM RC20),NC20,20),QC20J~Z(20l
•::,40 PF'.It-iT "1·iOMit·IFIL F!Mt··IU1=1L JJ·lTFPEST F'ATD:;--·UP TO c'.0 I!IFFEF.'.Hff F.'.ATE'.::;"
~550 MAT H!F'UT P
~:; i::.~] LET 0 l =MUM ( ><)
570 FOR J=1 TO 01
:::;'.::0 IF F'. CJ) ::: • '.:'i THFl·I 60l7i
590 LET RCJJ=R(J)/100
600 ME:=<T J
610 PPIMT
E:. c::o PP rt-ff "rr=1c1-1 Hnt: ccw1POUMDEii HO!·J MF1t··I\' Tr MES PEP \'EAF.:?"
630 PPHff "FOP [flCH F'.FiT[ \'OU CF1n T'Y'P[ IM IJP TO ;::0 DIFFEF.:Hff COMF'OUHIJH·IG"
t.40 PF.:rt-ff "TH1c::; i:T\'F'E n1 A ZEPO FOP c0tff H·1uou:; coMPout·mn-ic:i"
650 FOR J=1 TO 01
660 PRHff "FOP "; 1[10*F.'. CJ) ; .
6 7~~1 MAT I r··lPUT Z
680 LET QCJJ=~JMCXJ
690 FOR K=1 TO Q(J)
700 LET NCJ,Kl=ZCK)
7 10 Ht:::ff K
.? E~ [1 t·iE:::-=:T CJ
730 FOR J=1 TO 5
7 41~1 PR It"H
750 tiD::T .J
760 PRHff "llOMHWIL. HMt·IUAL ~·~
11
;TAt:C::t.:i;
11
TIMES COMP .....ANNUM";
?7(! PR I MT TFfE: ( 51 ) ; II EFFECT I l)E F"iMMURL ~·;;II
7:::121 F·F~ I t·~T u --·--._.·---·-.. -"·-·~·-·-------- n ; TA:F.: r2E, :i ; 11
·----·-·-·--_, ________
11
;

?90 PR r r-n TAB i: s 1 :i ; " - -·-·----------·--------·--"


::H.::10 PR Hff
:=:: i ti PR I i'iT
820 FOR J=l TO Qi
830 FOR K=l TO QfJ)
840 IF NCJ,K)=0 THEN 900
:::50 LET r··l=t-1 (.J, ~::::1
:::6(1 LET P=P (.J)
870 LET E=100*CC1+R/NJtN-1l

800
~:: :;::[t L.E ~T· Ft::::t vf f .J ~ !-: : )
:::: ':;1 t~j Ci Ci T Ci t c~ 1 1~:1
900 LEl fEXPrRrJ)l-ll~1J0
·:.13(1 LET ? f _n =F' l_i) :.;.: 1;21C1
::1 1 ~· (i F:F.: I f··~T lJ~::; I f"·ii~ J 1 Cii~i, F:'. f .J J ; E
1

1010 LET PCJ)=RlJ *100


1020 PRINT USING 110' PCJJ;A;E
1030 LET R(JJ=RCJ /100

l ~2!50 F F~ I t·11-
1

l l2tE:~~{ t··~E>::T ..J


11 ~~iC~: ·R::H:# :ff.##
a ·~(: tf # = :f.F:fi::R: #
l i 1C1: ###. :B~## i; f~::~i::fi:#

801
[flCH Ffff[ COl·!POU! lf1LD HOi·-i !·1i=:1nY TI!"!['.:;;; F'LR YFJ'.1R-~:.
FOR [flCH l?i=tTE YOU cnr--1 T\'F'E:: HI UP TC! ,:;::o DHTF:F.Elff COt·IPCIUI iD I I IC T PIE'.::;
CTYPE IN A ZERO FOR CONTINOUS COMPOUNDING).

FOR 12.61 ~21


FOR 12.98 ?30
FOR 6. 00 ?C!
FOR 6.50 ,4,6
FOR 12.00 ?12
FOR 12.50 ?0

1- !OM I 1-if=IL fll'"lt IUf!L "


1;::.610
1 ,:~ ':;1 ::: Ct
c

6. 01?10
1::1 II ~i 121 i~'.I 1:1 # i::,(~i~:;(:,
6. ':%:11a t:I II r:'.11::1e11:::
i:.. ~=:;oo t:I t.:I ~::'::~1:::1
st

1. ;? • O!~i(:I
1~=: ::;1211~:1
p C:Ot-!T. CC!MF'.

802
RETIRE:
DESCRIPTION
This program computes the rate of retirement pay for a civil service worker.
It can be modified to generate retirement schedules for other plans as
desired.

USERS
Persons desiring to plan for their retirement will find this program very
benefical. In addition to providing you with a retirement pay schedule it
can be very useful Now in planning or deciding which job to take or what
potition or level of current income to work towards. While this program has
been set up for government workers it can easily be modified to encompass
any retirement plan beigh offered by an employer.

INSTRUCTIONS
Upon execution the program will ask if you want instructions. Type 1 for
Yes or 0 for No. The program will request all necessary data as needed to
determine your retirement benefits.

LIMITATIONS
Starting in line 1020 the DEF FNX ( ) statement is used. In addition the
PRINT USING statement is used extensively through out this program. RETIRE
will require 6K Bytes of memory for program storage and will execute in most
BK Basic compilers with 7K Bytes of available memory.

803
T'r'PE 1

1090 IF Tl = 0 ~OTO 1260


1100 F'F' I hT "-·--FiL L Dffffl aff PI t.-s AF'.L nuMEF' I CF1L HMD ::£PF1PATED"
l l 113 PF' I NT " COMMfl'.::; L,iHHi THEFE I'.:; MOPE THAt-1 Of·IE ElffF'.Y 11
i L::0 PF' Hff "---f:!LL L!f!TES APE r'iOf-iTH, IJffr', 'r'[AF'."
i l :~;0 PF'. I !"iT
1140 PF.: nrr "---THE Et-ITV/ FOP not·iTH; DA''!', '/EF1P, ::;ALAP\': 11
1 i ~!7i F'PHff !I -f:il?E F'FI\' CHfiHGE DATE'.:; ~·HTH APPPOPPIATE '.:;ALAF.:Y; 11
1 l60 F'F.'Hff I!-EJ!TF.'I['.::; APE TO BE IM PEJ.l[F.SE CHF.'.OMOLOGICAL OPDEP; II

.1l7'!2! F'FHff " -·l,lHE:t! THF.'F.::E YEAP PEF'.IOD I:::; OBTF1IMEI1,Et-ffF:\' t·HLL"
i i:::a~i F'F' Hff " 1=:uT0t·lfiT J c~ALLY CUT OUT Ii
l 2~)0 F'F'IHT !l _ _ _ •:;UF'.l)I'.IOP At"itiUITY TO CHILDF.'Et-1: II
L:· 10 FF' It-ff " ·-TO Ci!_lf!L I FY '•'OUF' CH I LD nt!'.:;:;T: "
j ;;::20 pp I MT " --i=1. F:E. UtlDEP 1::: At·m BE unMf!PP I ED; OF'."
1 2::::121 F'P r nr " -t:. UHDEF.'. 22, UMMAl?P r ED f1t·m fl F'UL.L TI ME ::n·unEMT; OP"
1.:'.'.4!} F-'P Hff Ii -c. D L:;ABLED BEFC!P[ 1::::, H!Cf!PABLE OF '.:;ELF·-SUPPOPT. II

i E'60 PP I HT " Et'!TEF'-··--· 'BIF:'.THDAY"


l ;~70 HiPUT Mi, Di, Yi
1 ;:'.:::0 PF.'. H'ff
l290 Bl = FND fM1,D1,Yil
1300 PF.:Il'iT II HlTEF::--·- ::EF-'.l.JICE COMPUTf!TI!:it"·! Ill=tTE"
1310 INPUT M1,D1,Y1
1320 PPHff
1330 B2 = FND (M1,D1,Y1l
1:-:;:40 PPit·ff DffE:P--··-· F.:ETIPEMEMT DATE"
II

1350 INPUT M1,D1,Y1


1 ·=:i:=.n F'P I NT
1370 B3 = FND CM1,D1,Y1J
1440 INPUT Mi,D1,Y1
1450 PF'.IMT
1460 = B4 = FND CM1,D1,Y1J
l 461 PF.' I MT "Hrn·~ Mf·ltfr' CH TLDPEM EL I GI BLE FOP ::;!Jpl.,.1 r !)(IP Fit-1MU I TY II
146c'. I r·PUT E 1
146:-:'.: PPH-ff

804
l 1~1" 7(i F F~
1
I r-.11·
1480 PP I nr "E1·rn::i:c:-·-·-·-·MOtlTH, DA\', \'FAF.', :~;i=:11...HF''i'"
1490 INPUT M1,n1,y1,s
1500 IF S < H1 GOTO 1520
l 5 10
H1 ::: ·;:;
1520 B6 = FND CM1,11,y11
1530 W = INTCCB5 - B6)
1540 Wl Wl + W =
IF ~:.ij
1~i5~:1 >= 1~=:;t:1 CtC1TC1 i~!·:.-1~1
1560 Si =Sl + (W/52) ~ S

l •:;:;::;.:1 GOTO 1490


i 590 ~·~ = L·i -H 1 + 1'~;6
1600 Sl = Sl + CW/52) ~ S
1610 H = H2 = Sl/3
1620 A= A2 = (B4 - B2J/365
1630 A3 = CB3 - B2)/365
1640 G = CB4 - BlJ/365
1650 Wt = 20075 + Bl - B3

1670 W3 = Wl -~2~365
1 E1:=:0 F = l,J;::~* 1C: -+· I r··iT ( L:i::; ....-~::l1)
1690 S4 = INTCCB3 - B4)/7)
1700 85 = CHi - HJ ~ f(S4 + 78)
PEM--·-
172[1 PEM---·
H :::-; H;:'. =" HIGH THF.:EE \'EAP Al.IFF.:t=!GE ::;flLflF.'.\'
173~] A = A2 :::: '/EAP::=; OF ::EF.:U I CE R·:; OF TOD fl\':;:; DATE
F.:EH---
174[1 FEM---A:::: = \'EAF.S OF SEPUICE TO PETIF:EMEtlT DATE
1750 F.EM---
G =
\'[F!F.'.:::; OF F!GE
176(1 F = t··IUt'l'F:EF.'. OF MOMTH'.:: UMDEP ~i5 F!T l?ETIF.'.EMEt·ff
PEM--·-
1770 S5 - ESTIMATED HIGH THREE ALJEPAGE SALAF.'.Y
F.:EM·----
1 ·7~::!€1 PEM TO F'.ET I F-£MEtff DF!TE
17=:.-tl1 F.:EM--- :;:;4 = L·IEEJ::::; DIFFEREHCE BE:Tl..~EEtl TODAY AMI! PETIF'.EMEtff
1 :::,Jt1 PF.: I t·ff
1801 IF T9 > 0 GOTO 1876
1 ::: 40 PP I t·ff u::;; I t·iG l :::~:; (i, H
1850: HIGH THREE AUERAGE SALARY IS$######.##
1 ::: 60 PF.'. Hff
1 :;:?(1 PR I MT U:; I MG 1 ::::::o, ~:;~;
1 ::::80: E~:;T I MATED HI GI-I THREE AUERAGE ~::;ALAF.'.\' fff F::ET I REMEMT $######. ##
1 B'3€1 PF.:IMT
19~3(1 GOTO 206(i
1 910 F.:EM BEG I t·i - '.:;UB!?OUT I !'1E FOP BA::; IC Flt1t IU I TY FORMULA
192~3 A1 = A - ::;
1930 B =
.015 ~ H ~ 5
1940 IF Al > 5 GOTO 1980
1950 C = .0175 ~ H Al *

1980 C = .0175 ~ H ~ 5
1990 D = .02 * H * (A-10)

805
E'.04~~1 PF:M--·- OU!F'l.IT J·:; E = A!irRIITY
?t::'i50 RE!'! EJlD --- :~~;l_!I:!:;:•oUTH1f F"OF' t:A::;rc r-=1ntll. IITY FOPMULA
1 F :::: ~}

T
l
2080~ RETIREMENT ANNUITIES REDUCED ###.## PERCENT
;:·090 PPir·F u·:;IriC .::100, F
;:: 1 t}0: FOR ### f'iOt ITH::; Ut·HJEP 55 \'ERP:::; OLD

C'.C.~lfi T1 = 1·/"iC'..
;:'.'C.'.~::~0 ·r;:: = 'T"/::~C'.
PRINT U3ING 2240,T
1:: c:s(1 F F.: I t·-11·" tJ:::; r ~--1c; ~='.C t:,(1, 1" i
1 1

2c'60: :~######. ¥.:fl: F'f P t•iOMTH


;::·;::?D PPHff u::;nK~ ;::;:::::i;::1, Tc'
;::·;::~::;:(1: :.;:######. ## PER ~·jF:D<
c'.29ti PR I rff
;=.;:·:::0~;:1 IF T > ~:::600 GOTO c'34ti
2310 V = .975 ~ T

2340 K = .975 ~ 3600


2350 L = .9 * Cl - 3600)
E'.'. :;: t:.;z~ T:3 = t< -i- t_
E: ::;:: 7(1 T 1 = r:: .- · t.:'.'.
E'390 PF'.HH u::;HJC c:40~h r:::
2400: $######.## ANNUITY TO RETIRED EMPLOYEE CSURUIUOR BENEFIT)
,:::410 PPHff u::;n1c ;:::260, Tl
i:'.'42ti PF.'.Hff U:=.:;H!G e:·2::_::0, T;:'.:
;;:::4::;::i;::1 F'F.'.Hff

806
i ?~i FF: t·iT
1

;::'.'.~:;c~t1 F1f~: t-iT


2~21 IF T9 ~ 0 GOlO 2900

2540 A5 = .55 ~ E
f\E, = ., C:22 :Q: f-1
~:'.~ ~5 c~;0
1

2560 A = A + 60 - G
;~='.':i7(1 c;cr::1J~B 1 :.1~:::1a
1

;:: 5r3~1
1
A7 1
·- ti S::i ~ E~

2610 IF A6 < A7 GOTO 2650


2620 IF A5 > A7 GOTO 2670
;:::~:1·:=:121 r~::: = F1?
?EAO GOTO ;::'.670
2650 IF A5 > A6 G010 2670
;:'.660 T3 = A6
2670 Wl = H ~ .6
PF'IMT U'.'.:;ING
;:;·i:«::::~) 26·~11~1, T3
;:::690: $##=H:##fl:. ## At··it·tUI TY TO '.::;iJf.'.l)JlJitKi :?,;POUSE OF FMPLO'lEE

2720 PRINT USit~ 2260,Ti


C~7:3t1 F·F.~It~iT tl!:;Jt·1Ci E'..2:::~~1, 1~i:'
;::? 40 PFU MT
2750 IF El =0 GOTO 2900
;:::751 A~i = ~·j1/E1
c'.?60 A6 = 2700/E.1
;:~·770 IF A5 > ti~:. C;1]T'C1 2::!:~:~~1
;:~7Bti IF A5 > 9(1(1 GOTO ;=.;'.::::10
;:?9€1 Ti = ;=JS
E'.;;::0(1 GOTO ;::'.B5l1
;:'.::H0 Tl = 9ti0
;::::::20 GOTO ;;:'.::::5121
c'.S:~:(1 IF A6 > 9(10 GOTO ;:~::::H::1
c'.:'.:::40 Tl = A6
i:'.'.850 Tc'. = Ti ;.:.: E:1
C:::::6(1 PRINT "::;UPUIUOP At-iNUITY TO CHILDREN OF EMPLOYEE"
c'.87(1 PPHff u::::niCi ;:::::::=.:(i, Tl, TE'.
;:::::;Bt1 : EF!CH CHILD :;:####.#th TOTAL CHIL.DPEl·I flrn·R.IITY $####. ##
c'. 9(1(1 PR I MT
c'.91(1 PRHff "DO 'r'OU L·H:::;H TO PPC!.JECT At-iOTHEP F.:ETIF.'.EMEtff DATE"
c'.911 PRHff "YE:::; T'/F'E 1 NO T\'F'E 0"
c'.912 INPUT T9
c'.913 PF.'.IHT
2914 IF T9 0 GOTO 2960 =
291 ':i PRINT "ENTEP--·- F.'.ETIF.'.EMENT DATE"
2920 INPUT M1,D1,Y1
2930 PPIMT
2940 B~ =
FND CM1,D1,Y1J
;:: 95(1 GOTO 1610
c'.960 STOP
c'.97(1 DATA 0,31,59,90, 12(1, 151
;:u3!:::i) I1F1TA 1!:::1 , C~ 1 C~, C~ 1=l:3, E~?::::, :.3(14' ::::~:4
E~'3r3~~1 Et1I1

807
SAVINGS:
DESCRIPTION
This program computes the amount of money an investment will accumulate
over a period of years, given the interest rate, compounding period and the
type of investment.

USERS
Anyone who invests or saves money will find this program can help in de-
termining the most advantageous place to invest your money. This would include
homeowners, businessmen and companies, as well as anyone who has a savings
account.

INSTRUCTIONS
After the program has been loaded into memory type RUN. The program will
then print out a full set of user instructions.

LIMITATIONS
This program should execute in any Basic speaking computer with 3K available
memory. Two kilo Bytes are required for program storage and Savings should
execute without incident in most 4K Basic compilers.

808
11,::10 PF.'.HH
l E1 PF.' Hff " TH I":; PPC1CPflH CFILCULF!TF·::; 1 HF f!MOUt!T OF MOt IEY THAT 11
i i:::o PP I NT "l·.lOUL.D 1=-1ccuMULFITE AFTE~P 1·1 Yt:AP:::; i=n A1-1 At·ltiUAL I NTEPc:;r"
l J(i PF.'Hff "~'.A1E P COMPOUMDED T TIME:::; PEP \'EflF.'., L·~HF:H THE H·llTIAL. 11
~=1MOUtff r:::; F' !:!ND Rt-~ AMOUMT Tl J:'::; HDDED AT THE: BEGIHNINC"
11
14i?:i PPINT
1 ~.:;o pp I MT OF [F!CH sur:·::E.OUH IT YE:AP.
ii !" IOTE THAT F' fliffl D f!PE: GI !)H1"
1 t.c1 r PF.: t··IT 11 I r·i DOLLflP'.::;, 1·-i nr·m T nu::;r BE. 11··nTCEP::::, mmP I'.::; GI UEJi"
l c-·n PP I MT "~=6 Fi Pl:PCD·ff 1=1GE. "
l::::0 PPHff
11
19\71 Pb:'.Hff ~·~Hf!T FIF.E Pdldi,T,~:";
200 INPUT L,N,y,x,A
210 IF X<>0 THEN 250
c'.c'.O PPHff
;:::::.:o F'PHff "::< nu:::;T r-10T EC!IJAL. ZEPO ••• 11

c'.40 GOTO 1:::0


c::'.::if::1 LET D=0
C.:60 LET B=. ~:1 p:i:i=1
·::1'7-1£7-t
t..,,I r,.,.i LET ::;:::L
;::'.~::(1 LET D=~3
;:::·::10 LET ::::=L
30Ci FOP Z=1 TO '··'I
3H:i LET ~=;=::;+:D
:;:2(1 FOF.: ~·~=--" l TO •. .I
1·\

330 LET S=S•Ci+B/XJ


340 MD::T H
::;::51) L.E:T D==t--1
:~:E.~~1 t·1E>=:T 2
::;:: 70 PP I MT
::::: :::0 PP I MT II iiFTEP II ; 'r'; 11 'r'[FIF.:~::;, II ; L; II DOLLHP::; I f"-11 .JE::::TED AT I! ; Fl
390 PF.:IMT II FEF.:CEt-IT COMPOUMDEII II;::-::; "TIMES PEP YEAF.:, ~·-IITH THE"
40(1 PPHff II FiDDITiot·1 OF "HH "DOLL.AP::; PEP \'Ef1p, 'r'I[LD::; A TOTAL."
410 pp I MT II OF II ; :::; ; II DOLLSIPS. Ii

4C.'t1 PPHff
4::::1~1 PF.'.Hff "MOF.:E DFfffl ( 1=YC:;, 0=!·101 ";
440 HiPUT I
450 IF I=1 THEN 190
99·~..3 nm

809
TH T:::. F'F:'.IJ(;i<i:!t·I c· HLC!. ILHTE·::; Tl· ii:.: H!•Ji"il It iT i IF i·!l"ir!i=.\' !!·WIT !·ICIULTJ 1::1cc1 ll'llJLJ:TE 1::.1FTEV
:i Hr H! i H! !! i! 1nL T: T r.;:. COl·IF'Ci! II Hii:. u T TI FFF' \'EH!~', !·IHEli
"THE". I! ! Ir J HL. :=n·H.IU! !T I::; !-' Ht !Ti 1:!! l 1+•1c1U! IT n I·:; !:fDTIED HT THE. I i"ll I I 1· 1c C!F
E:1:::ic·:r-1 i::;i IE.f·f'T '/L'i:.::1r=:
1
u i'fi "T1--11=·1T' F f:t1·1D Tl (::n·~~ F' C;J:1.1r:Hr~ Ir·oi l)(!L.L . F:n~;.:::~, rJ 1:·:n·. ·1I1 "l'
1 1

l" lt.l'.::1·T
1
I (!l" E. !. .:1!: . F,~:::::;, 1-:ll. -1.U l·,:· J ::::, C:1 Ji. IF'!·-1
1
f:l

( f"if=n=:icJtn· . 1r1F]) =-!· 'TI !'='IF"'.'.::;


1

Ft F' \'!: I-IF'!' \'I El. f1:::; H TC1THL

·;.1
: '
!·!HHT ~ i;::1 , 1 ~i" , =~l · , t:

T! II JF:::nT T! !YT ,::, Fl!T rcn··iF'Cil l!"fDED 4 TI


F'E 1:: · 'f'Ei:IF'., !·II TH THE HDT1 Tn 0(! (IF : .=1 tint.L Hk:::; F'[}:' 'rl<;=:1F1, 'r' TF' L. n;::l r:i -rcrrr-1L.
OF ?::, l ::: • ·:,1 l ::: [1(1LL::::1p·:;,

1•10!:,:.E: DHTH ! 1. , ~:'!::::! 11 1 I ?i


l•.IHH1 f:!F'F. F', fl, ! l, r, P ·~:·::::.C11,'n;=i, ,::·C!!,:=1, .:.i-, l , "'';. ,::r.=:,

F'FF'CElH C.:OMPCIU!"IDFD 4
\'[HF', \'I ELT1·:;;

810
SBA:
DESCRIPTION
SBA calculates a loan repayment schedule for "Small Business Administration"
loans.The printout covers the entire period of the loan utilizing a tabular
format for the various categories and provides a comprehensive yearly
summary statement.

USERS
Businessmen who are interested in obtaining SBA funds for use in their business
will find this program very informative and far less costly to use than an
accountant. As small businesses are measured in terms of dollar income per
operating unit, this means that even large companies may be able to obtain
SBA loans for thier various offices around the country.

INSTRUCTIONS
The program is self prompting but should be listed for detailed input inst-
ructions. After it is loaded into memory and listed, if desired, type RUN.

LIMITATIONS
Line 340 contains a DEF FNX ( ) statement, line 380 an ABS ( ) statement,
line 630 a Change statement, line 650 a FNEND statement and line 1180 a TAB
( ) statement. Some of these statements may not be in your Basic compiler but
if you have an 8K version of Basic these statements may easily be converted
to your compiler's statements. Statement definitions are shown in appendix
A at the end of Volume II. The source code for SBA requires 5K Bytes for
storage and will execute in 6K Bytes of memory.

811
IF'rl Uri··-· i 1 !\·\PUTE:>::; FitfD PF'Hff<::; e i"'i0tFHL.\' pr=f1'MFt!T'.:::.
j ::OF.'.Eli :::;c:HEDUL.E. FCF:' A :;HHL.L 1:u::;1nc:;::; flIWIHII::nPATIOr1 L.r:n=itL
J ·:1i~iPEM
j ~:;oPEM AT TH[ El!D CIF" E HCH CALEJl1)!iP \'rfiP nrm RT THE FHiAL F:TTIFD'!E:t-!T
16CIPEM OF TH[ LJ!flli IT F'F.'.Hff·:; A COMPPFl-H:J·!:::;J:i.![ '.;)JMMAF:'.'r' :=nt=ffEMHff
1 ?0PE.M GiilHiG THC F:FCH!NJ.llG PPINCIPFIL, EJIDH·l!:i F'PHiCIPAL, PPH-1CIPAL
1. :::0F.:EM PEPFiYMFlfT::. i·lFIDF:, Atffi T01PL H"!TCPE::;T F'RII1 DUPH!G THE \'Ef:F:.

,:·i~KiPEt·I THE" FF'1x:,PAM i=r:::sut·JE::; THAT THE r::i=::r·i~:: ::TPl.JICE FTE HILL BE
E:' l \ZiPEM PE I i'iBUF:·.·::Tn I:\' THE ::;BA.

E'.::lCiPEM n1:::::TF'.UCT I mi::.-- TO u::::;r::: THF: PPOCPFIM T\'PE , PUtP •


;;::"::{)PEM HiF'UT 1Jr-=iTA ~HL. L t::E PE·ouc:;n:D
,::6~.?1F.:EM
;:: ? OF:: EM:.;;::.;.:;.:.::.;:-::.;i:;¢;:.;;::<i: :.;i::i:i: * ;.:;: ;.:i:;..;: :i:i::i:i:*'*'*:i:i::.:.::i:i:;.;;: '*'*;.:.: *'*'*-*'*';.:.: :.;;:;.:.: *- :<i=:i:i::.;.: ;.:;::.:.::<>: :<i::.:i:;.:.: ;.:.::<>::i;.::<i::i:i::i;.::<>:****:,;.:*-*-* ;.:.::q::q: *'*'
;:::SOPEM
c' 90 PP I ~·ff "PL[A'.:;[ L I ::;T TH I'.:; PPOGF.:AM FOP I !t=.:;T RUCT I Ott:;. "
··::i 1 t; Ii I t'1 t:1:~: t 1C' J
··::t::~t~i Ii I t;1 F: ( l ;:;'.)

340 DEF Ft1PfPJ.,p~:;:i


3::;0 LET PO=(i
:~~:6;?1 LET FllP=P1
370 IF Pl>=O THEN 400
380 LET Pl =ABSfPl)
··~: :~ii~i LET F'~::'.l= 1
~:9':d~'.E]·i HUMPEP ClF fl I GI TS LEFT OF DEC li'ir!L. PO J MT

40"5F.:EM r·IUMBEP OF f!E:c I MALS


410 LET
4E'ti LET Ft ( ~~!) = F:'~·+·F'::~-+· l
1 ~1.:3i~1 LE~T Pc'. = I f-!T ! F' 1 ~: ( l t~1lP:::) + . 5)
44(1 FOP
450 LET P3=P2-INT CP2/10l•10
460 LET P(P9+P8~2-P4l =P3+48
470 LET P2=INTfP2/10J
,:l~'.:ii-7"l t·iE}::T Fzi:.1"
490 LET P(P9+1) = 46
500 FOR P4=1 TO P9
510 LET P3=P2-INTCP2 10l*10
520 LET PCP9+1-P4J=P3+48
530 IF P2 = 0 THEN 560
540 LET P2 =INT lP2/10)
::,5~;:1 C~Ci TCi ~; i ~i

812
560 IF P0=0 THEN G00
57J LlT PCP9+1-P4J =4~
•:::;:::o LE.T PO=O
L:?::n) co TO i=:.1u
600 l.ET PfP9+1-P4-1 - 32
6 1 ~:'I t·iD::T P4
620 PRINT TABCF~-2);
630 CHANGE P TOP$
640 PRHff F·$;
6'::i(i Fl!EMD
t:.i:.ci lifHA .Jfif-i, F'E:t:, MFIF'.; APR, MR\', ._!UH, .11.JL, f!l_U::;;, ~=;[p, OCT, t!OI.), DEC
670 FOR Z9= 1T012
t.:::o F.:EAD M$iZ9)
7'('1(1 DEF FN I (fl, R:t =I t··!T ( 1001:1: ( R/12) '*'A+. ':i) / 101:'.:1
710 pp I NT II BOF:F'.Ot·IE:F:'.' ·:; NFIME I!;
7;::'.0 I !·iPUT C::?
7':~:(1 PP I MT "OPIGil·ifIL PRit-K:IPFiL II;
7'4li HiPUT Ai
750 LET A9=A1
7 6 0 PF.'. I NT II ~:J::1=i '3HAPE II ;
770 HiPUT ~:;1
780 IF S1<1 THEN 8~0
790 LET Si = Sl/100
:::0(1 PF.'.IMT "BAt~K PATE I I ;
::: 11z1 I t·IPUT F.::;::
820 IF R3<1 THEN 840
830 LET R3=R3/100
::;:4(1 PRINT 11 ·:a::F1 PATE";
:::5(1 IMPUT F.:2
860 IF R2<1 THEN 880
870 LET R2=R2/100
:::::::(1 PF.'Hff "LOflH Dfff[D i:t··10, YP) II;
::: '?-(1 I r~~PLIT t1, \'1

90(1 LET M=M+1


910 IF M <= 12 THEN 940
9c'.O LET M=1
931~1 LET \'='i"'+1
9 4(1 PP I MT 11 MONTHL '/ PA'r'MEMT" ;
950 IMPUTEO
960 LET A2 =
HfffliaO:<r:At=<i:'.::;t+.5)/H3t1
97(1 PP INT 11 '.::;ERUICE FTE (~·~)II;
9:::i;::1 IMPUT ::;;9
990 LET S9=S9/l200
10(10 PP I MT "FOP HCH·~ MFIM'r' CALFl1DfiP VEAP.S DO '/OU U I ::=;H THE ::;CHEDULE 11 ;

1010 IMPUT Y9
1 0;:::121 LET YB = 1
1 ~::r:::~71 PP I MT" "
112140 PF.'.It·ff " :i:>::i:.~:i:i::i:i:st:A LOAM ~:;CHEDUL.[:<r::<i::ti::<i:
11

105(1 PPU-ff
11216(1 PP nff "BOF'.F.:m·~EF.'.: " ; C$

813
J 1 I f"i'T
c::k~ f~f!~~=; 1; 11
~-;;I!
1 i i10 PPI !~~[i:¢:F.~C.:; II~-;; II
1i~·na:Q:~~:::; 11
~,;;It
i 1:·::~~~i F'Fi'/r iErrr:
F 1 F.~It·-~T· nr;··icft·rr~1L.\
1
1 11
;

1140 LET E.O=Ft!P 1[0,17)


1 1 '50 F'F.' I HT
1 1t)3 F'P It ff

i 1. ~::(1 F:F~ I r·~T ·r1=rr; ( l ~~ ~l


:BE Ci I f··~r-1 I r-.a:; u ~ "fFL"B ( 27 'J ; H I r··iTEJ;;:E~:;;· n ; TA:F: f :::'3) ; H F•f;:= I r·1c: I FAL. ii ;
; I!
1

1190 PF.'. It-ff TF!E: I. ':d. ) ; "'.:;;E Pl) I CE" ; TAB ( ;::=;:::) ; "TC1Tf1L"
1c.·~10 PF r rff TAI: i. 1i:, :i ; "FF I 1!CI PAL" ; TAB i: 27) ; "Pf1YMElff" ; nrn (::::9 ·, ; "F:EPA\'MEHT" ;
1 ;;:'.10 PF I r·n ri=n=: 1. ::, j :i ; " FEE" ;. TfiB i: E. ::: :i ; "Pf1\'MElff"
l PF' I r·ff
i
J, LET t-i=i
l ;::'4€1 LET Fr3=A 1 -~f1;:.'.
1 ::.'5[i t_ET I 2. == FTO·l I f Fit.:'., F.~C'.)
1260 LET I3=FNifA3,R3l
1270 LET I1=I2+I3
1280 LET E1=E0-I1

l ::::Oti LET E:3=A3


l 310 LET E2=RE'.
1320 LET E1=E2+E3
1 :.:.: ·:3(1 CiC! Tl] 1 ~:;i::.(i
1340 LET E2=A2-INT(100•Si•CA1-E1J+.5)/100
1 ::::=;n LET E3=E1-Ei:'.
t :3E:[i F·F.~ r r~1·r =============================:======--:===============================
1
'
11

1370 PRIMT
1380 PF.:Hff "PMT *1="; r·-1;
1 ::;: ·3€; F·F.: I t·iT P1$ ( t,·t) ; ' 1 , '' ; 1
Y
1

14C1(.1 PRHff
1 4 1l2i LET t·!=r·1+ l
1420 LET M=M+1
14:3~:1 LET Cl=C1+1 l
1440 LET C2=C2+P1
145~3 PRHff "TOTF!L LOflN";
1 460 LET Al :::Ff·lP IF! 1 , 1 c:;)
1 4 7f:! LET I 1==FliP ( I 1 , ;::'. 7)
1480 LET E1=FNP(E1,39J
1 4. '~~ IF A~B~:; ( f~li-··E: i --- I 1 ) < ()€i(i 1 THEt i 1~;;:~t~ t2

1:=;~~ LET E9=FNF'CE1+I1,63)


1 ::; 1i21 GO TC! 15::::0
1 i:;;:'.0 LET Ef=niP 1 E.O, i:.::::: .1
l ~;~3~~i
l ::1 1~~0
RE~=FllF' A2, 15 J
11:'·50 LET
1560 LET I2=FNP I2,27l
1570 LET E2=FNP E2,39)

814
1580 LET 3~=INTfS9~A2~100+.5)/100
:! ~:,·:~o LET ·:;C:'.=FllP r , ::'i j )
j~~R LET l8=FNPlE2~J2fS2,63J
1 ~:, 10 F'F'. I HT
11:.c:O P~'.Hff 11 E:flnl< ::;HflF.'.[ 11 ;

1~30 LET A3=FNPCA3,15l


164-0 LFT I3=FNPfI3,27)
1 ,:;,50 LET [3==FHF' r , ::;::9)
1660 LET S2=FNPC-S2,51)
1670 LET E7=F~PfE3+I3+S2,63J
i t,~:~c1 F F:~ I r-~T
1

1 6 90 IF M< =L:'.:: THFJ i 1 ·:;1:::0


l ?00 PPHiT
1 71 .:j PPI 1·-rr ====::.~:~-::===,======================:==:=====·===============:::======"
11 11

1 7E'O LET r•i== 1


l 73~~; LET '/=Y+ 1
1740 PF.'.IHT

1 ?60 L[T T 1 =C::::;::


177ti F'PHff 11
t:EJ:;n1t·n1·1c PPit!CIPAL.";
1 ? 0::0 LET l=t9=FtlP ( A9, T1 )
17'30 PF.'.HH
i :::t1a PPI nr 11 nm I 1·1c PP I t·1c IPAL.";
1::: 10 LET :=1:::=A 1-E 1
1 :::20 IF A::: >=O THEM 1 :::40
1 ::::::t)
L_ET 1=1:~:=~?1
1 ::;:4(1
LET F!:::=n··!P (A:=.:, T 1 )
1 e5~J PF-:Hff
1 :::6(1 PR I MT" PP 1 t·iC I PAL F.FPFtr'MENT";
1870 LET C2=FNPCC2,T1J
i:::::::o PF.'.Hff
l ::;:·30 PF.'.IMT 11 TOTFIL HffE'F'.EST PAID";
1 ·::100 LET Ci=Fl·iP (Ci, T 1)
1910 PRIMT
i 92~3 IF Y:::=Y9 THD ! C.'03(1
l ~~:30 LET '/:=; = 'y':~:: "1.. 1
j ;:.i4.~3 IF- i=i1=~~1 'Tl-IF:t--1 ;::(1::.![1
1950 LET Ci=CC'=O
l '36~:::1 LET 1=i9=F! 1-E. J.
1. 317!-) FSF~I t·iT
1

1930 LET Ai=A1-t::1


1':;:191;:=i IF Ai=t1 THEt! j('('10
2000 LET A2=A2-E2
;:;:'. 0 1Ci PF.' Hff
C'. f12li 1:;1:. TCI i 2i:1-121
~:'.030 PPINT
C.'.040 PRHff
c'.'.050 PF-'I t-rr 11 ==::::=======-"================:====================================== 1'
?OE.ti n·m

815
'.::~"E:f··l ::::ii"· ii::iF~~ 1 F" ?,::1.i~:;
r:;1~:11··n": "?''.:;II !:::;

5 ! : :l

. . :·.. u
r::H!li< I!! ,-·:= ... !

l!ITLT'EST
i"IC!I iTHL':' F'H'r'i'lL i

.l: ! l. rr-:· F:E~·:;;; 1 :·:·:;E"F'I) I


i-r !'""'
r
r· iM'
i::.. i::

F'l·IT :i:i:

Ten i·il... L UHi I

i ·:)"'::1
.l,!_. ! ;I

TCITHL L..C11·!ii
'::; F:1=1 ·::;H1:.:1eE
;I .l i

TflTi:·iL. i.JIHli .J4


.::;pn ·:;HHF'[ _. ::?II ,:-1-::~.'.;
r.::
f :;::111~:· ':oi·IHF:C ~ '1
;'.". u 1
• l
··!·· I

F·cip l
t::E:C I flt! I I IC F.:.i~:· JI IC I F:-'HL. ::i:'!i:.'ICIU. OC1
EJf[I I HCi F'F'. I I IC: I p~:n.
F'F' I I IC I i='1::1L F'EJ·1:1':'!·IF! iT ·::i,::1-;:.
TCITf!L Ji ITEF'f: I ii >:::,'"•6. C.?

816
TIC TAC:
DESCRIPTION
This is a computer simulation of the game TIC TAC TOE. The game is played
on a standard 3 x 3 board. The computer randomly selects who will make the
first play and is your opponent. This is a very simple version of a very
old, old game and con provide hours of entertainment for both the novice
player and the expert.

USERS
This is a very good starter game for the novice computer game player and its
a nice change of pace for the expert who has been frustrated by a few of the
more complex games.

INSTRUCTIONS
Load the program into memory and type RUN. The game board will be printed
at the beginning of the first game only. It may be necessary to keep a
copy of the game board until its arrangement becomes familiar. To play you
type in the number of the square where you would like to place your X. The
computer will tell you which square it will occupy based on prior moves.

blMITATIONS
Line 1030 contains a TAB ( ) statement, 1070 MAT Read, 1080 MAT C = ZER
and 1090 MAT B = ZER. This program uses two dimensional arrays for operation;
see line 1060. The source code stores in 2 Bytes of memory and the program
will execute in 3K Bytes of memory, excluding the space required for your
Basic compiler. TIC TAC should execute in most 8K Basics with little or no
problems.

817
TJCr::::·

1U50 PRit·ff Tf1t::(j6J; "?'


1 :~'.iE,(i Ii I 1· ·1 i-· ( ;;:i, ·;:) , !_l ft:~, .::j. ·1
1
, c: f 3)
1
, f; ( '3)
1070 MAT READ r,u

112.1r3~3 f:"IAT I::=Z:EF:


11 (i0 N=O
11i0 IF F.J!Df-1·1:::.:'; THEJ! 11i:;o
i 1 E'.li PPI HT I! I ~-H LL t·\01.)[ F L?:::;T II

1 h'.{:1 PR I MT
1170 PPil"ff 11 \'C!UF' !·!01.JE"
1 1 ;:X'! I !·iPUT M
J. 1 9(i F-=-1
1,::0(1 IF M< >I r·!T 1. !·1 J THE:.J·i t 3;::.0
1,::1i;::1 IF M-: i THEJi l 360
1 E'C~i~1 IF t~1 >·?- T~·JE:t· . t 1::::E10
1230 IF BCMJ<>0 THEN 1360
Bt:MJ=F
1 ;:::50 FOP J=1 TO 4
i ;~t:1 0 F'=U ( M, ._I J
11~~~7 f.i
1280 CCPl=CCPl+F
1290 IF CCPJ THEN 1490
1. :;::0(1 IF C ( P J =3 THEt-1 14;=.?0

l 3c'.li M=N+ 1
1 ::::·;:0 IF H=9 THD·-1 1i:;10
1340 IF F=i THD! 117~?1
1 350 GOTO i :;:::;::0

l ::=:70 GOTO 11 7t'


1 38(i GO'.::;UB 15::::0
1 :·;;9~-=-1 F'PHff " I
14ti0 F=1
141(1 GOTO 1240
14;::'.(i PPIMT"Atm T
1-:.l30 PPINT
14*::1 PF.'. I MT
1450 F'PHff 11 At·10THEP CF!ME";
l 46(1 IMPUT Al~:
1470 IF LENfA1$l=3 THEN 1080

818
1 ·+;::~J ·:;TOP
149(1 PF.'.Hff 11 COl'KiPATUL.FiT I Ott:;, YOU BE:AT ME II
l ':iO(i GOTO i 4:::m
1~·1 (1 i=-p r MT TH r '.:; CF1ME: r ·:; A Dr:;::n~·.! 11
11

l r5t.~~~J C~CfTC1 14~~:C1


1 '.:)·~;~i F"CtF'. F'= i TC1 :::~
1':'140 IF CCF')=;:· THEJI 1i:=.f10
l ::;::1(1 tiE>=:T F:
l '560 FOP P= i TO :::
l:=.;70 IF CfP)==-;:'. THEli l61X1
1 ':iB(i t·iE::<T P
1 '5'30 GOTO 1. 640
1600 FOR I=l TO 3
l 61~:i M=T 1:P, I)
1620 IF BCMl=0 THEN 1790
l ;:,30 HE:=<T I
1.640 FOR S=l TO 9
l 650 u c:;:i =0
166[i IF I: ( '.:;) <>O THEtl l 720
1670 FOP .J=1 TO 4
1680 P=Ut:::;~J)
1690 IF F'=!ZI THD·i l 710
1700 UCSJ=U(S)+l+ABSCCCP))
1 71 (1 t-ID<T .J
1 ·?2~~1 t··IE>=:T ~::;
1 7 3(i 1..J=~:'!
l 74(1 FC!P '.:;=i TO 9
17'50 IF i.) f '.::_:;) < =!..'
THHI 17::;:(1
1 7 E,O U=U ( '..:; )
1 7 7~~1
1

l ?J:=:li IE:=·=:T '.::;


l ?9(i f?ETUPt·i
1 :::~3[1 DATA 1,2,3,:;:::,9,4,7,i:,,5,1,s,7,2,9,6,3,4,5,1,9,5,7,9,3
1810 DATA 1,4,7,0,1,5,0,0,1,s,s,0,2,6,0,0,3,6,7,0,3,5,0,0
1.820 DATA 3,4,s,0,2,4,0,0,2,5,7,s
1 :::::::f1 nm

819
\'(J! lh'. !!011[?3
I i'IOUE: TO c;i
lcijl ll lk MOIJE??
T
J. l'IOU[ Tn •j
L

\'Cll_IF:' MOUC?:'i
I !'101)[ TU i::.
'1'CIUP MOl IE?.:::
I i·!CIU[ TO 4
'c'CllJF: MOl.1[·7~:;:
THIS GAME IS A DRAW

820
RELIABLE COMPUTER SOFTWARE

FOR YOUR DOWN TO EAR TH TASKS

SCIENTIFI C RESEARCH INST. Crofton, Maryland BASI C SOFTWARE LIBRAR

You might also like