-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
37 lines (30 loc) · 1.12 KB
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include <iostream>
#include "wordle_solver.h"
void help(char *argv[]) {
std::cout << "Use:" << std::endl;
std::cout << argv[0] << " wordlist hintlist [word_length=5]" << std::endl;
std::cout << "Worlist file contains one word per line.\n\
Hintlist contains one tried out word per line.\n\
Hints are formed as follows in the text file:\n\
- One tried word per line.\n\
- Each tried character separated by space.\n\
- Prefixed with '.' = this character belongs to this position.\n\
- Prefixed with '?' = this character does not belong here, but is in the word.\n\
- Prefixed with '!' character not in the word, or character used too many times and not in this position.\n";
}
int main(int argc, char *argv[]) {
if (argc < 3) {
help(argv);
return 1;
}
const std::string fname_wordlist(argv[1]);
const std::string fname_hintlist(argv[2]);
int word_length = 5;
if (argc >= 4) {
word_length = atoi(argv[3]);
}
WordleSolver solver(word_length);
solver.AddWordsFromFile(fname_wordlist);
solver.AddHintsFromFile(fname_hintlist);
solver.PrintPossibleSolutions();
}