101
BASIC Computer Games
Additional copies of 101 BASIC Computer Games
are available for $7.50 plus 50 cents postage
and handling from:
Software Distribution Center
Digital Equipment Corporation
Maynard, Massachusetts 01754
write for discount schedule on quantities over 30.
Two supplemental guides are available for use
with this book.
They are:
understanding Mathematics and Logic Using
BASIC Computer Games, $4.50.
Grades 7-12.
Getting Started in Classroom Computing,
$3.00.
Grades 2-7.
1st Printing
2nd Printing
3rd printing
July 1973
April 1974
March 1975
Copyright
©
1975 by:
Digital Equipment Corporation
Maynard, Massachusetts
01754
ACEYDU
AMAZIN
ANIMAL
AWARI
BAGLES
BANNER
BASBAL
BASKET
BATNUM
BATTLE
BINGO
BLKJAC
BLKJAK
BOAT
BOMBER
BOUNCE
BOWL
BOXING
BUG
BULCOW
BULEYE
BULL
BUNNY
BUZZWD
CALNDR
CAN-AM
CHANGE
CHECKR
CHEMST
CHIEF
CHOMP
CIVILW
CRAPS
CUBE
DIAMND
DICE
DIGITS
DOGS
EVEN
EVEN 1
FIPFOP
Contents
Brief Description
Page
Play acey-ducey with the computer
13
Computer constructs 'a maze
15
Computer guesses animals and learns new ones from you 17
Ancient game of rotating beans in pits
19
Guess a mystery 3-digit number by logic
22
Prints any message on a large banner
24
Baseball game
26
Basketball game
29
Match wits in a battle of numbers vs. the computer
32
Decode a matrix to locate enemy battleship
34
Computer prints your card and calls the numbers
36
Blackjack (very comprehensive), Las Vegas rules
39
Blackjack (standard game)
42
Destroy a gunboat from your submarine
43
Fly World War II bombing missions
45
Plot a bouncing ball
47
Bowling at the neighborhood lanes
48
3-round Olympic boxing match
50
Roll dice vs. the computer to draw a bug
52
Guess a mystery 5-digit number vs. the computer
55
Throw darts
57
You're the matador in a championship bullfight
59
Computer drawing of the Playboy bunny
62
Compose your speeches with the latest buzzwords
63
Calendar for any year
65
Drive a Group 7 car in a Can-Am road race
67
Computer imitates a cashier
72
Game of checkers
73
Dilute kryptocyanic acid to make it harmless
76
Silly arithmetic drill
77
Eat a cookie avoiding the poison piece
78
(2 or more players)
Fight the Civil War
80
Play craps (dice), Las Vegas style
83
Negotiate a 3-D cube avoiding hidden landmines
85
Prints I-page diamond patterns
87
Summarizes dice rolls
89
Computer tries to guess digits you select at random
91
Penny arcade dog race
93
Take objects from a pile--try to end with an even
96
number
Same as EVEN--computer improves its play
98
Solitaire logic game--change a row of XS to Os
99
FOOTBL
FOTBAL
FURS
GOLF
GOMOKO
GUESS
GUNNER
GUNERl
HANG
HELLO
HEX
HI-LO
HI-Q
HMRABI
HOCKEY
HORSES
HURKLE
KINEMA
KING
LETTER
LIFE
LIFE-2
LITQZ
MATHDl
MNOPLY
MUGWMP
NICOMA
NIM
NUMBER
lCHECK
ORBIT
PIZZA
POETRY
POET
POKER
QUBIC
QUEEN
REVRSE
ROCKET
ROCKTl
ROCKT2
ROCKSP
ROULET
RUSROU
SALVO
SALVO 1
SLOTS
SNOOPY
SPACWR
Professional football (very comprehensive)
High School football
Trade furs with the white man
Golf game--choose your clubs and swing
Ancient board game of logic and strategy
Guess a mystery number--computer gives you clues
Fire a cannon at a stationary target
Fire a cannon at a moving target
Hangman word guessing game
Computer becomes your friendly psychiatrist
Hexapawn game
Try to hit the mystery jackpot
Try to remove all the pegs from a board
Govern the ancient city-state of Sumeria
Ice hockey vs. Cornell
Off-track betting on a horse race
Find the Hurkle hiding on a 10xlO grid
Drill in simple kinematics
Govern a ·modern island kingdom wisely
Guess a mystery letter--computer gives you clues
John Conway's Game of Life
Competitive game of life (2 or more players)
Children's literature quiz
Children's arithmetic drill using pictures of dice
Monopoly for 2 players
Locate 4 Mugwumps hiding on a 10xlO grid
Computer guesses number you think of
Chinese game of N im
Silly number matching game
Challenging game to remove checkers from a board
Destroy an orbiting germ-laiden enemy spaceship
Deliver pizzas successfully
Computer composes poetry in 4-part harmony
Computer composes random poetry
Poker game
3-dimensional tic-tac-toe
Move a single chess qUeen vs. the computer
Order a series of numbers by reversing
Land an Apollo capsule on the moon
Lunar landing from 500 feet (with plot)
Very comprehensive lunar landing
Game of rock, scissors, paper
European roulette table
Russian roulette
Destroy an enemy fleet of ships
Destroy 4 enemy outposts
Slot machine (one-arm bandit)
Pictures of Snoopy
Comprehensive game of spacewar
4
SPLAT
STARS
STOCK
SYNONM
TARGET
3D PLOT
TICTAC
TOWER
TRAIN
TRAP
23MTCH
UGLY
WAR
WAR-2
WEKDAY
WORD
YAHTZE
ZOOP
A
B
C
Open a parachute at the last possible moment
Guess a mystery nuffiber--stars give you clues
Stock market simulation
Word synonym drill
Destroy a target in 3-D space--very tricky
Plots families of curves--looks 3-dimensional
Tic-tac-toe
Towers of Hanoi puzzle
Time-speed-distance quiz
Trap a mystery nuffiber--computer gives you clues
Game of 23 matches--try not to take the last one
Silly profile plot of an ugly woman
Card game of war
Troop tactics in war
Facts about your birthday
Word guessing game
Dice game of Yahtzee
BASIC programmer's nightmare
Appendices
Families of Games
Game Diagrams
Instructions to Game Authors
5
205
207
209
212
214
216
218
221
223
224
226
228
230
232
234
236
238
243
Preface
This is not the first collection of computer games and
simula-tions nor will i t by any means be the last.
However, in many
ways i t is unique.
It is the first collection of games all
in BASIC,
I t is also the only collection that contains both
a complete listing and a sample run of each game along with a
descriptive write-up.
Educational Value of Games
Educators have widely different opinions as to the educational
value of games.
There tends to be agreement that games are
highly motivational and frequently very addictive.
Most
educators agree that games generally foster learning by
dis-covery--i.e., the player .doesn't sit down at the terminal with
the purpose of learning a principle of logic but after playing
BAGLES three or four times he most assuredly has learned
some-thing about logic.
Newton's second law is probably the furthest
thing from the mind of a person sitting down to Play ROCKET.
However, when the player finally lands his LEM successfully on
the moon, the chances are very good that he has discovered
something about gravity varying inversely with the mass of the
LEM and the distance from the moon.
The main objection to games as a learning tool seems to be the
fact that i t ' s largely unguided learning and potentially
waste-ful of computer time.
Art Leuhrmann of Dartmouth joked that
some computer center directors might be willing to pay to not
have the book sold on campus because of the computer time that
would be burned up by playing the games; however, the educational
value of games can be enormous - not only in their playing but
in their creation.
The majority of games submitted tend to simulate a sport, card
or board game, a game of chance or something which already exists.
only a few games begin to use the logical and computational
capabilities of the computer to come up with something new and
truly un ique •
Some tha t do are STARES, BULCOW,. ROCKET ,and
LIFE-2.
Certain games are, of. course, more popular with game authors .that
others~
There were no less than ten versions of NIM submitted,
nine versions each of HORSES (HorSe Race) and TICTAC (Tic-Tac-Toe),
and eight versions of CRAPS.
Other popular ones were simulations
of baseball, basketball, football, blackjack, and hangman.
Families of Games
A word about the title of the book.
The astute,
quantitatively-oriented reader might notice that there seem to be
mor~
than
101 games in the book.
In fact, there are 108 individual games;
7 are different versions of another game.
There are 101 separate
write-ups; thus, the title of the book.
Perhaps i t is a disease of using the computer or perhaps it is
just a compulsion of man that he must categorize things.
The
games in this book could be categorized by level of difficulty
as is often the case in collections of puzzles.
They could
also be categorized in an educational sense, for example, those
that could be used to teach logic principles, those that foster
learing by discovery, those that require the user to solve an
algebra problem, etcc
In the first two groups, Number or Letter Guessing and Piles of
Objects, you will probably get more enjoyment if you play the
games in the numbered order as there is a definite sequential
nature to their difficulty.
In the other fourteen categories,
the games may be played in any order; one does not generally
build upon another except in a few cases.
In particular, you
should
play~
BAGLES before BULCOW
HI-Q
before lCHECK
BATTLE before SALVO
GUNNER before SUNERI
ROCKET before ROCKT2
HMRABI before KING
Equipment to Play, computer and Otherwise
Most of the games in this book require no special knowledge, tools
or equipment to play, except, of course, a BASIC-speaking computer.
Four of the matrix games will probably be more enjoyable if you
use a grid or quadrille paper to play.
Unless you have a
photo-graphic memory, QUBIC almost certainly requires a diagram.
There
is a page included as Appendix B which contains some supplemental
diagrams; you may wish to reproduce it if you become addicted to
the games on
it.
with few exceptions, the games all run in "standard" BASIC.
Any
exceptions are noted in the write-ups under the heading, "computer
Limitations."
The major difference between various computer systems
appears to be in the handling of alphabetic strings.
On Digital
systems a subscripted string variable. for example, A$(8) or Cl$(15),
refers to a variable in an array or matrix.
Other BASIC compilers
may not have string arrays.
On some systems, in particular, Digital's Edusystems 20, 25, and 50,
strings are limited to 6 characters.
Several strings may, or course,
be combined in an array to permit longer than 6-letter words to be
used.
Many programs use the RANDOMIZE command to start the random number
generator at a random point.
Some BASIC compilers do not recognize
RANDOMIZE and i t must be removed in order for the program to run.
Digital BASIC permits more than one statement on each program line.
Statement separators on the line may be one of three characters
--/ or : o r O •
Digital Equipment Corporation
Maynard, Massachusetts
July 1973
ACKNOWLEDGEMENTS
Rusty Whitney
Oregon Museum of Science and Industry
Portland, Oregon
Bob Albrecht
People's Computer Company
Menlo Park, California
Walt Koetke
Lexington High School
Lexington, Massachusetts
Charles Lund
The American School of the International Schools
The Hague, Netherlands
Mary C. Jones
Southwest High School
Fort Worth, Texas
Victor Nahigian (student)
Weston High School
Weston, Massachusetts
Keiwit Computation Center
Dartmouth College
Hanover, New Hampshire
Education and DECsystem-lO Groups
Digital Equipment Corporation
Maynard, Massachusetts
Illustrations courtesy of:
MAD Magazine
Scot~Foresman
&
Co.
Bob Barner
Creative Publications
Peoples Press
and several other sources.
~
The Games ....
ACEYDU
ACEY DUCEY CARD GAME
Description
This is a simulation of the Acey Ducey card game.
In the
game, the dealer (the computer) deals two cards face up.
You have an option to bet or not to bet depending on whether
or not you feel the next card dealt will have a value between
the first two.
Your initial money
(Q)
is set to $100; you may alter Statement
170 if you want to start with more or less than $100.
The
game keeps going on until you lose all your money or interrupt
the program.
Program Author
Bill Palmby
Adlai E. Stevenson High School
Prairie View, Illinois
60069
PROGRAM LISTING
LISTNH
10 REM
*.*
GAME OF ACEY-DUCEY WRITTEN BY BILL PALMBY20 REM
* ••
ADLAI STEYENSON.HIGH SCHOOL, PRAIRE YIEW, ILL 30 REM ••• TRANSLATED TO RSTS/E BY DAVE A'HL, DIG !TAL 100 RANDOMIZE101 PRINT "ACEY-DUCEY IS PLAYED IN THE FOLLOWING MANNER:' 102 PRINT "THE DEALER (COMPUTER) DEALS TWO CARDS FACE UP. " 103 PRINT "YOU HAVE THE OPTION TO BET OR NOT TO BET DEPENDING" ;.04 PRINT "ON WHETHER OR NOT YOU FEEL THE NEXT CARD WILL HAVE' 105 PRINT "A VALUE BETWEEN THE FIRST TW~ ,
106 PRINT" IF YOU Dt} ·NOT WANT TO BET, INPUT A 0. '
He
PRINT 160 N=100:Q=100190 PRINT "YOU NOW HAVE'Q'DOLLARS. ' 195 PRINT
200 GOTO 260 210 Q=Q+M 220 GOTO 190 240 Q=Q-M 250 GOTO 190
260 PRINT "HERE ARE YOUR NEXT TWO CARDS. 270 A=INT(14*RND)+2
290 IF A{2 lHEN 270 290 . IF 1'1:>14 THEN 270 300 B=INT(14~RND)+2
310 IF B<2 THEN 300 320 IF B)14 THEN 300
330 IF A)=B THEN 270 350 IF 1'1<11 THEN 400 360 IF 1'1=11 THEN 420 370 IF 1'1=12 THEN 440 380 IF 1'1=13 THEN 460 390 IF 1'1=14 THEN 480 400 PRINT A 410 GOTO 500
42e PRINT "JACK"
430 GOTO 500 440 PRINT "QUEEN" 450 GOTO 500 460 PRINT "KING" 470 GOTO 500 480 PRINT "ACE' 500 IF 8{21 THEN 550 510 IF B=11 THEN 570 520 IF B=12 THEN 599 530 IF 8=13 THEN 610 540 IF B=14 THEN 630 550 PRINT 8
569 GO TO 650 578 PRINT "JACK' 5S8 GOTO 650 590 PRINT "QUEEN" 690 GO TO 650 620 PRINT "KING" 620 GOTO 650 630 PRINT "ACE" 650 PRINT
660 INPUT "WHAT IS YOUR BET',M 670 IF M00 THEN 690
675 PRINT
"CHICKEN~!M;PRINT677 GO TO 260
68e IF M{=Q THEN 730
690 PRINT "SORRY, MY FRIEND, BUT YOU BET TO'O MUCH'
~'00 PRINT "YOU HAVE ONLyaQ"OCILLARS TO .. BET. U 710 GOT
a
650 .~,730 C=INT<14*RND)+2 740 IF C{2 THEN 730 750 IF C)14 THEN 730 760 IF C<H THEN 820 770 IF C=11 THEN 830 780 IF C=22 THEN 850
790 IF C=13 THEN 970 800 IF C=24 THEN 990 810 PRINT C 920 GOT
a
910 830 PRINT "JACK" 840 GOTO 910 950 PRINT "QUEEN' 860 GOTO 910 870 PRINT "KING" 980 GO TO 910 890 PRINT "ACE" 910 IF 01'1 THEN 930920 GOTO 970 930 IF C)=B THEN 970 950 PRINT "YOU WIN!!" 960 GO TO 210
970 PRINT "SORRY, YOU LOSE. 980 lF M{Q THEN 240 1800 PRINT
1910 PRINT "SORRY, FRIEND, 1020 INPUT "TRY AGAIN (YES 2030 IF A$="YES" THEN 110
BUT YOU BLEW'.YOUR WAD. OR NO)', 1'1$ , ,. {c ;,
2040 PRINT: PRINT "0. K. HOPE yOU HAD FUN'!' 1059 END
READY
14
"s~1!: ~~~k"
.
·,;.~:eINN~">: ~
.
.. ','
"~'
'
! . ,. ,0," ,: ..$CEY~P1!CEY
IS p'i.fiYED I,N THE.,lCij..LoWING 'i'I1!NNER:':" 'JHE DEilL.ER (COA(>u1ER) 'QEALS.'·TWO C~RD.·I'ACE Lif···'.... 6U· HAVE" THE OP't'H'N TO' BET 'oin'WT TOElET DEPE~DING ON WHETHER OR NOT YOU FEEL THE NEXT CARD WILL HAYE A VALUE BETWEEN THE FIRST TW~
JF YOU DO NOT WANT TO BET, INPUT 0.
YOU NOW HAVE 100 DOLLARS. HERE ARE YOUR NEXT TWO CARDS.
6.
1e,
WH.A; IS, YOUR BET? 10 6
SORRY, YOU LOSE.
YOU NOW HAVE 90 DOLLARS. . 'HERE
ARE
YOUR NEXr' TWO CARDS.6 QUEEN
WHAT IS YOUR BET? 20 JACK
YOU WIN!!!
YOU NOW HAVE 110 DOLLARS, HERE ARE YOUR NEXT TWO CARDS.
le
'KINGWHAT IS YOUR BET?
0
CHICKEN! !
HERE ARE YOUR NEXT TWO CARDS. 2
9
lmAT 15 YOUR BET? 30 10
SORRY, YOU LOSE. YOU NOW HAVE
80
DOLLAR~H~RE ARE YOUR, NEXT TWO CARDS. .8.
WHAT IS YOUR BET? 20
SORRY, YOU LOSE. YOU NOW HAVE 60 DOLLAR~
HERE ARE YOIJR NEXT TWO CARDS.
9
QUEEN
lmAT IS YOUR BET? 0
"CHICKEN' !
HERE ARE YOUR NEXT TWO CARDS.
:2
4l~HAT,1
S YOURBET?
0 CHICKEN! !H~RE:
ARH'IbUR
,NEXT ...T~b
CARDS. 10WHAT'
is ..
YOUR :.!iET? 0 . .cHICKEN·! '"',"
!,. HERE
ARt
YOU~·.NEXT-'rWO
CARDS. '. 2RCE
WHAT IS YOUR BET?
dee
!>"ORRY, MY FRiEND, BUT .VOU BET TOO MUCH VoU HAVE ON~Y 60 DOLLARS TO BET.
WHflT IS YOUR BET? 60 . 5'
"fOU'WIN!! !
YOU NOW HAYE 120 DOLLARS. HERE ARE YO~R NEXT TWO CARDS.
5 9
. WlHAi LS YOUR BET?' 20 .", .. " , "'p.
SO~R"',
YOU LOSE. . YOu' HO.lI #~"E411.e· DOLLARS.. ,,{ERE fiRE 'YOUR NEXT TWO CARDS.
3 '" .... ,
'·'8 .
l~HAT IS "QUR BET? 90 10
SORRY, YOU LOSE. YOU NOW HAVE 10 DOLLARS. HERE ARE YOUR NEXT TWO CARDS.
2
JACK
I~HAT IS YOUR 9ET? 10 QUEEN
S'ORRY, YOU LOSE.
SORRY, FRIEND, BUT YOU BLEW YOUR WAD. TRY AGAIN (YES OR NO)? NO
AMAZIN
DRAW A MAZE
Description
This program will print out a different maze every time i t
is run and guarantees only one path through.
You can choose
the dimensions of the maze--i.e. the number of squares wide
and Iong-.
computer Limitations
The amount of memory available will determine the maximum
size maze that may be constructed.
An
8K
EduSystem 20
initialized for one user can draw a l3x13 maze.
RSTS/E
can draw a 23 (width of paper limit) x 50 maze, even larger
using virtual memory.
Experiment on your system with the maze dimensions in
Statement 110.
Program Author
Jack Hauber
Loomis School
Windsor, CT
06095
PROGRAM LISTING
AMAZIN EDUSY5TEM 30
190 RANDOMIZE
119 DfM We2$.1031.ye25.1031
129 PRINT "WHAT ARE YOUR WIDTH AND LENGTH?' 121 INPUT H.Y
122 PRINT
130 IF H()l THEN 150 131 IF Y()l THEN 150
1]2 PRINT "MEANINGLESS DIMENSIONS. TRY AGAIN" 140 PRINT
141 GO TO 120 159 PRINT 151 PRINT 160 LET Q=0 161 LET 2=0
162 LET X=INTCRNDI91*H+1) 163 FOR 1-1 TO H 170 IF I=X THEN 17] 171 PRINT ":
--"J
172 GO TO 180H3 PRINT "J 180 NEXT I 190 PRINT":" 191 LET C=l
192 LET WeX.1I=C
1n
LET C=C+l 200 LET R=X 201 LET 5=1 202 GO TO 260 219 IF R()H THEN 240 211 IF S()V THEN 230220
LET R=l 221 LET 5=1 222 GO TO 250 230 LET R=l231 LET 5=5+1 232 GO TO 250 240 LET R=R+l
250 IF weR.51=0 THEN 210 260 IF R-l=0 THEN 538 261 IF weR-l.51()0 THEN 5]0 210 IF 5-1=0 THEN 390 280 IF weR.5-1)<>0 THEN 390 290 IF R=H THEN 330 ]00 IF WCR+l.S)()0 THEN ]]0 310 LET X-INTCRNDe01*3+1) 320 IF X=l THEN 790 321 I F
x-a
THEN 820 323 IF X=3 THEN 860 330 I F SOY THEN 340 331 IF 2=1 THEN 370 332 LET Q=l333 GO TO 350
340 IF WCR.5+1)()0 THEN ]70 350 LET X=INTCRNDe01*3+1) 360 IF X=l THEN 790 361 IF X=2 THEN 820 362 ·IF X=3 THEN 910 370 LET X=INTIRNO(0)*2+1)
]~9 IF X=l THEN 790 381 IF X=2 THEN 820 390 IF R=H THEN 470 490 IF WCR+l.5)()0 THEN 479 401 I F SOY THEN 420 410 IF 2"1 T~EN 450 411 LET Q=1 412 GO TO 430
420 IF WCR.5+1)<>0 THEN 450 430 LET X=INTCRNoe01*3+1) 440 IF X-l THEN 790 441 IF X-2 THEN 860 442 IF X=3 THEN 910 450 LET X=INT.(RNPC01*2+11 460 IF Xcl tHEN 790 461 IF X=2 THEN 860 4;'0 I~ S¢)Y THEN 490 480 IF 2=1 THEN 520 481 LET Q=1 . 482 GO TO 500
490 IF W(R.S+l){)0 THEN 520 500 LET X=INTCRNO(0)*2+1) 510 IF X=l THEN 790 511 IF X=2 THEN 910 520 GO TO 790 530 IF 5-1-9 THEN 670 540 IF NCR.S-1)()0 THEN 670 541 IF R=H THEN 610 542 IF WCR+l.SI<)0 THEN 610
5s0
IFSOY
THEN 560 551 IF Z=1 THEN 590 552 LE.T Q=l 55] GO TO 570560 IF WCR.S+1)()0 THEN 590 570 LET X=INT(RNPC0)*l+1) 580 IF Xcl THEN 820 581 IF X=2 THEN 860 582 IF X=3 THEN
9i0
590 LET X=INHRNO(0)*2+1) 600 IF X=l THEN 820 691 IF X=2 THEN 860 610 IF S()V THEN 630 620 IF 2'1 THEN 660 621 LET Q=l 622 GO TO 640630 IF WC~S+1)C)0 THEN 660 640 LET X=IHTCRND(01*2+1) 650 IF X=l THEN 820 651 IF X=2 THEN 910 669 GO TO 820 670 IF R=M THEN 740 6ee IF W(R+1,5)<>0 THEN 748 681 IF SOYTHEH 700 699 IF 2=1 THEN 730
16
691 LET G=l
692 GO TO 830 , 700 IF WCR.5+1)C)0 THEN 730 710 LET X=INTCRNDI0.)*2+1) 728 IF X=l THEN 860 721 IF X-2 THEN 910 730 GO TO 860 740 IF 50Y THEN 760 750 IF 2=1 THEN 780 751 LET G=l 752 GO TO 770
760 IF W(R.5+11(>0 THEN 780 770 GO TO 910
780 GO TO 1000 790 LET WCR-l. SI=C 800 LET C=CH 801 LET VCR-l.SI=2 802 LET R=R-l
810 IF C=H*Y+l THEN 1010
au
LET Q=0812 GO TO 260 820 LET NCR.S-l)=C 830 LET C=C+1 840 LET Y(R.5-1)=1 841 LET 5="5-1
842 IF C=H*V+l THEN 1010
859
LETa-B
851 GO TO 260
869 LET ·WCRH. s)=e 870 LET C=C+1
871 IF VIR.51=0 THEN 880 S72 LET V(R.SI=3 873 GO TO 890 S8e LET V(R.5)=2 890 LET R=R+l
99B IF C=H*V+l THEN 1010 992 GO TO 530
910 IF Q=l THEN 960 920 LET W(R.S+l)~C
921 LET C-C+1
922 IF VCR.51=0 THEN 940
939 LET VCR.51=3 931 GO TO 950 940 LET VCR.S)=l 959 LET 5=5+1
951 IF C-H*Y+l THEN 1010 952 GO TO 260
969 LET Z=l
97e IF V(R.51=0 THEN 980
971
LET V(R.S)=3 972 LET G=0 973 GO TO 1000 980 LEl v(R.SI=l 981 LET G=0 982 LET R=l 990 LET 5=1 991 GO TO 250 1009 GO TO 210 1910 FOR J=l TO 1011 PRINT"I"; 1012 FOR 1=1 TOH
1013 IF VCI.J)(2 THEN
1030
1020 PR·I NT" ";1921 GO TO .1040 1030 PRINT" I"; 1040 NEXT I 1041 PRINT 1943 FOR 1=1 TO H 1045 IF VCI.J)=0 THEN 1060 1059 IF Yel.J)=2 THEN 1060 1951 PRINT": "J
1952 GO TO 1079 1060 PRINT"
"--"J
1079 NEXT I 1071 PRINT": 1072 NEXT J 1073 END
SAMPLE RUN
AMAZIN EDU5YSTEM 30
ANIMAL
COMPUTER GUESSES YOUR ANIMAL
Description
. Unlike other computer games in which the computer picks a
number or letter and you must guess what it is, in this
game you think of an animal and the computer asks you
questions and tries to guess the name of your animal.
If
the computer, guesses incorrectly, it will ask you for a
question that differentiates the animal it guessed from the
one you were thinking of.
In this way the computer IIlearnsll
new animals.
Questions to differentiate new animals should
be input without a question mark.
IMPORTANT:
At the end of a playing session, to the question,
IIARE YOU THINKING OF AN ANIMAL, II you must respond IISAVE II
in order that the computer save all the new animals you have
introduced.
To that same question, at any point in the game,
if you respond IILIST,II the computer will tell you all the
animals it knows so far.
The program starts originally by knowing only "FISH II and
IIBIRD.II
Additional animals are stored in the file IIANIMAL.GME. II
Computer Limitations
This program was written for a DIGITAL RSTS-ll and uses several
unique features, in particular, multiple user access to a
common data file and several advanced string handling functions.
It has been converted with some minor changes to OS/8 BASIC
and could be adapted to other systems as well.
Program Author
Nathan Teichholtz
Digital Equipment Corporation
Maynard, MA
01754
PROGRAM LISTING
04144 PM
IU "PLAY 'GUESS THE ANIMAL' WITH RSTS
150 "THINK Of AN
ANI~ALAND THE COMPUTER WILL TRY TO GUESS IT . . .
·,&
590 DIM Al12eB'
525
FS"ANIMAL.GME'
,ON ERROR GOTO 700
550 OPEN FS FOR INPUT AS FILE IX
,INPUT
~u'Nf,INPUT .1,ASlh) FOR h'IUO NX'
,CLOSE
II
'U (0X hNUMS I NX)
,ON ERROR GOTO 0
.GOTO 1300
700 ON ERROR GOTO 1050
IFS·"S".FS
'RESUME
5501050 READ ASIIX) FOR Ix.0X TO 3X
1100
DATA"4","\GDOES IT
SWI~\Y2\N3\',"\AFISH""\ABIRD"1300 INPUT "ARE YOU THINKING OF AN ANIMAL",Z9S
,GOTO 1350 IF LEFTlZ9S,lX)"Y'
,GOTO 1300 ,IF. LEfTIZ9S,lI) . . N.
1310 IF Z9$"SAYE'
TH~NOPEN 'ANIMA'L,G"E" FOR OUTPUT AS FILE IX
,PRINT #U,ASIU) FOR IX-a. TO YAL(AS(0Xl)
,PR INT*!, CHRS
(2el)'CLOSE
IX
'GOTO 1300
1320 IF ZpSo"LIST" THEN
~m~r"~~!~~~~! lI~~~i:~; ~~O~N~m
;., AS(!Xl,
"w,
FOR
U' U
TO
200X
,GOTO !J00
1350
KX.!X14B0 KX.FNAXIA$(KXll
,GOTO
30m0IF LEN(AS(KX.)l'0X
,GOTO 1400 IF
L~FTCA$IKX),2X""\Q",PRINT "IS
IT
A 'RIGHT!ASIKX,,3111
,INPUT Z7S
,Z7 S'LEFT (Z7S,
IX)1450 IF Z7s."V" THEN
PRINT "WHY NOT TOY ANOTHER
ANI~AL",GOTO
1300
'
2000 INPUT "THE ANIMAL YOU WERE THINKING OF WAS
A "1Z9S2050 PRINT 'PL·EASE TYPE :'IN' A QUESTION THAT WOULD DISTINGUISH A "
ZpS •
FRO~A 'RIGHTCASCKI),3%l
,INPUT
lSS
2100 PRINT "FOR. 'ZU" THE ANSWER WOULD BE"'
,INPUT Z75
,Z7S'LEFTCZ75,
U)'IF Z7S.
IIV" TIotEN
Z6S."N-ELSE IF
Z7S.IINIITMI!N
Z15S.IIV11ELSE PRINr 'PLEASE ANSWER
'Y~S' 00INO'"
IGOTO 2100
2200 ZlhYALCA$(0Ill
'AS (0X)'NUMSIZI %+2X'
,ASIZIX)·AsCKXl
,A$(ZIX+lx)·'\A!+Z9S
.
,AS (Kll. "\Q ·.Z85+" \
'+Z7S-NU~SIZ I h I X )-"\ "-ZS'.NUMS I Z I
%, -"\'
2300 GOTO 1300
3000 OEF
~NAX(Q$l,PR
INT HID CQS. 3%, INSTR
(JX, QS, '\" )-3%"IlNPUT Z95
9999
END'Z9S'LEFTI Z95,
U'
IZ9s-flN" IF Z9sc>JtV"
,ZI hIN8TO(3%, Gi, 'V-Z9S) .2X
,Z2X'INSTR IZI
X.QS,
"\"l,FNAX.YAL I MID
(QS. Z1 X, Z2X.Z I X) l
,F NENO
< ..
SllMPLE RUN
PLiw 'dUESS THE ANIMAL' WITH RSTS
THINK OF AN ANIMAL AND THE COMPUTER WILL. TRY TO GUESS IT".
ARE YOU THINKING OF AN ANIMAL? YES DOES IT SWIM? YES
IS IT A FISH? NO
THE ANIMAL YOU WERE THINKING OF WAS A ? SEAL
PLEASE T~PE IN A QUESTION THAT WOULD DISTINGUISH
A
SEAL FROM A FISH? DOES IT HAVE FLIPPERS
FOR A SEAL THE ANSWER WOULD BE? VES ARE VOU THINKING OF AN ANIMAL? YES' DOES IT .SW I M? NO
IS 'IT A BIRD? NO
THE ANIMAL YOU WERE THINKING OF WAS A ? ELEPHANT
PLEASE TYPE IN A QUESTION THAT WOULD DISTINGUISH A ELEPHANT FROM A BIRD
? DOES IT HAVE A TRUNK
FOR A' ELEPHANT THE ANSWER WOULD BE? YES ARE YOU THINKING OF AN ANIMAL? YES DOES IT SWIM? NO
DOES IT HAVE. A TRUNK? NO IS IT A BIRD? NO '
THE ANIMAL. YOU WERE THINKING ,OF WAS A ? DOG
PLEASE TYPE IN A QUESTION THAT WOULD DISTINGUISH A I>OG FROM A BIRD
? DOES IT GO 'ARF, ARF'
FOR A DOG THE ANSWER WOULD BE? YES ARE YOU THINKING OF AN ANIMAL? YES DOES IT SWIM? NO
DOE5 I T HAVE A TRUNK? NO DOES IT GO 'ARF? NO
IS IT A BIRD? NO
THE ANIMAL YOU WERE THINKING OF WAS A ? CIIT
PLEASE TYPE IN A QUESTION THAT WOULD DISTINGUISH A CAT FROM A BIRD
? DOES IT HAYE RETRACT! BLE' CLAWS FOR A CAT THE ANSWER WOULD BE? 'IES ARE YOU THINKING OF AN' ANIMAL? YES DOES IT SWIM? NO
DOES IT HAVE A TRUNK? NO DOES IT GO 'ARF? NO
DOES IT HAVE RETRACTIBLE CLAWS? YES
IS IT A CAT? NO
THE ANIMAL YOU WERE THINKING OF WAS A ? TIGER
PLEASE TYPE IN A QUESTION THAT WOULD DISTINGUISH A TIGER 'FROM A CAT
? DOES IT LIVE I N THE JUNGLE FOR A T!GER THE ANSWER WOULD BE? YES ARE YOU THINKING OF AN ANIMAL? YES DOES IT SWIM? NO
DOES IT HAVE A TRUNK? NO DOES IT GO 'ARF? NO
DOES IT HAVE RETRACTIBLE CLAWS?
NO
IS IT A BIRD? NO
THE ANIMAL YOU WERE THINKING OF WAS A ?
cow
PLEASE TYPE IN A QUESTION THAT. WOULD I>ISTiNGlJISH A COW FROM A BIRD ? DOES IT GIVE MILK AND GO 'MOO'
",OR A COW THE ANSWER WOULD BE.7. YES ARE YOU THINKING OF AN ANIMAL? YES DOES IT SW I M? NO
DOES IT HAVE A TRUNK? NO DOES IT ·GO 'ARF? NO
DOES IT, HAVE RETRACTIBLE CLAWS? NO DOES IT GIVE MILK AND GO"MOO"? NO IS IT A BIRD? NO
THE ANIMAL YOU WERE THINKING OF WAS A ? GOAT
PLEASE TYPE IN A QUESTION THAT WOULD DISTHIGUISH A GOAT FROM A BIRD
? DOES IT GIVE MILK AND EAT TIN CANS AND ALMOST ANYTHING ELSE FOR A GOAT THE ANSWER WOULD BE? YES
ARE YOU THINKING OF AN ANIMAL? YES DOES IT SWIM? YES
DOES IT HAVE FLJ PPERS? NO IS
IT
A FISH? NOTHE ANIMAL YOU WERE THINKING OF WAS A ? WHALE
PLEASE TVPE IN A QUESTION THAT WOUL!> DISTINGUISH A WHALE FROM A FISH ? IS IT THE LARGEST KNOWN MAMMAL.
FOR A WHALE THE ANSWER WOULD BE? YES ARE 1'01:1 THINKING OF AN ANIMAL? LIST ANIMALS I ALREADY KNOW ARE;
SEAL ELEPHANT DOG CAT TI GER~
COW BIRD GOAT FISH WHALE
ARE YOU 'THINKING 'OF AN ANIMAL? YES . DOES H SWH'!? NO
DOES IT HAVE A TRUNK?· NO DOES IT
do
>ARf?.:/jo
,
DOES
IT
HAVE RETRACTIBLE CLAWS? NO DOES IT GIYE'.NILKAND GO 'MOO'? NO.DOES
IT GIVE MILK AND ERT .TIN CANS AND ALMOST ANYTHING ELSE?NO", :is
IT A BIM? NO18
THE -ANIMAL ,YOU' WERE THINKI.Nll OF WAS A .? SHEEP
PLEASE TYPE IN.' A QUESTION~THAT .WOULD DISTINGUISH A SHEEP FROM A BIRI>
? .DOES IT HAVE A WOOLY COAT AND SAY 'BAA, BAA' FOR A SHEEP THE ANSWER WOULD BE? YES
ARE· YOU THINKING ..
0"
,AN ANIMA!.? YES 'DOES" IT SWIM? NO .'DOES I T HAVE A TRU'NK? NO DOES IT GO 'ARF? NO
DOES IT HAVE RETRACTlBLE CLAWS? YES DOES,IT LIVE IN THE JUNGLE? YES IS IT A TIGER? NO
THE ANIMAL YOU WERE THINKING OF WAS A ? LION
PLEASE T'>'PE IN A QUEStION THAT WOULD DISTINGUISH A LION FROM A TIGER
? IS
It
THE KING OF THE JI,JNGLE . FOR .ILL ION THE ANSWER WOULD BE? YES':::
~g~. ;~:~~~;g g~ ~~ :~i~=t ~ ~~VE
ARE .VOU T.H.INKING OF AN ANIHAL? -C
AWARI
Description
My
HOME
6
000
000
1
5
4
000
000
000
000
2
3
My SIDE
3
2
000
000
000
000
4
5
Your SIDE
REMOVE BEANS FROM THE PITS
1
000
000
6
Your
HOME
AWARI game is played with seven sticks and thirty-six stones
(beans) laid out as shown above.
The board is divided into six
compartments (PITS) on 'my SIDE' and six on 'your SIDE'.
In
addition, there are two special PITS at the ends: 'my HOME'
and 'your HOME' •
A MOVE is made by taking all of the beans from any (non-empty)
PIT on your own SIDE.
Starting from the PIT to the right of
this one, these beans are 'SOWN' one in each PIT working around
the board anticlockwise.
A TURN consists of one or two MOVEs.
If the last bean of your
MOVE is SOWN in your own HOME you may take a second MOVE.
If the last bean SOWN in a MOVE lands in an empty PIT, provided
that the opposite PIT is not empty, all the beans in the opposite
PIT, together with the last bean SOWN are 'captured' and moved
to the player's HOME.
When either side is empty, the game is finished.
The player
with most beans in his HOME has won.
In the computer version, the board is printed as 14 numbers
representing the 14 PITS.
3
3
3
3
3
3
0
0
3
3
3
3
3
3
The PITS on your (lower) SIDE are numbered 1-6 from left to
right.
The PITS on my (the computer's) SIDE are numbered from
my left (your right).
To make a MOVE you type in the number of a PIT.
If the last bean
lands in your HOME, the computer types 'AGAIN?' and you then type
in your second move.
The computer's MOVE is typed, followed by a diagram of the board
in its new state.
The computer always offers you the first move.
This is considered to be a slight advantage.
There is a learning mechanism in the program that causes the
play of the computer to improve as i t plays more games.
computer Limitations
This program is written in DIGITAL PDP-II BASIC.
The only
unusual feature is that an IF statement may have the form:
IF (CONDITION) THEN (STATEMENT)
Whenever the IF condition fails, the program branches to the
next line.
Program Author
A version of AWARI, called KALAH, was submitted by Christopher
Stolz of Lexington High School.
The version published (also
known as BEANS) along with the description above was written by:
Geoff Wyvill
Bradford University
Bradford, Yorkshire, England
PROGRAM LISTING
5 DATA0
10 DIMB(13"G(13',f(50"Rf::ADN
lb FORI'~TO'"_I:READF(j)INtXlI
2i:1 PHINT-\PRINT "GA.ME OF ••• AWAHI ••• "\E.0 25 FDRI'0TOI21L.ETB(l"3INEX11
30 L.t TC'0: LETH")'0 :LETB (13) '01 LEH (6)'0
35 GOSU~50"
40 PRINTuYOuR MOVEIIJIGOSUB11f21
45 IFt:'0GOTU8~
50 IFM."'THtt~GCJSLJ!:l-10\A
55 IFE'.GOT(j80
60 PRINT/lt'1Y MovE IS 1I.IGOSUI:i800 65 IFEc~GOT080
10 IF!-ICHTHfNPRINT",
II,
IGOSUB800 75 IFf;:>i:GOTQ3!)80
PRINT:PRI~T"GAM~OvER"
85 LE.T D::I8(6) .. ~n13'IIF 0<0 THEN PRINT "I WIN BY",-D"POlf..ITS":GOTQ 2~
90 I..ETN=N+l11f.{).0THENPRI'''1"DR.AWN GAME"tGO'TO 20 95 PRINTuyOU wIN tlyuDuPOINTS"IGOT020
100 PRI~T'tA~A!NIIJ
1113 !I\iPUTM 11 F ,",·<7 T~EN IfM>0 THENlET"'.1-\"ll GOTO 130
120'PRlf'liTIIILLEGAL MOVE"*GOTOlo(J0
130 lfB(M)'"GOTO!2014~ LETH.b=GOSU~20a
150 GOTOSV'
20~ LETK :,"1: GOSlI86~J~
21215 LE::Tfilli:0 t IFK>6Tr-lENLETK=I\-7
2U~ L~TC=C.l: IFC<9THENLf.. TF (IV' -F (N) .0+1<
215 FORl=~T05;IF~(I)<>~TMEN230 22" NEXT I
225 RETURN
23~ F OR lOnG 12: IFB (I) <>OTHENLE Tt =11 RfT URN 235 GaTa 2?0
500 PRINTrPRINT" ~, 505 FORI=12T07STEP-!IGOSUB580
510 NEXT!
515 PRINT.LETI'13.G05UH580
520 PRINT," "1IPRINT~(0)IPRINT" II,
525 FOR I =,H051 GQSU8580
53~ Nt. ~ T I
535 PRINT:P~I~T:RlTURN
51"~ IFii(l)<l'HPiEN""'"lNru "1 585 PkINTB(l)JI~ETURN
600 LE.TP=bCM1 :LETK(M);r~
6k'5 FORI-' -PTe 1 S
n.p-
t :
LE r 1'1 =M ... t r I FM> 13 THENLET M.M-14 610 LI::.Tb(M).f3(~1)"'ltNEl(TP615 J Fl:j C M) _11!-lE N IF M<>ti THEN I FM<> 1 J T!-IEN 1 Fa (t 2-M) <>0GOT062ts 620 RI:.TI.JPN
625 LETa (H) cb (H, +6 (12-M) +1
,LF.
18 (") -0ILETa (12-M) =0: RETURN 800 LETD"9Y'lETH'13805 FORI.v.;T013ILEfG(I)=8CI)tNE)(TI 810 FORJ'7TO!2I1FB(J),.THE'885
815 LETQc~·:LETI"=JJGOSU8600 820 FDRr."T051IF"(!).~GOTG8'5
825 LtTI.-=ti(1)+I:L!::.TR=0
8~0 IFL>lJT~ENLETL_L·'4'LETR.lIGOT0830
835 I F8 (L) =V>THE~ IFL<>6 T HEN I FL<:> 13THENLE TR -B ( 12-L ) +R
84~ IFR'QT"E-LETQ'R
845 NEXT!
850 LUQ'dCI3)-6C6)-Q:IFC>8GOT0875
855 LETK'JIIFK>6T"I'.NLET<'K-7
B6Q1 FORI h'TuN .. l tIFF' (N) *0.1(= INl (F C 1) 16 ... C 7 .. C) .... 1' THc.NLEn~.Q-2 870 NEXT!
875 FQRl=v.T013:LET8(I)=GCI):NE'iTI 860 JFQ>cQTHENL~TA.JILETD=Q 885 NEXTJ
89t:'! LEH'·.A:PRINTCHR$(42"'1>\)' :GOT020~
901'l FORI:arJ:10N-1IPRINH(I):I\iE)(TJ
999 END
21
SAMPLE RUN
RUN
AlmRI 01:23 PM
GAME OF
AWARI
3 3
YOUR t1OVE? 5
]: J:
MY MOVE IS 2
]: 4 4 4
\'OUR MOVE? 4
AGAIN?
MY MOVE IS 4
(1 (1
YOUR MOVE?
5 0
o
4AGAI N?
MY MOVE IS 5 1 0 0
YOUR MOVE? 2
o
2AGAIN?
MY MOVE IS 6,1
1 1
o
YOIJR MOVE? 2
1. 1
(1 J
AGAIN? 4
t1Y MOVE IS
10
o
YOUR 11O'./£?
o
211
MY MOVE 15 G,4
o
1 0 214
-YOIJR MOVE? 5
o
o
214
o
o
GAt1E OVER
YOU WIN BY 1 POINTS
16-t'lFf)'-7J
3
4
4
8
4
7
4 9
10
8
o
1121
10 8
12 10
12 10
15
o
15
17
BAGLES
NUMBER LOGIC GAME
Description
The computer picks a 3-digit secret number and you attempt
to guess what i t is.
You are allowed up to twenty guesses.
No digit is repeated.
After each guess the computer will
give you clues about your guess as follows:
PICO
FERMI
BAGLES
One digit is correct, but in the wrong place
One digit is in the correct place
No digit is correct
You will learn to draw inferences from the clues and, with
practice, you'll learn to improve your score.
There are
several good strategies for playing BAGLES.
After you have
found a good strategy, see if you can improve it.
Or try
a different strategy altogether and see if it is any better.
This program was submitted from several sources including
Dartmouth and U.C.-Berkeley.
The one published here is
from U.C.
Program Authors
D. Resek, P. Rowe
Lawrence Hall of Science
University of California
Berkeley, CA
94700
PROGRAM LISTING
L ISTNH
REM
***
SAGLES NUMBER GUESSING GAME
1(1 R:Ef1 :f:*:+: ORIGINAL SOURCE U~~KNOrm BUT SUSPECTED TO BE LmJRENCE HALL
i5 REM OF SCIENCE, U. C BERKELEY. NO[)IFIED FOR TH1E5HARE(i-8 20 REM
***
B'r' STUDENTS OF L,.EiHNGTON HIGH SCHOOL.. ~lflmw
MO[HFIED FOR 25 REM"+:**
RSTS/E B"r' DAVE AHL OF [) I Gr
TAL 11/4~j GROUP30 DIM Al(6), A(3), Ben
40 F:At~DOM I ZE: "'=0: T=255
7/.3 INPUT "GAME OF SAGlES. I-lOULU YOU LIkE THE PULES (YES OR NO)"; A$ 90 IF A$="NO" THEN 150
100 PRINT:prHNT "I AM THINkINCi OF A THREE-DIGIT NU~1BER. TRY TO GUESS"
:110 PRINT "t1'r' NUr'1E:EP AND I "lILL GIVE VOU CLUES AS FOLLOHS
:1213 PRINT" PICO - emE DIGIT CORRECT 8UT IN THE "mONG POSITION" 110 PRINT" FERMI - ONE DIOIT CORRECT
mw
IN THE RIGHT POSITION"140 PRINT II BAGLES - NO DIGITS C()~~RECT"
150 FOR 1=1 .TO 3:
160 A(I)=INT(i0*RND;'
170 FOR J=l TO I-1 180 IF A(I)=A(J) THEN 160 19~3 NE;:.::T . .1
268 NE::<T I
210 PRINT PRINT
"0. K.
I
HAVEA
NUMBER INMIND. "
220 FOR 1=1 TO 20 23:0 PRINT "GUESS #"L
24~3 INPUT A$
2.'5~3 CHANGE At TO Ai
;;:-55 IF 8103){)3: THEN 610
:26(1 FOR ,J=1 TO 3 270 IF Al(.])<.:48 THEN 3:&.h) 280 IF A1('J»57 THEN :.:te0 2:::5 8(.J)=A1(,J)-48 290 Nn::T .J 295 GOTt) 3213
300 PRINT "WHAT?" 11121 GO TO 230
32121 IF 8(1.)=8(2) THEN 650 1]0 IF 8(2)=8(3) THEN 650 34121 IF 8(])=8(1) THEN 650 35121 (:=0: D=0
360 FOR ~T=l TO 2
370 IF A(J){)8(J+i) THEN 390 3:80 C=C+1
390 IF A(J+1){>8(J) THEN 410 400 C=(:+1
410 NE~--{T .J
420 IF 8(1)<>8(3) THEN 440 430 (:=C+1
44121 IF A(3)(>8<1) THEN 460
45~3 C=C+l
46(1 FOR ·J=1 TO 3
4713 IF A (.]){>8(,.1;' THEN 49.0 48.0 0=0+1
49~j NE::<T • .1
5~~H3 IF 0=3 THEN 680
52121 FOR ·J=i TO C 530 PRINT "-PICO "; 540 NEXT .J
5'30 FOR ,J=l TO D 560 PRINT "FERMI If; 570 NE::-::T . .1
580 IF C+D()O THEN 608 590 PRINT "8AGLES";
600 PRINT 6~35 NE::-::T I 610 PRINT "OH WELL"
615 PRINT "THAT'· S 20 GUESSES. ~1Y NU~1BER ~H1S ":tee*A(j.)':"10*AG~)+ACD 620 GOTO ?~J0
630 PRINT "TRY GUESSING A THREE-OUJIT NU~18ER. ": GOTO 230
65~3 PRINT "OH .. I FORGOT TO TELL 'r'ot) THAT THE Nu~mER I HAVE IN" 66121 PRINT "MIND HAS NO
nw
DIGITS THE ~~A~lE. ": GOTO ~~3ej 680 PRINT "YOU GOT IT!! !":PRINT6913 ',.'='1'+1
",::'00 INPUT "PLAY AGAIN ('r'ES OR NO;' ".; A$ ~?20 IF A$="'T'E5" THEN 156
7313 IF ¥=I) THEN 750
740 PRINT'PRINT "A"Y"- POINT SAGLES BUFF!!"
",:'50 PR I NT "HOPE YOU HAD FUN. BY'E."
999 EtiD
PEAD'r'
23
SAMPLE RUN
RUNNH
GRt1E OF 8AGlES WOULD 'T'OU LIKE THE FWLES ('T'ES OR NO)?
I At1 THINKING OF A THREE-DIGIT NUt1BER TR'1' TO GUESS t1Y NUt'lBER RND I L~ I Ll G I '.,.'E ,",'OU CLUES AS F'OLLOL~5:
PIca - ONE [:tIGIT CO~:f':ECT BUT IN THE L~f;.'ONG POSITION
FERMI - ONE DIGIT COFi:RECT ANG'. IN THE f.i:IGHT POSITION
SAGlES - NO DIG 1 TS (:ORf;.:ECT
O. K. J HRVE R WJMBEFi: J N t1 I ND GUESS '"' 1 ? :123:
PICa PICO
GUESS # _2 ? 412 PICO PICO
GUESS # J ? 215
PICO PICO FERtH
GUESS
"*
4 ? 251'·IOU GOT IT '!!
PLA';' AGAIN (',.'ES Of': NO)? 'T'ES
O. I< I HA'IJE A NUt1BER IN MIND
GUESS
"*
1 ? 123 PICa PICOGUESS # :::" ? 4L~ PICO FERtH
GUESS # J ? 2::t.5
PICO
GUESS # 4 ? 43:2 FEP'lI FERe1!
GUESS :It .':5 ? 43:1
',.'OU GOT IT! ,!
PL AY AGA! N ('r'ES OR NO)? '1'E:;
O. fC HRVE R NUMBER IN M! ND GUESS # 1 ? :123
PICO
GUESS # ? 451
HRGLES OU£S:; '"' 267 BAGLES GUESS :It 4 3:39
PICO PICO PICO
GUESS '"' .'5 ? ::393 PIC!) PICO PICO GUESS # 6" -~. 93·9
Y-OU GOT IT!! I
PLAY AGR 1 N (YES O~: NO) --;. ','ES
O .• 0: I HR',!E A NUMBER IN M I NO
GUESS '"' 1 1.23: HRGLE:;
GUESS # .~; 456
f~ICO
GUESS # ? 47::3 PICa
GUESS '"' 4 ? 57::3
PICO PICO
GUESS # ':5 ? 957 PICO FEf<:MI
GUESS :It 6" ? 75(1
PICO
CiUE5S :It 7 ? 985
l.~OU GOT IT!!!
PLR'r' AGAIN CT'ES OR rW)? '1'ES
O. f(. HAVE A NUt48ER IN tlIN!). GUESS -# ? :121
PJCO
GUESS 4t ? 145 BAGLES tJlJESS -# -~) 267 PICa
G.lJESS 4* 4 ? 176 BAGLES
GUESS '"' 5 ? 89:~
FERrll FE,"lI
(lUESS '"' 6" ? 802
PICO FERt11 GUESS :# 7 ? ~392 YOU GOT IT!!!
PLA'.,' . AGR I N ('1'ES OR NO)? NO
t1 5 - POINT 8AGLES BUFF!! HOPE YOU HAD FUN. B';'E.
READY
BANNER
PRINTS A LARGE BANNER
Description
This program creates a large banner on a terminal of any
message you input (up to 54 characters in length).
The
letters may be any dimension you wish although the letter
height plus distance from left-hand side should not exceed
6 inches.
Also, the letter height should be somewhat more
than the width.
Adhering to these rules will generally produce
a very attractive banner.
computer Limitations
BANNER was written for a DIGITAL EduSystem 50.
For other
computers, the character string line input (LINPUT) statement
at Line 240 would have to be changed.
Program Author
Daniel
R. Vernon
Butler Senior High School
Butler, PA
16001
PROGRAM LISTING
PROGRAM WRITTEN BY DANIEL R, VERNON SENIOR AT BUTLER SENIOR HIGH SCHOOL
BUTLER, PENNSYLVANIA !S001 OATE. 2I117l
COMPUTER SUPERVISION. MR, WILLIAM ELLIS COMPUTER TOPICS INSTRUCTION- HR, ALBERT SUWART IBB RE~
110 RE~
120
RE~130 RE~
14B RE~
150
REM 161 REMI"
REM 180 REMTHIS PROGRAM IS DESIGNED TO CREATE POSTERS
190 DIMGI(6), HI (6),
as
(9), G (e), A (U)20B PRINT"IN~UT HUGHTM, ~IDTH IN INCH!S'I\IN~UTL,R\S'I\"R.2\C'A
210 PRINT"HOW ~AR, IN INCHES FROM THE LEn HAND SlOE, DO YOU WANT TO PLACE' 220 PRINT"TH! LETTUS. "INPUTS\S'IZ.'
230 PRINT"INPUT MUSAGE HERE"
248 LINPUT8S(
II
,BI (2), 8S (3) ,BI (41, B1(5) ,8$ (5),es
(1) ,BS(8) ,81(9) 250 FORx.nOUTEP-1 \CHANGES. (X) TOAVORY.I T08\A (X'6-hy).A (Y) \NEXTY\NEXTX 250 FORX'IT06\READHI(Xl\NEXTX\MI.HI(L)"OSUB U0270 F.'. I \IF A
(n
.BTHENU0\G(0l.L \fORX'1 T05\G( X).A (F) \NfXTX\CHANGEGTOG, 280 fORX'1 T06\G(0)oX,CHANGEGTOGI (X) \NHTX290 FORX'I TOA/2\PRINT\NEXTX
300 IF' (F) . . 6THENS4s\ IF A (F) .3eTHEN990\IF A (F) .32TMEN63I\IF. (F)C48THEN210 305 IFA (F) >S1THENJIB\ONA
(F)
.41;OT0500, H0, 620,U5,
635, 55e, 61e,
605, 595,585 310 IF A (F) ce5THENZ1e\IF A (F) .'9THEN330320 DNA
(F
).64GOT0350, 360,310,380,398,400,4U,
430,440,450,460,470,480,490,500 330 IH.9mTHENZ10\ONA (F) -19GOT05 10,520,540,550, e60, 570;580,590,600,610,520 340 GOT0271345 FORXOI TOAVRINTTAB (5), GI, GI\NEXTX\GOT027m
350
GOSUBU0\GOSUB890\GOSU8540\GOTOZ'0350 GOSUBU0\GOSUB6S0\A.t _, e\GOSUBU0\4.t \GOSUB810\GOT0210 370 GOSUBe40\GOSUB1e0\GOSue'00\GOT0270
3B0 GOSUU4B\GOSUB100\A oC., 5\GOSUBe.0\A.C \GOSUS840\ GOT0270 390 GOSUB640\GOSUB6S0\GOSUBes0\ GOT0270
430 GOSUBU0\GOSUBe90\GOSUBe90\GOTOZ70
410 GOSUB640\Aot.,1S\GOSUB700\AoC.,2S\GOSUB650\A'C\GOSUB16e 420 AoCo,2S\GOSUB7I0\A_C\GOT0270
430 GOSUB640\GOSUB710\GOSUB640\GOT0270 440 GOSUe640\GOT0270
450 GOSUB750\GOSUe'40\GOSUB640\GOTOZ,e 460 GOSUBU0\GOSUes60\GOT0270 470 GOSUB540\GOSUB7 40\GOSUB' 40\ GOTOZ10 4 B 0 GOSU B 64 0 \ GO SUB e 9 0 \ GOS U 888 0\ GO SUB 6 4 0\ GO T 0 2 7 0 490 GOSU8640\GOSUB890\GOSUBU8\GOT0210 500 GOSUB640\GOSUB100\GOSUB640\GOTOZ'0 510 GOSUe640\GOSUB690\GOSUB19Z\GOTOZ10
520 GOSUB640\ UC., 1S\G.OSUB 700\4 0 ,2SoC\GOSU8650\A 0 C\GOSUB64 0 530 AOC.,2S\GOSUB710\A'C\GOT0270
540 GOaUB64 0\GOSUBe90\A.C •• S\GOSUBU0\GOSUB8I0\A.C \ GOT0270 550 GOlUB 770\GOSUB6S0\GOSUB760\GOT0270
se0 GOSUB7 80\GOSUB840\GOSUB7U\ GOTO 210 570 GOSUB640\GOSU" 40\ GOSUB640\GOT02'0 SBe GOSUB890\GOSU8880\GOT021a 585 GOSUB'90\ GOSUBe90\GOSU8640\GOT
0270
590 GOSUB640\GOSUB880\GOSUBS90\GOSUe640\GOT0270 595 GOSUBe40\GOSUB650\GOSUB640\GOT0270 600 GOSUS900\GOT02'0
805 GOSUB,S0\GOSUB'S0\GOSUB640\GOT02'0 810 GOSUS9'0\GOSUS800\GOSU8980\GOTOa10 615 GOSUS640\GOSUB650\GOSUB760\GOT0270 620 GOSUB920\GOT0270
625 GOSUB100\ GOSUB650\A.C *. s\GOSUBU0\A.C \GOSU8810\ GOT0210 630 GOSUB940\GOT02'0
635 GOSUB190\GOSUB'
\0\
GOSUB640\GOT0270649 FORU I TOA \PRINTT 4S es), \FO~xol TO 10\PR INTGI, \NEXTX\P~ INT\~EXTY\RETURN
650
IF ACI THEN660\GOT0810 86e LETA. I670 FOU'I TOA\PR INTT AS (5) ,Gu Gil HI' HU Gil GSI HSI HSI Gil G$\NUTX\RETURN 680 PRINTTAB(SII
800 FOAX'I TOAVRINTT A8 e4.LOS) 'GU Gil
Mil
HII Gil GI\NEXTX\RnURN '00 FORXol TOA\PRINTT AB (5)' Gu Gs "PRI NTHB e 8.L.Sll GS' GS\NEXTX\RETURN'10
IFAcITHEN120\GOT0130720 LETA'I
730 fORX'1 ToA\PR INTTAS (4'L 08)1 Gil GS\NEXTX\RETURN 140 FORXOI TOA\PR I NTT AB (S)' GIIGS\NEXTX\RETURN '50 FORxol TOA\PRINTT AS (S), Gil GUGSI GS\NEXTX\RETURN
750 FORY'I TOA \PRINTTAB e 8), GS, GSI G$, Gil
Gil
GSI
HII HS, Gil Gs\NEXTY\RETURN 770 FORXol TOAVR INTTAB (5),
Gil GilMil HS,
GI/ Gil GilGil Gil
GS\NUTX\RETURN 780 FORX'I TOA\PRINTTAS (SOLOS) 'Gil G"NEXTX\RETURN790 FORX'I TOA\PR INTTAS (4*L.S) 'GIIGSI GS/ Gil GU GS\NEXTX\RETURN 800 FORXol TOA \PR INTTAB (S " GSI GUGII Gil Gil Gs\NUTX\RETURN
810 FORX>! TOt/2\PRINTT AB (S)' \FORro! T02\FORZol TO (hL) .X\PRINTGI (I) I\NEXTZ 820 IFX.3THEN950\V>X
830 PRI NTH. ca.v) "~EXTY\PRINT\NEXTX\R!TURN
840 FORX>I TOCI2\PRINTTAB (5)' HI (X) ,VORY,I TOIBoL- (2.X "PRINTGI (I) "~EXTY\PRINT
85m NEXTX\RETURN
sem
FOR X.40L T07.LSTEP 14.V(c.e)
\PRINTTA8
(X.S), GilGil 01'
871
PRINTTAB('OL-X.Sl,GI/U,GS\NEXT X\RETURN880 FORx.noe.LSTEPS.L/C\PRINTT AB (X-S
I '.GSI
GS,GS,
GI\NEXTX\RETURN 890 FORX -S.L T00$TEP.e.L/C\PRI NTTAS (he), GS/ GS ,GS' GS\NEXTX\RETURN 900 FORx>no,oLSTEP (I40L) I (C.S) \PR INTT U (XOSl' Gil Gil Gil 910 PRINTT AB a'LoXo", Gil Gil GS\NEXT X\RETURN920 FORx.nO'.L5TEP (7oL) I (C'3) \PR INTT AS (5)' GU Gil TAB ex-s " Gil GS/GII 930 PRINTUB (hLoS)' GIIGS\NExrx\RETURN
UB FORX'I TOAo3\PRINT\NEXTX\RETURN
950 FORW.! TOX.3\PRINT· • I\NEXTW\ V'l\GOT0830
960 FORx.40L T01.L5TEPL 04/C\PRINTT
AB
(~.S) 'Gil Gil GI\NEXTX\RETURN 9'0 FOR Xo70L T04.LSTEP.4'L/C \PRINTTAB (XOS) 'GI, GI' GS\NEXTX\RETURN 980 DATA.M,"
It,"
.. ,.
",I'
","
",'"
990 FORX.ITOC*l\PRINT\NEXTX
1000
ENDSAMPLE RUN
~g~t1~A~~I ~~T7~c~i~T~F~~ ~~~H~~;! lJa~ND
$1 DE .. DO YOU VANT TO PLACE T:-IE LETTE~S? 1INPUT ~E5SAGE HEnE ? EuU 9
25
EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE EEEEEEEtEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE EEEEEEE'sEEEEEEEEEEEEEEEEEEEEE£EEEEEEEEEE EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE EEEEEEEE EEEEEEEE EEEEEEEE EEEEEEEE EEEEEEEE EEEEEEEE EEEEEEEE EEEEEEEE EEEEEEEE EEEEEEEE EEEEEEEE EEEEEEEE EEEEEEEE EEEEEEEE EEEEEEEE EEEE2EEE EEEEEEEE EEEEEEEE EEEEEEEE EEEEEEEE EEE£EEEE EEEEEEEE EEEEEEEE EE2EEEEE EEEEEEEE EEEEEEEE EEEEEEEE EEEEEEEE EEEEEEEE EEEEEEEE EEEEEEEE EEEEEEEE EEEEEEEEEEE.EEEEE EEEEEEEE EEEEEEEE
DDDDDDDDDDDDDDDDD[:DDDDDDDDDDDDDDDDDDDDDD DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD DDDDDDDD:CDD[!DDDDDDDDDDDD[!DDDDDDDDDDDDDDD DDDDDDDDDDDDDDDDDDDC'OODDDDDDDDDDDDDDDDDD DDDDDDDDDDDDDDDDC'L'DDDDDDGDDDDDDDDDDDDDDD DDDDIJDDr::.DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD
DCDDDDDD DDDDDDDL
DDDDDDDD DDLDDDDD
DDDDDDDD DDDDDDDD
DLDDDDDD LLDDDDDD
DDDDDDDD DDDDDDLD
LDDDDDDO DDDDDDDD