--- On Mon, 8/17/09, Mike Gillissie <Niyoto@xxxxxxxxxx> wrote: > From: Mike Gillissie <Niyoto@xxxxxxxxxx> > Subject: [gameprogrammer] Let's play... Name That Algorithm! :) > To: gameprogrammer@xxxxxxxxxxxxx > Date: Monday, August 17, 2009, 11:57 PM > > > > > > > > Hi folks! > > I'm in the middle of a > situation - I have a problem > I'm trying to solve, and it looks like the sort of > problem that has a very nice > algorithm named after some fine studious person. Here's > the skinny: > > At this point in my code I > have a square boolean > array that's used to indicate > "compatibilities" - so if I have 5 units and I > calculate each one's compatibility with each other unit > (as either a Yes or a > No), I might have values something like: > > compat[0][1]=true; > > compat[0][1]=true; > > compat[0][1]=true; > > compat[0][1]=true; > > I'm looking three redundant statements here. If I'm reading your description correctly, compat might look more like this: (adjust 0, 1 for true, false if you please) 0 1 2 3 0 [1, 1, 0, 1] 1 [1, 1, 1, 1] 2 [0, 1, 1, 0] 3 [1, 1, 0, 1] If you're testing to see if something along X is compatible with something along Y, you could #define OPTION1 0 #define OPTION2 1 and so on, then you could check with any pair like so : iscompat = compat[OPTION1][OPTION2] Is that what you're after? Vince~ --------------------- To unsubscribe go to http://gameprogrammer.com/mailinglist.html