-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWindowHandler.cpp
More file actions
70 lines (52 loc) · 1.64 KB
/
WindowHandler.cpp
File metadata and controls
70 lines (52 loc) · 1.64 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#include "WindowHandler.h"
// Prompts user for a file containg a puzzle to open and then displays the puzzle(solved or unsolved)
void openPuzzleFile(bool solved)
{
std::cout << "Please enter the name of the file you want to open" << std::endl;
std::string fileName;
std::cin >> fileName;
if (solved)
{
solvePuzzleFile(fileName);
return;
}
unsolvedPuzzleFile(fileName);
}
// Displays the puzzle generator
void displayPuzzleCreator()
{
std::cout << "How many words would you like in your puzzle?\n";
std::cout << "Enter A Number: ";
int numOfWords = 0;
std::cin >> numOfWords;
std::list<std::string> words;
std::cout << "\n";
for (int i = 0; i < numOfWords; i++)
{
std::cout << "Enter a word:";
std::string word;
std::cin >> word;
words.push_back(word);
}
std::vector<std::vector<char>> solvedGrid = createPuzzleGrid(words);
std::vector<std::vector<char>> unsolvedGrid = generateRandomCharacters(solvedGrid);
output2DVector(unsolvedGrid);
for (std::list<std::string>::iterator itWord = words.begin(); itWord != words.end(); ++itWord)
{
std::string word = *itWord;
std::cout << word << std::endl;
}
std::cin.clear();
std::cout << "\nWoud you like to save this puzzle?" << std::endl;
std::cout << "Enter yes or no: ";
std::string resp;
std::cin >> resp;
if (resp == "yes")
{
std::cout << "\nPlease enter a file name" << std::endl;
std::string fileName;
std::cin >> fileName;
savePuzzleToFile(unsolvedGrid, solvedGrid, fileName, words);
}
return;
}