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 #155 background imageLoading...
Page #155 background image
Line 38 Two characters are printed side by side: a space followed by a stick figure.
You
may wish
to
confirm that CHR$(l47) is the stick figure
by
entering
PRINT CHR$(1£17)
The space
is
required
to
erase the stick figure which was printed on the last cycle of
the loop.
Line
48 A delay loop
of
a fraction
of
a second is used
to
control the speed
at
which
the figure
"runs"
across the display. You might experiment a little by changing the
upper limit in the FOR statement
to
a smaller value, say 30,
and
then execute the
program. Try the same thing with a larger value, say 200. The upper limit
of
60
was
determined by trial and error
to
give a speed which "looked good."
Line
58 The NEXT I statement determines the end
of
the FOR / NEXT loop begun
in
line 20. Note that this program uses nested FOR/NEXT loops.
Experiment
#6
Generating Random Numbers
Computers can
be
used
to
simulate random events. This leads to many interesting and
useful applications. For example, you can use simulation
to
create such seemingly
diverse applications
as
interactive games and business decision-making models.
What makes simulation possible on a computer
is
the ability
to
generate random
numbers. The RND function can be used to return a number between
0 and 1 which
can be thought of as
"random"
in that the numbers appear
to
occur with equal
likelihood and unpredictability.
Clear memory using the NEW command and enter
PRINT RND(1)
to
obtain the random number
.585218£1388£1623
If
you again enter
PRINT RND(1)
you will get another random number
.10658628050158
If
you continue
to
print RND( I), you will generate a stream
of
random numbers.
Enter the program:
10 PRINT RND(1)
GoTo
10
and execute it.
If you watch the numbers scrolling by on the display, you will notice that they keep
changing and that they are all
in
the range from zero to one.
149
I

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