Checking for rows and columns

Blitz3D Forums/Blitz3D Programming/Checking for rows and columns

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

I use this the check for 3 in a horizontal or vertical array of 10X10...
Function check_three()
ClearWorld(entities) ; to reset the world and NOT redraw the entitys on top 
; of each other AGAIN!!!
;
;To Check  UP and DOWN
For flirt=0 To 9
	For fart=0 To 7
		a=board(flirt,fart)
		b=board(flirt,fart+1)
		c=board(flirt,fart+2)
			If a = b Then
				If b = c Then
				kl=fart
				board(flirt,fart)=0
				board(flirt,fart+1)=0
				board(flirt,fart+2)=0
				For lk = kl To kl+2
					te=3
					CSP_LaunchParticle(0,tex,2,boardx(flirt),yf+3,boardz(lk),1,10,0.1,1,1,1,0,1.0)
				Next
				; maybe some points and a sound
				score = score+(35*sval)
				PlaySound yeah
				matchlev = matchlev+1
				EndIf			
			EndIf
	Next		
Next
; to check LEFT and RIGHT
For flirt=0 To 7
	For fart=0 To 9
		a=board(flirt,fart)
		b=board(flirt+1,fart)
		c=board(flirt+2,fart)
			If a = b Then
				If b = c Then
				kl = flirt
				board(flirt,fart)=0
				board(flirt+1,fart)=0
				board(flirt+2,fart)=0
				For lk = kl To kl+2
				te=3
				CSP_LaunchParticle(0,tex,2,boardx(lk),yf+3,boardz(fart),1,10,0.1,1,1,1,0,1.0)
				Next
				; maybe some points and a sound
				score = score+(55*sval)
				PlaySound happy	
				Animate wahoo,3
				matchlev=matchlev+1			
				EndIf	
			EndIf
	Next		
Next
End Function
It does other things if a sequenbce of 3 is found... If it finds L and R first the code is ended... it could be rewritten to find BOTH but I don't want to do that right now.
--RZ