There are n words (minimum of three letters in each word) supplied with a given word search board. The answer will contain n rows where each row contains the row and column indices where the word starts followed by an integer indicating the direction of the word. The direction integer runs from 1 to 8 and starts at 12 o'clock, running clockwise. So, a word spelled to the right (normal fashion) would be indexed as a 3 and facing downward to the left (SW) would be a 6.
The first board is included here for reference:
board = [ 'xcupa' 'dyrng' 'osbaq' 'exbid' 'wgamv' ];
words = {'aim'; 'bid'; 'cup'; 'doe'};
loc_ans = [ 3 4 5 4 3 3 1 2 3 2 1 5 ];
On the 2nd board, 'ice' can be found at position [3 3 1] as tested in the suite, but also at position [2 2 3]. It'd be better to remove the ambiguity.
Thanks for the catch. I just fixed it. I'll be extra cautious the next time that I use short words in a word search...
This solution would fail in certain boards. Can you add such a board to your testsuite?... this is a new variant of Cody: create a problem for the problem-creator... :)
HAHAHAHA
Master!!
Mr. Grant should take your quest... on that way maybe I reach the "leader score" for this problem! :-P
3655 Solvers
Rotate and display numbered tile
221 Solvers
Getting the indices from a vector
1450 Solvers
Square Digits Number Chain Terminal Value (Inspired by Project Euler Problem 92)
146 Solvers
120 Solvers