Alright, I need some help on this Java project. I'm supposed to go through a matrix and find words solely on the horizontal, no vertical/diagonal. I know how to read shit from files, but I'm not terribly familiar with doing so from matrices. What's the best way I can do this? Also, how can I make my program so that I won't need to have an insane number if if-else statements and .equals()? I will post the provided code as well.
Here is the provided code. The wordslist and matrix files are provided as well, my job here is to edit it to make it work.
>>59834955
well, here's what I'd do
I'd make a function which collects all the possible strings starting from an index
so, given{ {'a', 'b', 'c'},
{'s', 'j', 'd'}
}
the function would return
{"a", "ab", "abc", "aj"} for the index [0][0]
then map that function to all indexes, and you have yourself all the possible words
then match that against the known set of words
and wallah, you have yourself words
>>59835091
Fuck off anon I didn't ask for your answer. I said to explain it to me. Not do my homework for me.
Smd
>>59834955
is the array one or two dimensional
>>59835375
it's a matrix
he just have to concatenate the arrays and use the java function to search in strings
it would be more interesting if it asked to find vertical and diagonal words
>>59834955
This is why I use haskell.words_in_list xs = intersect known_words (tails xs)
orwords_in = intersect known_words . tails . concat
if its two dimensional
>>59835131
Fuck off kid.