Types Question
Blitz3D Forums/Blitz3D Programming/Types Question
| ||
I'm looking for the most efficient way of comparing all the instances of a type with each other without checking the same cobination twice. This is how I'd do it with an array. Note that I don't want to have to make an array of types. Blahs = 10 for b = 1 to Blahs-1 for c = b+1 to Blahs compare ( b , c ) next next Cheers Stevie |
| ||
There may be a more magical way around this... What are you comparing them for? |
| ||
It's a custom collision engine ... |
| ||
Use an outer for each loop and an inner while loop to iterate types AFTER the current one while not null...Type mytype Field num End Type For i=1 To 7 m.mytype=New mytype m\num=i Next For b.mytype=Each mytype c.mytype=After b While c<>Null Print "Comparing "+b\num+","+c\num c=After c Wend Next WaitKey() |
| ||
Got yee .. will give this a try .. should work. |
| ||
Stevie, if this if for 2D, you may be interested in this. http://www.blitzbasic.com/codearcs/codearcs.php?code=1065 |