I have an array with 10x10, and a array with words:
const words = ['monkey', 'job', 'fat', 'iphone', 'glass', 'word', 'letter', 'pc'];
// board is hard coded for now.
const board = [
['x', 't', 'c', 'm', 'u', 'j', 'h', 's', 'x', 'm'],
['x', 't', 'c', 'm', 'u', 'j', 'h', 's', 'x', 'm'],
['x', 't', 'c', 'm', 'u', 'j', 'h', 's', 'x', 'm'],
['x', 't', 'c', 'm', 'u', 'j', 'h', 's', 'x', 'm'],
['x', 't', 'c', 'm', 'u', 'j', 'h', 's', 'x', 'm'],
['x', 't', 'c', 'm', 'u', 'j', 'h', 's', 'x', 'm'],
['x', 't', 'c', 'm', 'u', 'j', 'h', 's', 'x', 'm'],
['x', 't', 'c', 'm', 'u', 'j', 'h', 's', 'x', 'm'],
['x', 't', 'c', 'm', 'u', 'j', 'h', 's', 'x', 'm'],
['x', 't', 'c', 'm', 'u', 'j', 'h', 's', 'x', 'm']
];
And i need insert the words in both horizontally and vertically directions. Is there somesort of already discovered algorithm that does that?
Thank you.
via João Calvin
No comments:
Post a Comment