IsleOfView
asked on
Algorithm
I am looking for an algorithm that will allow you to add up squares and determine the individuals. OK...that doesn't make much sense. Here's an example. There are 4 options. The values to the options are 1, 2, 4, and 8 respectively. If the total of the options is 14, what routine would let me know that the 2nd, 3rd, and 4th option were picked?
ASKER
That works perfectly. (I think I need to hit the books to understand the syntax, though) :)
Please choose answer so I can give the points.
Please choose answer so I can give the points.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
#sorry, that second one should have been
for( 1..4 ){ print if 1<<$_-1 & 14 }
for( 1..4 ){ print if 1<<$_-1 & 14 }
print pos,"\n" while( /1/g );