If you have a series of yes no values, one way is bitmask , where each bit represents one of the yes no values.
For example, let bit 0 (a bit numbered from right to left, starting at 0) be true for scoreIQ> = 4.0 and 0 otherwise.
Let bit 1 be true for scoreStrength> = 2.0 and 0 otherwise.
Let bit 2 be true for scorePatience> = 9.0 and 0 otherwise.
So, if you want to find out if someone has a high IQ and is very patient, but he is not very strong, you can use the AND operator with bit mask 101 to perform this test.
Other examples:
000 - person has poor IQ, is not strong, and is not patient 001 - person has good IQ, is not strong, and is not patient 011 - person has good IQ, is strong, and is not patient 110 - person has poor IQ, is strong, and is patient
As you add new criteria, you simply use a different bit for the new criteria.
So, to create a bitmask to check the characteristics you care about, you can simply do something like this:
source share