EasyManuals Logo

Radio Shack TRS-80 Model 100 User Manual

Radio Shack TRS-80 Model 100
210 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #198 background imageLoading...
Page #198 background image
Return to the game by pressing
~.
In fact,
if
you press any key other than the
number keys, you will return to the game as indicated by the request for instructions
prompt. When you are ready to play the game, press
rn
to indicate No instructions.
Enter a
CD
for the length
of
sequence L. Enter
rn
for the number
of
notes N. The
display will clear and you will hear a single tone. Press either
CD
or
rn,
depending on which tone you think it is. A message will indicate whether you were
correct or not and the tone will be repeated with the correct key displayed. Your score
will be displayed.
After each play
of
the game you have three options:
1.
You can play another game at the same level
of
difficulty by pressing
CeNTERl.
Your score will reflect the percentage
of
correct responses
at
this level
of
difficulty.
2.
You can change the level
of
difficulty and continue to play the game by pressing
00.
You can increase the length
of
the sequence to test your ability
to
memorize random events. You can increase the number
of
different tones to test
your ability to recognize pitch. Your score from any previous levels
of
play will
be added to the present level score.
3. You can end the game by pressing
rn.
Explanation
of
the
program:
Line
lee
The display is cleared and the random number generator is initialized using
the current time in seconds.
Lines
IHt
125 The user may request instructions
or
proceed with the game. A
subroutine is used to wait for and return a single character from the keyboard. The
character is stored in the string variable A$. A subroutine is used to print out the
instructions
if
requested.
Notice that the IF statements in lines
120 and 125 are testing for both upper and lower
case characters. This is a useful technique which you may wish
to
incorporate in your
own programs. Since there is no way to know whether the CAPS LOCK key is
depressed
or
not, this technique ensures a correct response in either case.
Notice also that the IF statement in line
125
traps any key other than Y or N by
repeating the prompt. This technique is also useful in general
to
prevent undesired
reponses to mis-typed keys. This technique
of
"fool
proofing" should be used
whenever possible
to
prevent undesired program behavior.
Lines
130 132 Another way
of
trapping inappropriate keyboard input is illustrated.
If
a non-numeric key is pressed, then VAL(A$) returns a value
of
zero. The program
will then treat this the same
as
having pressed
(IJ.
Lines 134 - 136 The user is prompted to input the number
of
notes. Another trap is
used to prevent an inappropriate response.
Lines 142 -
200 A sequence
of
tones
of
length L is generated. A number from 1 to N
is randomly generated and stored
in the numeric array A(I). The frequency
of
the
tone, used in the SOUND statement, is related to the random number using the
formula
6000 - A(I)*500
192

Other manuals for Radio Shack TRS-80 Model 100

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Radio Shack TRS-80 Model 100 and is the answer not in the manual?

Radio Shack TRS-80 Model 100 Specifications

General IconGeneral
BrandRadio Shack
ModelTRS-80 Model 100
CategoryDesktop
LanguageEnglish

Related product manuals