Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Unique Solutions
Message
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00109528
Message ID:
00109777
Views:
48
>I have a 5 X 5 grid with each cell having a value of 1 or 0 depending on whether the cell is 'active' or 'inactive'. If 5 cells are active consecutively then it forms a row or column whichever the case may be. Under these conditioins there are 13 possible situations to take into account: 5 rows, 5 columns, 2 diagonals and the four corners plus the center square. I need to find a solution to determine which two are active or three or four for that matter without having to check something like if A = 1 and B =1, if A = 1 and C = 1, and so on....any ideas?
>
>Thanks.


You can try to align all zeros and ones in a single row and bitmask the result to test each situations...

HTH :0)
If we exchange an apple, we both get an apple.
But if we exchange an idea, we both get 2 ideas, cool...


Gérald Santerre
Independant programmer - internet or intranet stuff - always looking for contracts big or small :)
http://www.siteintranet.qc.ca
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform