|
template<class SolverDict > |
void | solve_index (const SolverDict &solver_dict, const WordsearchGrid &grid, const Index start_index, WordToListOfListsOfIndexes &word_to_list_of_indexes) |
| Find all possible words using solver_dict that may start at start_index in grid , and write them out to word_to_list_of_indexes . More...
|
|
template<class SolverDict > |
WordToListOfListsOfIndexes | solve (const SolverDict &solver_dict, const WordsearchGrid &grid) |
| Runs solve_index() on every element of grid to solve the whole wordsearch. More...
|
|
WordsearchGrid | make_grid (const std::vector< std::string > &lines) |
| Helper function to construct a WordsearchGrid
|
|
Classes to solve a wordsearch.
See example usage as in example/example.cpp
#include "wordsearch_solver/wordsearch_solver.hpp"
#include <fmt/core.h>
#include <fmt/format.h>
#include <fmt/ranges.h>
#include <initializer_list>
#include <string>
#include <string_view>
#include <vector>
int main() {
const std::vector<std::string> wordsearch = {
"adg",
"beh",
"cfi",
};
const std::initializer_list<std::string_view> dictionary = {"zoo", "badge",
"be", "beg"};
for (const auto& [word, indexes] : answer) {
fmt::print("{}: {}\n", word, indexes);
}
}
This class can be used to check if a particular dictionary solver implementation exists,...
Definition: solver.hpp:173
SolverDictWrapper make(const std::string_view solver, Words &&dictionary) const
Make a dictionary solver.
Definition: solver.tpp:330
Classes to solve a wordsearch.
Definition: solver.hpp:25
WordsearchGrid make_grid(const std::vector< std::string > &lines)
Helper function to construct a WordsearchGrid
Definition: solver.cpp:17
WordToListOfListsOfIndexes solve(const SolverDict &solver_dict, const WordsearchGrid &grid)
Runs solve_index() on every element of grid to solve the whole wordsearch.
Definition: solver.tpp:297