EasyManua.ls Logo

Radio Shack TRS-80 - Page 133

Radio Shack TRS-80
236 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
Loading...
200
FOR T
=
1 TO 52
210 PRINT A(T)
;
220
NEXT T
RUN
. . .
and
every cell
comes up zero.
If
you don't really
trust all this, change
line
90
to
read:
90 P
=
50
RUN
,
and see
what
happens,
AHA! It flushed out those
2
cards
in the sleeve,
didn't
it.
Reinitialize P
at
52,
eliminate
your
test program
lines
209,
210
and
220
and
you end up
with
a good card-drawing
routine.
You might
want
to clean it up
to your
satisfaction
and
save it on tape
for future
projects.
Question: Why
does the printing
of card
numbers
slow
down to a near
halt
as those
last
few
cards are being drawn.
Is the dealer
reluctant?
Answer:
The random
number
generator
has
to keep drawing
numbers until
it hits one that
is the array
address of an element
which
has not been
set to zero.
Near
the end
of the
deck,
almost all
elements have been
set to zero. The
random number
generator
has
to keep draw-
ing
numbers
as fast
as it can to find a
"live"
one.
Look
again
at the card numbers
printed.
There
will not be any
duplication.
No
stray aces.
There's More?
In the unlikely event
you have
a program
which
takes all
26
letter
variables,
you can use
array locations
to
serve
as
numeric variables.
Remember, however,
each
one
requires
4 times
as
much memory
space as
a simple letter of the alphabet.
Clear
out the memory.
Then type:
10 A(
870
)
=
3
20 A{ 871 )
=
4
30
2
=
A{ 870
)
*
A<
871
)
40 PRINT
A(870
)
,
A(871) ,Z
. .
,
and
RUN.
131

Other manuals for Radio Shack TRS-80

Related product manuals