-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
39 lines (34 loc) · 1.06 KB
/
main.cpp
File metadata and controls
39 lines (34 loc) · 1.06 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
using namespace std;
#include"wordle.cpp"
int main(){
string file = "wordlist";
string guessesWithSymbols[5];
time();
initDisplay();
int option = getMenuInput();
if(option == 1){
vector<string> words = readFile(file);
string wordToGuess = toLowerCase(pickWordToGuess(words));
displayGuesses(guessesWithSymbols);
for(int i = 0; i < 5; i++){
string guess = toLowerCase(getGuess("Please enter your guess"));
while(!isValidInput(guess)){
guess = getGuess("Your guess must be exactly 5 letter and contain no spaces or any other character. Please re-eneter your guess");
}
guessesWithSymbols[i] = parseGuess(guess, wordToGuess);
displayGuesses(guessesWithSymbols);
if(validateGuess(guess, wordToGuess)){
cout << "You win! It took you " << i << " attempt(s) to guess the word" << endl;
cout<<"your current streak is: "<<readStreak()<<endl;
playagain();
break;
}
}
cout << "You lost. The word was " << wordToGuess << ". Try again tomorrow." << endl;
playagain();
} else if (option == 2) {
debugMain();
} else {
exit(0);
}
}