-
Notifications
You must be signed in to change notification settings - Fork 0
Crossword
abstract class crossword was created
input data is entered in form of .txt file, format is
v b r e e f i s h r a c h p
a n a c r o c o d i l e e b
a o s t r i c h t e g r d a
i a d d h c h e e t a h g d
b h r o d r a v e n e n e g
e y w d l s a m o l e l h e
a r t p v p r c b o l r o r
r h t o a a h c r o w a g h
c c a n n o r i a z e b r a
h a n y t a e k n i n a w a
bat
fish
crocodile
hedgehog
badger
ostrich
aardvark
bear
pony
ant
dolphin
mole
cheetah
raven
eel
crow
zebra
algorithm uses backtracking and must find all the listed words in the field stated in file
search in all 8 directions around the letter is available
if algorithm finds the letter that matches with the first letter of your word, it checks all 8 directions around for the second letter
if it finds the needed letter, the algorithm continues search in that direction
if the next letter in this direction does not match the next letter in our word, algorithm backtraks and erases all it had done
if the word is finished, it is being saved and algorithm keeps going from the position where the last word started, checking the field row by row
due to the fact that words can overlap each other, additional list of positions of all saved words is created
in the end, all the symbols that got lost, are being recovered from that list
final view of solved crossword is