Question about a connect-four style system...

Blitz3D Forums/Blitz3D Beginners Area/Question about a connect-four style system...

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.

now this would work for connect four as well as other puzzle games
For dir=0 To 3
	amount=1
	For sign=-1 To +1 Step 2
		x=newpiecex
		y=newpiecey
		Repeat
			x=x+Ceil(Cos(dir*45))*sign
			y=y+Ceil(Sin(dir*45))*sign
			If outofgridboundary(x,y) Then Exit
			If grid(x,y)<>newpieceteam Then Exit
			amount=amount+1
		Forever
	Next
	;here is where the amount is finished adding, for this direction
	
	;just to clarify
	;dir 0 is right and left
	;dir 1 is upleft and downright
	;dir 2 is up and down
	;dir 3 is upright and downleft
	;ex. if dir is 0 and amount is 3, then the new piece created a horizontal 3-in-a-row

Next