mirror of
https://github.com/inexorabletash/jsbasic.git
synced 2024-12-21 16:30:19 +00:00
Add Sierpinski triangle by Helen Edgar
This commit is contained in:
parent
d7ebf753db
commit
ea61e845c7
@ -40,6 +40,7 @@ sample.hacker Hacker Logo (markwstock)
|
||||
sample.loreswalk Random LoRes (John Melesky)
|
||||
sample.hireswalk Random HiRes (John Melesky)
|
||||
sample.sierpinski Sierpinski Triangles (Kevin Miller)
|
||||
sample.sierpinski2 Sierpinski Triangles (Helen Edgar)
|
||||
sample.stringart String Art (Chris Heric)
|
||||
sample.paint Drawing Program (Brian Broker)
|
||||
sample.scribble Scribble (William Simms)
|
||||
|
17
samples/sample.sierpinski2.txt
Normal file
17
samples/sample.sierpinski2.txt
Normal file
@ -0,0 +1,17 @@
|
||||
10 Hgr
|
||||
15 Hcolor = 3
|
||||
20 let xa=140 : let ya=0
|
||||
30 let xb=0 : let yb = 159
|
||||
40 let xc=279 : let yc = 159
|
||||
50 Hplot xa,ya : Hplot xb,yb : Hplot xc,yc
|
||||
60 let x=INT(rnd(1)*40) : LET Y = INT(RND(1)*40)
|
||||
70 HPLOT X,Y
|
||||
80 D=(INT(RND(1)*3)) + 1
|
||||
85 PRINT D
|
||||
90 ON D GOTO 100,200,300
|
||||
100 X=INT((X + XA)/2) : Y=INT((Y + YA)/2)
|
||||
110 GOTO 70
|
||||
200 X=INT((X + XB)/2) : Y=INT((Y + YB)/2)
|
||||
210 GOTO 70
|
||||
300 X=INT((X + XC)/2) : Y=INT((Y + YC)/2)
|
||||
310 GOTO 70
|
Loading…
Reference in New Issue
Block a user