I was wondering if there's a way to find out if given binary pattern, two or more of the 1's are within another binary pattern. I say pattern because the actual value of it does not determine if one is within another.
For example,
0001 1110 0000 0000
0001 1111 0000 0000
--> true
0001 0000 1100 0000
0001 1111 0000 0000
--> false
0001 1100 0000 1000
0001 0000 0000 1111
--> true
0001 1000 1100 0000
0001 0000 0000 1111
--> false
I tried using variety of AND/OR/XOR/NOT but not sure how to do it. Please help!
So the question about the data in question is like this:
const RANKS = [
0b0000000001110001,
0b0000001001000110,
0b0001001100000100,
0b0000000011011000,
];
I'm trying to loop over RANKS to see if it matches a pattern:
const PATTERNS = [
0b0001111100000000,
0b0000111110000000,
0b0000011111000000,
];
Only 2 of the 1's from RANK has to "fit" in PATTERN to consider as true