This challenge was inspired by this Wendy's commercial from 1984.
Illustration by T S Rogers
Your task is to find a hexadecimal 0xBEEF on a binary bun.
The 'beef' consists of the following pattern:
1 0 1 1 (0xB)
1 1 1 0 (0xE)
1 1 1 0 (0xE)
1 1 1 1 (0xF)
And the 'bun' consists of a 12x12 binary matrix, such as:
1 1 1 0 0 1 1 1 1 1 1 0
1 1 0 1 0 0 1 0 0 0 0 0
0 1 0 0 0 1 1 1 1 1 0 1
1 0 0 1 0 0 1 0 0 1 0 0
1 0 0 1 0 1 1 0 0 1 1 1
1 1 1 1 1 1 0 0 0 0 1 0
1 1 0 1 1 1 0 0 0 0 0 1
1 0 0 1 1 1 1 0 0 0 0 1
1 0 0 1 1 1 0 1 1 1 1 1
1 1 1 1 1 0 0 1 1 1 1 1
1 0 0 0 0 1 0 1 0 1 1 1
1 1 0 0 1 1 0 0 0 0 1 1
Input
Your program or function will take the binary matrix as input. The matrix format is very flexible, but it must be clearly described in your answer.
For instance:
a single binary string, with or without separators between the rows:
"111001111110 110100100000..."
or:
"111001111110110100100000..."
an array of binary strings:
["111001111110", "110100100000", ...]
an array of numbers (each number describing a row once converted back to binary and left-padded with zeros):
[3710, 3360, ...]
Output
The coordinates (X, Y)
of the 'beef', (0, 0)
being the top left corner of the bun.
Alternatively, you may use 1-based coordinates (but not a mix of both formats, like 0-based for X and 1-based for Y).
For the above example, the expected answer is (3, 4)
(0-based) or (4, 5)
(1-based):
00 01 02 03 04 05 06 07 08 09 10 11
00 1 1 1 0 0 1 1 1 1 1 1 0
01 1 1 0 1 0 0 1 0 0 0 0 0
02 0 1 0 0 0 1 1 1 1 1 0 1
03 1 0 0 1 0 0 1 0 0 1 0 0
04 1 0 0 [1 0 1 1] 0 0 1 1 1
05 1 1 1 [1 1 1 0] 0 0 0 1 0
06 1 1 0 [1 1 1 0] 0 0 0 0 1
07 1 0 0 [1 1 1 1] 0 0 0 0 1
08 1 0 0 1 1 1 0 1 1 1 1 1
09 1 1 1 1 1 0 0 1 1 1 1 1
10 1 0 0 0 0 1 0 1 0 1 1 1
11 1 1 0 0 1 1 0 0 0 0 1 1
Again, any reasonable format would work as long as it is specified in your answer. Please also mention if you're using 0-based or 1-based coordinates.
Rules
- You can safely assume that there is always exactly one 'beef' on the bun. Your code is not required to support cases with more than one beef or no beef at all.
- The beef pattern will always appear as described. It will never be rotated or mirrored in any way.
- This is code-golf, so the shortest answer in bytes wins. Standard loopholes are forbidden.
Test cases
In the following test cases, each row of the matrix is expressed as its decimal representation.
Input : [ 3710, 3360, 1149, 2340, 2407, 4034, 3521, 2529, 2527, 3999, 2135, 3267 ]
Output: [ 3, 4 ]
Input : [ 1222, 3107, 1508, 3997, 1906, 379, 2874, 2926, 1480, 1487, 3565, 633 ]
Output: [ 3, 7 ]
Input : [ 2796, 206, 148, 763, 429, 1274, 2170, 2495, 42, 1646, 363, 1145 ]
Output: [ 6, 4 ]
Input : [ 3486, 3502, 1882, 1886, 2003, 1442, 2383, 2808, 1416, 1923, 2613, 519 ]
Output: [ 1, 1 ]
Input : [ 3661, 2382, 2208, 1583, 1865, 3969, 2864, 3074, 475, 2382, 1838, 127 ]
Output: [ 8, 8 ]
Input : [ 361, 1275, 3304, 2878, 3733, 3833, 3971, 3405, 2886, 448, 3101, 22 ]
Output: [ 0, 3 ]
Input : [ 3674, 2852, 1571, 3582, 1402, 3331, 1741, 2678, 2076, 2685, 734, 261 ]
Output: [ 7, 7 ]
(1,1)
)? \$\endgroup\$y
,x
(i.e. reverse order)? \$\endgroup\$