Problem 44208. Where's Waldo?
Interesting and fun problem! How about a test case with 'Waldo' hiding in an antidiagonal, or in reverse order in a diagonal?
"Waldo" can be hidden in reverse diagonals as well. The test suite generates a random configuration each time, so it just depends on your luck (or unluck) of where he is actually placed, and in which direction.
But test 4 in the test suite uses the line 'colDir = 1-rowDir', which means that it randomly places "Waldo" either horizontally or vertically, but never along diagonal direction (forward nor reverse), nor along anti-diagonal direction. One way to include those possibilities, would be to set 'colDir = 1', followed later by an extra 'flip(pb)' and/or 'transpose(pb)' randomly. However, still a very nice problem!
@yurenchu I see what you mean! I added another test suite to cover this now. Thanks!
Trivially, the answer should be given in a 5x2 matrix, not a 4x2. :)
I recommend adding to the description that Waldo must have all its letters following the same orientation (horizontal, vertical or diagonal) because there are other ways to find waldo when orientation is not an issue.
Solution CommentsShow comments
Problem Recent Solvers13
Return elements unique to either input
More from this Author2
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!