Jump to content
IGNORED

Moar DLA


Christos

Recommended Posts

In my continuing effort to bring DLA to as many platfoms I own, here's an rb+ version. Honestly it's about as interesting as watching paint dry, but I am really fond of this algorithm so here it is:

'
' Your code goes here
' Have fun!
'
rlist=(RAPTOR_LIST *)strptr(RAPTOR_sprite_table)
basic_r_indx=1
basic_r_size=1
RLOCATE 0,202
RPRINT "          RAPTOR BASIC+ - REBOOT        "
basic_r_size=0
basic_r_indx=0
RLOCATE 0,218
RPRINT "        Derived from BCX BASIC v6       "
'set variables and arrays
dim screen[320,200] as short
dim x%,y%,counter%,d%,xo%,yo%,dnew%,sticky%,i%,j%,d2%,helperd!, distance!
dim dice!
for i%=0 to 319
	for j%=0 to 199
		screen[i%,j%]=0
	next j%
next i%
for i%=1 to 120
	vsync
next i%
cls
'logic
screen[160,100]=1
colour 10
'rlocate 160,100
'rprint("8")
plot(160,100)
xo%=0
yo%=0
x%=0
y%=0
d%=0
d2%=0
counter%=0
do
'let particle
	d%= 5 + int(counter%/12)
	xo% = 160+int(d%*cos(rnd*360))
	yo% = 100+int(d%*sin(rnd*360))
	x%=xo%
	y%=yo%

	sticky%=0

	while sticky% <> 1

		dice! = rnd

		if dice!<= 0.25 then
			x%=x%+1
			y%=y%


		elseif dice! >0.25 and dice!<= 0.5 then
			x%=x%-1
			y%=y%

		elseif dice! >0.5 and dice! <= 0.75 then
			y%=y% +1
			x%=x%
	
		elseif dice! >0.75 and dice! <=1 then
			y%=y% -1
			x%=x%

		end if
	if x%>319 or x%<1 or y%>199 or y%<1 then
		exit while
	end if
	'check for sticky
		if screen[x%+1,y%] or screen[x%,y%+1] or screen[x%,y%-1] or screen[x%-1,y%] =1 then
			sticky%=1
			screen[x%,y%]=1
			counter% =counter% +1
		        plot(x%,y%)
			print "particles:    ", counter%
		end if

	wend
loop

dla.abs

  • Like 5
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...