Draw a circle using plot.

STOS programming section.
Post Reply
miggymog
Posts: 6
Joined: Sun Sep 09, 2018 6:37 pm

Draw a circle using plot.

Post by miggymog » Fri Sep 14, 2018 8:42 pm

Code: Select all

10 flash off 
20 curs off 
30 timer=0
40 mode 0
50 key off 
60 palette 0,$700,$70,$7,$770,$707,$33,$737,$377
61 shift 1,2
70 cls
80 click off 
90 rem circle algo dec 15 :/)
100 X=0 : HX=159 : HY=99
110 input "Please enter Radius";R$
120 R=val(R$)
121 rem R=rnd(100)+1
122 remor R=1 to 100
130 Y=R : D=5-4*R
140 DA=12 : DB=20-(8*R)
150 while (X<=Y)
160 ink 1
170 plot HX+X,HY+Y
180 ink 2
190 plot HX+X,HY-Y
200 ink 3
210 plot HX-X,HY+Y
220 ink 4
230 plot HX-X,HY-Y
240 ink 5
250 plot HX+Y,HY+X
260 ink 6
270 plot HX+Y,HY-X
280 ink 7
290 plot HX-Y,HY+X
300 ink 8
310 plot HX-Y,HY-X
320 if (D<0) then D=D+DA : DB=DB+8 else dec Y : D=D+DB : DB=DB+16
330 inc X : DA=DA+8
335 wend 
340 locate 0,23 : print X,Y,timer
370 repeat : until hardkey=57
380 default : click off : mouseon 

Post Reply