Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
39
Task/Brownian-tree/PureBasic/brownian-tree.basic
Normal file
39
Task/Brownian-tree/PureBasic/brownian-tree.basic
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
#Window1 = 0
|
||||
#Image1 = 0
|
||||
#ImgGadget = 0
|
||||
|
||||
#NUM_PARTICLES = 3000
|
||||
#width = 200
|
||||
#height = 200
|
||||
#xmax = #width -3
|
||||
#ymax = #height -3
|
||||
Define.i Event ,i ,x,y
|
||||
|
||||
If OpenWindow(#Window1, 0, 0, #width, #height, "Brownian Tree PureBasic Example", #PB_Window_SystemMenu )
|
||||
If CreateImage(#Image1, #width, #height)
|
||||
ImageGadget(#ImgGadget, 0, 0, #width, #height, ImageID(#Image1))
|
||||
StartDrawing(ImageOutput(#Image1))
|
||||
FrontColor($FFFFFF)
|
||||
Plot( Random(#xmax) , Random(#ymax ))
|
||||
StopDrawing()
|
||||
SetGadgetState(#ImgGadget, ImageID(#Image1))
|
||||
For i = 1 To #NUM_PARTICLES
|
||||
x = Random(#xmax)+1 : y = Random (#ymax)+1
|
||||
StartDrawing(ImageOutput(#Image1))
|
||||
While Point(x+1, y+1) + Point(x, y+1)+Point(x+1, y)+Point(x-1, y-1)+Point(x-1, y)+Point(x, y-1) = 0
|
||||
x = x + (Random(2)-1) : y = y + (Random(2)-1)
|
||||
If x < 1 Or x > #xmax Or y < 1 Or y > #ymax
|
||||
x = Random(#xmax)+1 : y = Random (#ymax)+1
|
||||
EndIf
|
||||
Wend
|
||||
Plot(x,y)
|
||||
StopDrawing()
|
||||
SetGadgetState(#ImgGadget, ImageID(#Image1))
|
||||
Next
|
||||
|
||||
EndIf
|
||||
|
||||
Repeat
|
||||
Event = WaitWindowEvent()
|
||||
Until Event = #PB_Event_CloseWindow
|
||||
EndIf
|
||||
Loading…
Add table
Add a link
Reference in a new issue