The word-search is a program in c++ that solves the problem of
searching words in a soup of characters. The soup is defined as a
matrix of characters of size
word-search will be divided in the following parts:
-
The input loader
-
The parser.
-
The solver.
-
The output handler.
The input loader will define how input is handled and introduced to the
program. For the moment, the case considered will be the input given as
a
The parser will be a collection of functions that take an ifstream to process the input file until all the information is stored as c++ data types. The parser have to consider multiple cases in order to collect the data correctly. For that reason let me define the input file format first.
The format of the .txt file will be as follows:
-
The first block is a single line with a pair of numbers
$N$ and$M$ separated by a space.$N$ is the number of rows and$M$ is the number of columns. -
The second block is a
$char$ matrix of$N$ rows and$M$ columns. -
The third block is a list of words to be searched in the matrix.
Now consider that the file may have comment lines anywhere including inside the blocks of inputs. Comment lines should be treated as if the parser had never seen them.
I will define the parser to be a set of functions that will take as input the .txt file and will return all the useful information interpretet as c++ data types. Such information could be:
-
The entry size of the matrix
$N$ and$M$ :$const\ int\ N, M$ . -
The declaration of the characters of the matrix:
$char[N][M]$ . -
The list of words to be searched:
$vector$ .
TODO: add definitions for the heat maps and their related ppm files generated from the movie titles search results