Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
18
Task/Brownian-tree/XPL0/brownian-tree.xpl0
Normal file
18
Task/Brownian-tree/XPL0/brownian-tree.xpl0
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
include c:\cxpl\codes; \intrinsic 'code' declarations
|
||||
def W=128, H=W; \width and height of field
|
||||
int X, Y;
|
||||
[SetVid($13); \set 320x200 graphic video mode
|
||||
Point(W/2, H/2, 6\brown\); \place seed in center of field
|
||||
loop [repeat X:= Ran(W); Y:= Ran(H); \inject particle
|
||||
until ReadPix(X,Y) = 0; \ in an empty location
|
||||
loop [Point(X, Y, 6\brown\); \show particle
|
||||
if ReadPix(X-1,Y) or ReadPix(X+1,Y) or \particle collided
|
||||
ReadPix(X,Y-1) or ReadPix(X,Y+1) then quit;
|
||||
Point(X, Y, 0\black\); \erase particle
|
||||
X:= X + Ran(3)-1; \(Brownian) move particle
|
||||
Y:= Y + Ran(3)-1;
|
||||
if X<0 or X>=W or Y<0 or Y>=H then quit; \out of bounds
|
||||
];
|
||||
if KeyHit then [SetVid(3); quit]; \restore text mode
|
||||
];
|
||||
]
|
||||
Loading…
Add table
Add a link
Reference in a new issue