Note
that
we
have used the
same
trick as
above (under
Details)
to avoid negative values
ofY.
What
happens
if
you
change
line
40
to
40
RESET (X+126.Y)
and
RUN?
Then;
40
RESEKX+125.Y)
And RUN.
Don't
just
sit
there
—
try
them! See what
you
almost missed?
EXERCISE
20-3
:
Change
the
last
two
programs
so that
they
move
the
dot
up
and
to the
left
respectively.
[%
Now,
let's
have the dot
move down
until
it
strikes
a
barrier.
The
program
is:
10
INPUT
"HORIZONTAL STARTING POINT
(0
TO 127)
"(X
20
INPUT
"VERTICAL STARTING POINT
(0
TO
47)
";Y
30
INPUT
"
LOWER
BARRIER"
;K
40
CLS
50
FOR M=0 TO 127
60
SET (M,K)
70
NEXT
M
80
RESET
(
X
,
Y+47)
90
SET(X,Y)
100
Y=Y+1
I
117