[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

Alright, I need some help on this Java project. I'm supposed

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 8
Thread images: 2

File: Project3.png (155KB, 827x954px) Image search: [Google]
Project3.png
155KB, 827x954px
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.
>>
File: provided code.png (50KB, 1340x893px) Image search: [Google]
provided code.png
50KB, 1340x893px
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)

or
words_in = intersect known_words . tails . concat

if its two dimensional
>>
>>59835131
Fuck off kid.
Thread posts: 8
Thread images: 2


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.