-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathhangman.cpp
567 lines (510 loc) · 43.8 KB
/
hangman.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
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
/*
Hangman Game by "Projektgrupp 1"
Authors: Anna Schwartz, Eric Grahn, Fredrik Storm
*/
#include <iostream>
#include <string>
#include <vector>
#include <random>
#include <fstream>
#include <locale>
#include <cstdlib>
#include <algorithm>
#include <iomanip>
#ifdef _WIN32
#include <windows.h>
#else
#include <unistd.h>
#endif
using namespace std;
void instructions();
void endGame(bool& gameIsRunning);
void endRunningRound(bool& roundIsRunning);
void showMenu(vector<string>& words, vector<string>& letters, string& guessString);
void gamePlay(vector<string>& words, string& guessString, bool& roundIsRunning);
string Randomizer(vector<string>list);
void splashScreen();
void clearScreen();
void sleepForSeconds(int seconds);
class HighScore
{
private:
string name;
int attempts;
public:
HighScore() : name("Chuck Norris"), attempts(1) {} //skapa temporära default värden
// fixa de här, de ska hantera flera namn
bool load(const string& filename) {
ifstream inputFile(filename);
if (inputFile) {
inputFile >> name >> attempts;
return true;
} else {
cerr << "Failed to open file for reading." << endl;
return false;
}
}
bool save(const string& filename) const {
ofstream inputFile(filename);
if (inputFile) {
inputFile << name << " " << attempts << endl;
return true;
} else {
cerr << "Failed to open file for writing." << endl;
return false;
}
}
bool isNewHighScore (int newAttempts) const {
return attempts > newAttempts;
}
void update (const string& newName, int newAttempts){
name = newName;
attempts = newAttempts;
}
void display() const {
clearScreen();
cout << " _ _ _ _ ____" << endl;
cout << "| | | (_) __ _| |__ / ___| ___ ___ _ __ ___" << endl;
cout << "| |_| | |/ _` | '_ \\ \\___ \\ / __/ _ \\| '__/ _ \\" << endl;
cout << "| _ | | (_| | | | | ___) | (_| (_) | | | __/" << endl;
cout << "|_| |_|_|\\__, |_| |_| |____/ \\___\\___/|_| \\___|" << endl;
cout << " |___/" << endl;
cout << endl;
if (name.empty()) {
cout << "No high score available." << endl;
} else {
cout << "1. " << name << " with " << attempts << " attempts." << endl;
cout << endl << endl << "Tryck på valfri tangent för att gå tillbaka till huvudmenyn." << endl;
}
cin.ignore();
cin.get();
}
};
class Game
{
private:
string wordToGuess;
string guessString;
string guessedLetters;
int maxAttempts;
char mysteryLetter;
public:
vector<char> incorrectGuesses;
bool hasGuessedString = false;
Game(const string& word, int maxAttempts = 10) : wordToGuess(word), maxAttempts(maxAttempts) {
guessedLetters = string(word.size(), '_');
mysteryLetter = selectMysteryLetter();
}
string randomword;
void drawHangman() const {
int error = incorrectGuesses.size();
if (error == 0) {
cout << endl;
cout << endl;
cout << endl;
cout << endl;
cout << endl;
cout << "" << endl;
cout << endl;
}
if (error == 1) {
cout << endl;
cout << endl;
cout << endl;
cout << endl;
cout << endl;
cout << " ______" << endl;
cout << endl;
}
if (error == 2) {
cout << endl;
cout << " |" << endl;
cout << " |" << endl;
cout << " |" << endl;
cout << " |" << endl;
cout << " |" << endl;
cout << " |______" << endl;
cout << endl;
}
if (error == 3) {
cout << " ______" << endl;
cout << " |" << endl;
cout << " |" << endl;
cout << " |" << endl;
cout << " |" << endl;
cout << " |" << endl;
cout << " |______" << endl;
cout << endl;
}
if (error == 4) {
cout << " ______" << endl;
cout << " | |" << endl;
cout << " |" << endl;
cout << " |" << endl;
cout << " |" << endl;
cout << " |" << endl;
cout << " |______" << endl;
cout << endl;
}
if (error == 5) {
cout << " ______" << endl;
cout << " | |" << endl;
cout << " | O" << endl;
cout << " |" << endl;
cout << " |" << endl;
cout << " |" << endl;
cout << " |______" << endl;
cout << endl;
}
if (error == 6) {
cout << " ______" << endl;
cout << " | |" << endl;
cout << " | O" << endl;
cout << " | |" << endl;
cout << " |" << endl;
cout << " |" << endl;
cout << " |______" << endl;
cout << endl;
}
if (error == 7) {
cout << " ______" << endl;
cout << " | |" << endl;
cout << " | O" << endl;
cout << " | /|" << endl;
cout << " |" << endl;
cout << " |" << endl;
cout << " |______" << endl;
cout << endl;
}
if (error == 8) {
cout << " ______" << endl;
cout << " | |" << endl;
cout << " | O" << endl;
cout << " | /|\\" << endl;
cout << " |" << endl;
cout << " |" << endl;
cout << " |______" << endl;
cout << endl;
}
if (error == 9) {
cout << " ______" << endl;
cout << " | |" << endl;
cout << " | O" << endl;
cout << " | /|\\" << endl;
cout << " | /" << endl;
cout << " |" << endl;
cout << " |______" << endl;
cout << endl;
}
if (error == 10) {
cout << " ______" << endl;
cout << " | |" << endl;
cout << " | O" << endl;
cout << " | /|\\" << endl;
cout << " | / \\" << endl;
cout << " |" << endl;
cout << " |______" << endl;
cout << endl;
}
}
void displayStatus() const {
clearScreen();
drawHangman();
cout << "Ord: ";
for (char c : guessedLetters) {
cout << c << " ";
}
cout << endl << "Felgissningar: ";
for (char ch : incorrectGuesses) {
cout << ch << " ";
}
cout << endl << "Antal f\u00F6rs\u00F6k kvar: " << maxAttempts - incorrectGuesses.size() << endl;
cout <<endl <<"För att avsluta spelet, tryck in 0.\n";
}
char selectMysteryLetter() {
string alphabet = "abcdefghijklmnopqrstuvwxyzåäö";
vector<char> possibleLetters;
for (char c : alphabet) {
if (wordToGuess.find(c) == string::npos) {
possibleLetters.push_back(c);
}
}
random_device rd;
mt19937 gen(rd());
uniform_int_distribution<> dis(0, possibleLetters.size() - 1);
return possibleLetters[dis(gen)];
}
bool guess(char letter, string input) {
string lowerInput = input;
transform(lowerInput.begin(), lowerInput.end(), lowerInput.begin(), ::tolower);
letter = tolower(letter);
if (lowerInput.length() == 1) {
bool correct = false;
if(isLetterGuessed(letter))
{
cout <<"Du har redan gissat på bokstaven " << letter <<" försök igen!" << endl;
sleepForSeconds(2);
return false;
}
//cout << "Mystisk bokstav: " << mysteryLetter << endl; // Debug
if (letter == mysteryLetter) {
cout << "Du träffade vår mystiska bokstav och är nu än mer närmare döden!\n";
incorrectGuesses.push_back(letter);
incorrectGuesses.push_back(letter); // Räknas som dubbla felgissningar
return false;
}
for (size_t i = 0; i < wordToGuess.size(); ++i) {
if (wordToGuess[i] == letter) {
guessedLetters[i] = letter;
correct = true;
}
}
if (!correct) {
incorrectGuesses.push_back(letter);
}
return correct;
} else {
hasGuessedString = true;
if (lowerInput == wordToGuess) {
//guessedLetters = wordToGuess;
cout << "Grattis! Du vann! " << "Du gissade r\u00E4tt ord: " << wordToGuess << endl
<< "Tryck på valfri tangent för att fortsätta." << endl;
cin.ignore();
cin.get();
return true;
}
else {
cout << "Fel gissning! Du har förlorat spelet." << endl;
sleepForSeconds(3);
return false;
}
}
}
bool endOfAttempts() const
{
return incorrectGuesses.size() >= maxAttempts || guessedLetters == wordToGuess || guessString == wordToGuess || hasGuessedString == true;
}
bool win() const
{
return guessedLetters == wordToGuess;
}
bool isLetterGuessed(char letter) {
// Kontrollera om bokstaven finns i guessedLetters eller incorrectGuesses
if (find(guessedLetters.begin(), guessedLetters.end(), letter) != guessedLetters.end()) {
return true;
}
if (find(incorrectGuesses.begin(), incorrectGuesses.end(), letter) != incorrectGuesses.end()) {
return true;
}
return false;
}
};
vector<string> loadWordsFromFile(const string& filename) {
vector<string> words;
ifstream file(filename);
if (!file) {
cerr << "Could not open the file " << filename << "\n";
return words;
}
string word;
while (getline(file, word)) {
if (!word.empty()) {
words.push_back(word);
}
}
return words;
}
void clearScreen() {
#ifdef _WIN32
// Windows-specific code
system("cls");
#else
// Unix-like system-specific code
cout << "\033[2J\033[1;1H";
#endif
}
void sleepForSeconds(int seconds) {
#ifdef _WIN32
Sleep(seconds * 1000);
#else
sleep(seconds);
#endif
}
void splashScreen() {
cout << endl << endl;
cout << "\e[38;5;250;48;5;7m▄\e[38;5;7;48;5;251m▄▄▄\e[38;5;7;48;5;7m▄\e[38;5;7;48;5;250m▄\e[38;5;250;48;5;249m▄\e[38;5;145;48;5;145m▄\e[48;5;248m \e[38;5;145;48;5;145m▄\e[38;5;248;48;5;248m▄\e[38;5;145;48;5;145m▄\e[38;5;101;48;5;245m▄\e[38;5;241;48;5;241m▄\e[38;5;241;48;5;59m▄\e[38;5;101;48;5;102m▄\e[38;5;238;48;5;239m▄\e[38;5;239;48;5;239m▄\e[38;5;240;48;5;239m▄▄\e[38;5;241;48;5;241m▄\e[48;5;145m \e[38;5;145;48;5;145m▄▄▄\e[38;5;249;48;5;250m▄\e[38;5;243;48;5;101m▄\e[38;5;247;48;5;144m▄\e[38;5;249;48;5;250m▄\e[38;5;249;48;5;249m▄\e[38;5;144;48;5;249m▄▄\e[38;5;101;48;5;246m▄\e[38;5;239;48;5;238m▄\e[38;5;236;48;5;239m▄\e[38;5;235;48;5;238m▄▄\e[38;5;234;48;5;236m▄\e[38;5;234;48;5;234m▄\e[38;5;233;48;5;239m▄\e[38;5;237;48;5;250m▄\e[38;5;144;48;5;187m▄\e[38;5;187;48;5;187m▄\e[38;5;187;48;5;223m▄▄\e[38;5;223;48;5;223m▄\e[38;5;230;48;5;223m▄\e[38;5;230;48;5;187m▄\e[38;5;223;48;5;223m▄▄\e[38;5;223;48;5;187m▄▄▄\e[38;5;254;48;5;187m▄\e[38;5;187;48;5;187m▄▄▄▄▄\e[38;5;223;48;5;187m▄\e[38;5;187;48;5;187m▄▄▄▄▄\e[38;5;187;48;5;144m▄\e[38;5;101;48;5;241m▄\e[38;5;238;48;5;239m▄\e[38;5;144;48;5;7m▄\e[38;5;251;48;5;7m▄\e[38;5;7;48;5;7m▄▄▄▄▄▄\e[38;5;251;48;5;7m▄▄▄\e[38;5;7;48;5;7m▄\e[m" << endl;
cout << "\e[38;5;145;48;5;250m▄▄▄▄\e[38;5;145;48;5;249m▄▄▄\e[38;5;145;48;5;145m▄\e[38;5;145;48;5;248m▄\e[38;5;145;48;5;145m▄▄▄\e[38;5;145;48;5;246m▄▄\e[38;5;144;48;5;245m▄\e[38;5;242;48;5;243m▄\e[38;5;239;48;5;238m▄\e[38;5;240;48;5;240m▄\e[38;5;241;48;5;59m▄▄\e[38;5;242;48;5;241m▄\e[38;5;145;48;5;145m▄▄\e[38;5;249;48;5;145m▄▄\e[38;5;145;48;5;145m▄\e[38;5;249;48;5;246m▄\e[38;5;101;48;5;246m▄\e[38;5;246;48;5;250m▄\e[38;5;242;48;5;144m▄\e[38;5;144;48;5;101m▄\e[38;5;95;48;5;59m▄\e[38;5;238;48;5;236m▄\e[38;5;237;48;5;235m▄\e[38;5;237;48;5;234m▄▄▄\e[38;5;237;48;5;233m▄\e[38;5;236;48;5;233m▄\e[38;5;233;48;5;232m▄\e[38;5;233;48;5;234m▄\e[38;5;234;48;5;241m▄\e[38;5;238;48;5;249m▄\e[38;5;187;48;5;187m▄\e[38;5;187;48;5;223m▄▄▄\e[38;5;223;48;5;187m▄\e[38;5;230;48;5;223m▄▄\e[38;5;223;48;5;223m▄\e[38;5;223;48;5;230m▄\e[38;5;223;48;5;223m▄▄▄\e[38;5;187;48;5;223m▄\e[38;5;223;48;5;187m▄▄▄\e[38;5;187;48;5;187m▄▄▄▄▄▄▄\e[38;5;187;48;5;250m▄\e[38;5;240;48;5;240m▄\e[38;5;241;48;5;242m▄\e[38;5;187;48;5;187m▄▄▄▄\e[38;5;187;48;5;251m▄▄▄\e[38;5;251;48;5;251m▄\e[38;5;7;48;5;251m▄▄\e[38;5;251;48;5;187m▄\e[m" << endl;
cout << "\e[38;5;187;48;5;249m▄\e[38;5;251;48;5;249m▄\e[38;5;7;48;5;145m▄\e[38;5;249;48;5;145m▄\e[38;5;145;48;5;145m▄▄▄▄▄▄▄▄▄▄\e[38;5;144;48;5;144m▄\e[38;5;240;48;5;59m▄\e[38;5;239;48;5;239m▄\e[38;5;240;48;5;240m▄\e[38;5;241;48;5;241m▄▄\e[38;5;243;48;5;242m▄\e[38;5;145;48;5;145m▄\e[38;5;249;48;5;145m▄\e[38;5;249;48;5;249m▄▄▄\e[38;5;246;48;5;144m▄\e[38;5;240;48;5;245m▄\e[38;5;240;48;5;246m▄\e[38;5;187;48;5;101m▄\e[38;5;187;48;5;223m▄\e[38;5;101;48;5;180m▄\e[38;5;240;48;5;101m▄\e[38;5;239;48;5;239m▄\e[38;5;238;48;5;238m▄▄▄▄\e[38;5;239;48;5;238m▄\e[38;5;239;48;5;237m▄\e[38;5;238;48;5;234m▄\e[38;5;234;48;5;233m▄\e[38;5;235;48;5;234m▄\e[38;5;238;48;5;242m▄\e[38;5;144;48;5;254m▄\e[38;5;187;48;5;223m▄\e[38;5;223;48;5;223m▄\e[38;5;230;48;5;229m▄\e[38;5;230;48;5;230m▄\e[38;5;229;48;5;223m▄\e[38;5;230;48;5;187m▄\e[38;5;230;48;5;223m▄\e[38;5;230;48;5;187m▄▄\e[38;5;223;48;5;223m▄\e[38;5;223;48;5;230m▄\e[38;5;223;48;5;223m▄\e[48;5;187m \e[38;5;187;48;5;187m▄▄▄▄▄▄\e[38;5;223;48;5;187m▄\e[38;5;187;48;5;187m▄▄\e[38;5;101;48;5;144m▄\e[38;5;240;48;5;242m▄\e[38;5;187;48;5;187m▄▄▄▄▄▄▄▄▄▄▄\e[m" << endl;
cout << "\e[38;5;187;48;5;187m▄▄\e[38;5;251;48;5;187m▄\e[38;5;7;48;5;251m▄\e[38;5;7;48;5;249m▄▄\e[38;5;250;48;5;249m▄\e[38;5;250;48;5;145m▄\e[38;5;249;48;5;145m▄▄▄\e[38;5;145;48;5;145m▄\e[38;5;249;48;5;145m▄\e[38;5;145;48;5;145m▄\e[38;5;247;48;5;144m▄\e[38;5;240;48;5;240m▄\e[38;5;239;48;5;239m▄\e[38;5;240;48;5;240m▄\e[38;5;59;48;5;241m▄\e[38;5;241;48;5;241m▄\e[38;5;247;48;5;245m▄\e[38;5;249;48;5;145m▄\e[38;5;249;48;5;249m▄▄▄▄\e[38;5;144;48;5;144m▄\e[38;5;144;48;5;95m▄\e[38;5;187;48;5;144m▄\e[38;5;223;48;5;223m▄\e[38;5;180;48;5;187m▄\e[38;5;95;48;5;137m▄\e[38;5;240;48;5;95m▄\e[38;5;240;48;5;101m▄\e[38;5;238;48;5;239m▄\e[38;5;237;48;5;238m▄\e[38;5;238;48;5;238m▄▄▄\e[38;5;239;48;5;239m▄\e[38;5;238;48;5;238m▄\e[38;5;235;48;5;234m▄\e[38;5;234;48;5;235m▄\e[38;5;235;48;5;235m▄\e[38;5;239;48;5;241m▄\e[38;5;187;48;5;187m▄\e[38;5;223;48;5;223m▄▄\e[38;5;223;48;5;230m▄\e[38;5;230;48;5;230m▄\e[38;5;223;48;5;223m▄\e[38;5;187;48;5;223m▄▄\e[38;5;187;48;5;229m▄\e[38;5;187;48;5;223m▄▄\e[38;5;223;48;5;223m▄\e[38;5;229;48;5;187m▄\e[38;5;223;48;5;187m▄▄▄▄\e[38;5;187;48;5;187m▄\e[38;5;223;48;5;223m▄▄\e[38;5;223;48;5;187m▄\e[38;5;187;48;5;187m▄\e[38;5;144;48;5;101m▄\e[38;5;59;48;5;239m▄\e[38;5;187;48;5;144m▄\e[38;5;187;48;5;187m▄▄\e[38;5;223;48;5;187m▄▄\e[38;5;187;48;5;187m▄▄▄▄▄▄\e[m" << endl;
cout << "\e[38;5;187;48;5;223m▄▄\e[38;5;187;48;5;187m▄▄▄\e[38;5;187;48;5;7m▄\e[38;5;187;48;5;250m▄\e[38;5;7;48;5;250m▄\e[38;5;250;48;5;250m▄▄\e[38;5;249;48;5;249m▄▄▄▄\e[38;5;247;48;5;247m▄\e[38;5;239;48;5;240m▄\e[38;5;239;48;5;239m▄▄\e[48;5;59m \e[38;5;59;48;5;241m▄\e[38;5;249;48;5;248m▄\e[38;5;249;48;5;249m▄▄▄▄\e[38;5;250;48;5;249m▄\e[38;5;249;48;5;249m▄\e[38;5;137;48;5;144m▄\e[38;5;180;48;5;187m▄\e[38;5;95;48;5;180m▄\e[38;5;237;48;5;95m▄\e[38;5;237;48;5;238m▄\e[38;5;238;48;5;238m▄\e[38;5;239;48;5;238m▄\e[38;5;238;48;5;236m▄\e[38;5;236;48;5;234m▄\e[38;5;235;48;5;234m▄\e[38;5;235;48;5;235m▄\e[38;5;235;48;5;237m▄\e[38;5;237;48;5;239m▄\e[38;5;239;48;5;239m▄\e[38;5;238;48;5;237m▄\e[38;5;236;48;5;235m▄\e[38;5;235;48;5;234m▄\e[38;5;238;48;5;239m▄\e[38;5;187;48;5;187m▄▄\e[38;5;187;48;5;223m▄\e[38;5;187;48;5;187m▄▄▄▄▄▄▄\e[38;5;187;48;5;223m▄▄\e[38;5;223;48;5;229m▄▄\e[38;5;223;48;5;223m▄\e[38;5;223;48;5;229m▄\e[38;5;223;48;5;230m▄\e[38;5;187;48;5;223m▄▄\e[38;5;181;48;5;223m▄\e[38;5;144;48;5;223m▄\e[38;5;144;48;5;187m▄\e[38;5;239;48;5;101m▄\e[38;5;101;48;5;241m▄\e[38;5;187;48;5;187m▄\e[38;5;187;48;5;223m▄\e[38;5;223;48;5;223m▄▄▄▄▄▄▄▄▄\e[m" << endl;
cout << "\e[38;5;7;48;5;187m▄▄\e[38;5;251;48;5;187m▄\e[38;5;187;48;5;187m▄▄▄▄▄\e[38;5;187;48;5;7m▄\e[38;5;187;48;5;250m▄▄\e[38;5;251;48;5;250m▄\e[38;5;250;48;5;250m▄\e[38;5;250;48;5;249m▄\e[38;5;247;48;5;247m▄\e[38;5;239;48;5;239m▄\e[48;5;239m \e[38;5;240;48;5;239m▄\e[38;5;241;48;5;241m▄\e[38;5;241;48;5;59m▄\e[38;5;7;48;5;250m▄▄▄\e[38;5;251;48;5;250m▄\e[38;5;7;48;5;250m▄▄\e[38;5;251;48;5;7m▄\e[38;5;144;48;5;240m▄\e[38;5;239;48;5;240m▄\e[38;5;235;48;5;237m▄\e[38;5;234;48;5;236m▄\e[38;5;235;48;5;235m▄\e[38;5;238;48;5;238m▄▄\e[38;5;238;48;5;237m▄\e[38;5;235;48;5;235m▄▄\e[38;5;236;48;5;234m▄\e[38;5;237;48;5;235m▄\e[38;5;237;48;5;237m▄\e[38;5;238;48;5;238m▄\e[38;5;239;48;5;239m▄\e[38;5;237;48;5;236m▄\e[38;5;236;48;5;236m▄\e[38;5;237;48;5;237m▄\e[38;5;144;48;5;249m▄\e[38;5;251;48;5;187m▄\e[38;5;7;48;5;187m▄▄▄\e[38;5;251;48;5;187m▄▄\e[38;5;187;48;5;187m▄▄▄▄▄▄\e[38;5;223;48;5;187m▄\e[38;5;180;48;5;223m▄\e[38;5;144;48;5;223m▄\e[38;5;137;48;5;187m▄\e[38;5;101;48;5;144m▄\e[38;5;95;48;5;241m▄\e[38;5;237;48;5;239m▄\e[38;5;236;48;5;239m▄\e[38;5;237;48;5;239m▄\e[38;5;239;48;5;241m▄\e[38;5;237;48;5;242m▄\e[38;5;237;48;5;95m▄\e[38;5;239;48;5;101m▄\e[38;5;187;48;5;187m▄\e[38;5;223;48;5;223m▄▄▄▄▄▄▄▄\e[m" << endl;
cout << "\e[38;5;245;48;5;249m▄\e[38;5;247;48;5;250m▄\e[38;5;247;48;5;7m▄▄\e[38;5;7;48;5;7m▄\e[38;5;187;48;5;251m▄\e[38;5;187;48;5;187m▄▄▄▄▄▄▄▄\e[38;5;246;48;5;247m▄\e[38;5;239;48;5;239m▄\e[48;5;239m \e[38;5;240;48;5;240m▄\e[38;5;241;48;5;241m▄▄\e[38;5;187;48;5;7m▄\e[38;5;187;48;5;251m▄\e[38;5;187;48;5;187m▄▄\e[38;5;187;48;5;251m▄▄▄\e[38;5;144;48;5;250m▄\e[38;5;180;48;5;240m▄\e[38;5;101;48;5;239m▄\e[38;5;239;48;5;237m▄\e[38;5;95;48;5;237m▄\e[38;5;240;48;5;181m▄\e[38;5;240;48;5;239m▄\e[38;5;239;48;5;238m▄\e[38;5;237;48;5;237m▄▄▄▄\e[38;5;238;48;5;237m▄\e[38;5;239;48;5;238m▄\e[38;5;240;48;5;240m▄\e[38;5;239;48;5;237m▄\e[38;5;240;48;5;236m▄\e[38;5;237;48;5;238m▄\e[38;5;95;48;5;95m▄\e[38;5;144;48;5;7m▄\e[38;5;187;48;5;7m▄\e[38;5;251;48;5;7m▄\e[38;5;187;48;5;7m▄▄\e[38;5;187;48;5;251m▄▄\e[38;5;187;48;5;187m▄▄▄\e[38;5;180;48;5;187m▄\e[38;5;144;48;5;187m▄\e[38;5;101;48;5;180m▄\e[38;5;138;48;5;187m▄\e[38;5;240;48;5;101m▄\e[38;5;239;48;5;236m▄\e[38;5;235;48;5;236m▄\e[38;5;238;48;5;235m▄\e[38;5;236;48;5;236m▄▄\e[38;5;240;48;5;236m▄\e[38;5;238;48;5;237m▄\e[38;5;237;48;5;237m▄\e[38;5;237;48;5;239m▄\e[38;5;241;48;5;238m▄\e[38;5;187;48;5;187m▄\e[38;5;223;48;5;223m▄▄▄▄▄▄▄▄\e[m" << endl;
cout << "\e[38;5;240;48;5;240m▄\e[38;5;239;48;5;240m▄\e[38;5;240;48;5;240m▄\e[38;5;239;48;5;240m▄\e[38;5;238;48;5;243m▄▄▄\e[38;5;239;48;5;250m▄\e[38;5;241;48;5;187m▄\e[38;5;246;48;5;187m▄\e[38;5;187;48;5;187m▄▄▄▄\e[38;5;101;48;5;245m▄\e[48;5;239m \e[38;5;239;48;5;239m▄\e[38;5;240;48;5;240m▄\e[38;5;59;48;5;241m▄\e[38;5;241;48;5;241m▄\e[38;5;187;48;5;187m▄\e[38;5;223;48;5;223m▄▄▄▄▄\e[38;5;223;48;5;187m▄▄\e[38;5;180;48;5;180m▄\e[38;5;101;48;5;137m▄\e[38;5;239;48;5;240m▄\e[38;5;238;48;5;95m▄\e[38;5;238;48;5;240m▄\e[38;5;238;48;5;238m▄\e[38;5;237;48;5;238m▄\e[38;5;236;48;5;237m▄\e[38;5;237;48;5;237m▄\e[38;5;237;48;5;238m▄\e[38;5;239;48;5;238m▄\e[38;5;239;48;5;239m▄\e[38;5;240;48;5;240m▄▄\e[38;5;239;48;5;239m▄▄\e[38;5;237;48;5;236m▄\e[38;5;8;48;5;95m▄\e[38;5;187;48;5;7m▄\e[38;5;187;48;5;187m▄▄▄▄▄▄▄\e[38;5;144;48;5;187m▄\e[38;5;180;48;5;180m▄\e[38;5;237;48;5;101m▄\e[38;5;239;48;5;95m▄\e[38;5;236;48;5;238m▄\e[38;5;235;48;5;239m▄\e[38;5;238;48;5;239m▄\e[38;5;238;48;5;236m▄\e[38;5;236;48;5;236m▄\e[38;5;234;48;5;235m▄\e[38;5;236;48;5;238m▄\e[38;5;237;48;5;236m▄\e[38;5;238;48;5;239m▄\e[38;5;187;48;5;238m▄▄\e[38;5;187;48;5;242m▄\e[38;5;223;48;5;187m▄\e[38;5;223;48;5;223m▄\e[38;5;229;48;5;223m▄▄\e[38;5;223;48;5;223m▄▄▄▄▄▄\e[m" << endl;
cout << "\e[38;5;242;48;5;242m▄\e[38;5;242;48;5;243m▄\e[38;5;243;48;5;241m▄\e[38;5;101;48;5;241m▄▄\e[38;5;242;48;5;59m▄\e[38;5;240;48;5;240m▄\e[38;5;239;48;5;239m▄\e[38;5;239;48;5;238m▄\e[38;5;243;48;5;241m▄\e[38;5;187;48;5;7m▄\e[38;5;223;48;5;223m▄▄\e[38;5;187;48;5;187m▄\e[38;5;242;48;5;101m▄\e[38;5;239;48;5;239m▄▄\e[38;5;240;48;5;240m▄\e[38;5;241;48;5;241m▄\e[38;5;101;48;5;242m▄\e[38;5;223;48;5;223m▄\e[38;5;229;48;5;223m▄▄\e[38;5;223;48;5;223m▄\e[48;5;223m \e[38;5;223;48;5;223m▄▄▄\e[38;5;187;48;5;180m▄\e[38;5;240;48;5;95m▄\e[38;5;238;48;5;238m▄▄\e[38;5;238;48;5;237m▄\e[38;5;239;48;5;237m▄\e[38;5;238;48;5;236m▄▄▄\e[38;5;236;48;5;236m▄\e[38;5;237;48;5;237m▄\e[38;5;239;48;5;240m▄\e[38;5;240;48;5;240m▄▄\e[38;5;239;48;5;240m▄\e[38;5;238;48;5;238m▄\e[38;5;240;48;5;238m▄\e[38;5;187;48;5;101m▄\e[38;5;187;48;5;187m▄▄\e[38;5;7;48;5;187m▄\e[38;5;144;48;5;187m▄▄\e[38;5;101;48;5;187m▄\e[38;5;240;48;5;144m▄\e[38;5;237;48;5;144m▄\e[38;5;236;48;5;95m▄\e[38;5;239;48;5;95m▄\e[38;5;237;48;5;237m▄\e[38;5;236;48;5;235m▄\e[38;5;236;48;5;236m▄\e[38;5;236;48;5;233m▄\e[38;5;235;48;5;236m▄\e[38;5;237;48;5;237m▄\e[38;5;238;48;5;237m▄\e[38;5;239;48;5;235m▄\e[38;5;237;48;5;236m▄\e[38;5;238;48;5;237m▄\e[38;5;144;48;5;101m▄\e[38;5;223;48;5;223m▄\e[38;5;229;48;5;223m▄\e[38;5;229;48;5;229m▄▄▄\e[48;5;229m \e[38;5;223;48;5;223m▄▄▄▄▄▄\e[m" << endl;
cout << "\e[38;5;238;48;5;242m▄\e[38;5;240;48;5;241m▄\e[38;5;240;48;5;242m▄\e[38;5;239;48;5;243m▄\e[38;5;240;48;5;101m▄\e[38;5;240;48;5;241m▄\e[38;5;241;48;5;240m▄\e[38;5;59;48;5;241m▄\e[38;5;239;48;5;239m▄\e[38;5;101;48;5;101m▄\e[38;5;187;48;5;187m▄\e[38;5;187;48;5;223m▄\e[38;5;223;48;5;223m▄\e[38;5;250;48;5;180m▄\e[38;5;241;48;5;241m▄\e[38;5;239;48;5;239m▄▄\e[38;5;240;48;5;240m▄\e[38;5;241;48;5;241m▄\e[38;5;144;48;5;246m▄\e[38;5;223;48;5;223m▄▄▄▄▄\e[38;5;229;48;5;223m▄▄▄\e[38;5;223;48;5;187m▄\e[38;5;101;48;5;95m▄\e[38;5;239;48;5;238m▄\e[38;5;239;48;5;236m▄\e[38;5;237;48;5;234m▄\e[38;5;237;48;5;236m▄▄\e[38;5;238;48;5;238m▄\e[38;5;238;48;5;237m▄▄▄\e[38;5;237;48;5;238m▄\e[38;5;238;48;5;239m▄▄▄▄\e[38;5;248;48;5;247m▄\e[38;5;238;48;5;249m▄\e[38;5;237;48;5;144m▄\e[38;5;95;48;5;144m▄\e[38;5;240;48;5;101m▄\e[38;5;237;48;5;242m▄\e[38;5;235;48;5;241m▄\e[38;5;237;48;5;95m▄\e[38;5;237;48;5;235m▄\e[38;5;236;48;5;237m▄\e[38;5;234;48;5;234m▄\e[38;5;235;48;5;236m▄\e[38;5;237;48;5;236m▄\e[38;5;236;48;5;237m▄\e[38;5;235;48;5;237m▄\e[38;5;236;48;5;236m▄\e[38;5;237;48;5;236m▄\e[38;5;237;48;5;237m▄\e[38;5;144;48;5;238m▄\e[38;5;187;48;5;101m▄\e[38;5;223;48;5;144m▄▄\e[38;5;223;48;5;187m▄\e[38;5;229;48;5;229m▄▄\e[48;5;229m \e[38;5;229;48;5;229m▄▄\e[48;5;229m \e[38;5;229;48;5;229m▄▄\e[38;5;223;48;5;229m▄\e[38;5;223;48;5;223m▄▄▄▄\e[m" << endl;
cout << "\e[38;5;240;48;5;239m▄\e[38;5;243;48;5;242m▄\e[38;5;246;48;5;8m▄\e[38;5;246;48;5;243m▄\e[38;5;246;48;5;241m▄\e[38;5;243;48;5;240m▄\e[38;5;241;48;5;240m▄\e[38;5;59;48;5;241m▄\e[38;5;240;48;5;242m▄\e[38;5;245;48;5;245m▄\e[38;5;187;48;5;187m▄▄\e[38;5;144;48;5;187m▄\e[38;5;138;48;5;181m▄\e[38;5;138;48;5;7m▄\e[38;5;101;48;5;187m▄\e[38;5;242;48;5;144m▄\e[38;5;101;48;5;101m▄\e[38;5;144;48;5;101m▄\e[38;5;7;48;5;249m▄\e[38;5;187;48;5;187m▄\e[38;5;187;48;5;223m▄▄▄▄▄▄▄\e[38;5;223;48;5;223m▄\e[38;5;180;48;5;144m▄\e[38;5;101;48;5;240m▄\e[38;5;95;48;5;239m▄\e[38;5;237;48;5;238m▄\e[38;5;237;48;5;237m▄▄\e[38;5;237;48;5;238m▄▄\e[38;5;237;48;5;237m▄\e[38;5;237;48;5;238m▄\e[38;5;237;48;5;237m▄\e[38;5;237;48;5;238m▄▄\e[38;5;236;48;5;237m▄\e[38;5;236;48;5;236m▄\e[38;5;7;48;5;247m▄\e[38;5;237;48;5;233m▄\e[38;5;234;48;5;234m▄\e[38;5;236;48;5;238m▄▄\e[38;5;238;48;5;239m▄\e[38;5;237;48;5;236m▄\e[38;5;236;48;5;236m▄\e[38;5;237;48;5;237m▄\e[38;5;236;48;5;235m▄\e[38;5;236;48;5;236m▄\e[38;5;234;48;5;236m▄\e[38;5;237;48;5;238m▄\e[38;5;238;48;5;236m▄\e[38;5;95;48;5;237m▄\e[38;5;144;48;5;238m▄\e[38;5;230;48;5;101m▄\e[38;5;223;48;5;223m▄▄\e[38;5;229;48;5;223m▄▄\e[38;5;229;48;5;229m▄▄▄▄▄▄\e[48;5;229m \e[38;5;229;48;5;229m▄▄\e[38;5;229;48;5;223m▄\e[38;5;223;48;5;223m▄▄▄\e[m" << endl;
cout << "\e[38;5;241;48;5;240m▄\e[38;5;101;48;5;101m▄\e[38;5;144;48;5;144m▄▄\e[38;5;246;48;5;246m▄\e[38;5;243;48;5;243m▄\e[38;5;59;48;5;59m▄\e[38;5;240;48;5;241m▄\e[38;5;241;48;5;59m▄\e[38;5;246;48;5;247m▄\e[38;5;144;48;5;187m▄\e[38;5;138;48;5;144m▄\e[38;5;241;48;5;144m▄\e[38;5;239;48;5;137m▄\e[38;5;237;48;5;241m▄\e[38;5;237;48;5;240m▄\e[38;5;239;48;5;238m▄\e[38;5;238;48;5;239m▄\e[38;5;239;48;5;241m▄\e[38;5;241;48;5;246m▄\e[38;5;144;48;5;251m▄\e[38;5;187;48;5;187m▄▄▄▄▄▄▄▄▄\e[38;5;187;48;5;144m▄\e[38;5;95;48;5;138m▄\e[38;5;238;48;5;239m▄\e[38;5;237;48;5;237m▄▄\e[48;5;236m \e[38;5;235;48;5;236m▄▄▄\e[38;5;235;48;5;237m▄\e[38;5;235;48;5;236m▄\e[38;5;235;48;5;235m▄\e[38;5;235;48;5;236m▄\e[38;5;236;48;5;236m▄\e[38;5;238;48;5;101m▄\e[38;5;101;48;5;101m▄\e[38;5;180;48;5;101m▄\e[38;5;144;48;5;101m▄\e[38;5;235;48;5;235m▄\e[38;5;237;48;5;237m▄\e[38;5;237;48;5;238m▄\e[38;5;237;48;5;234m▄\e[38;5;235;48;5;236m▄\e[38;5;236;48;5;236m▄\e[38;5;238;48;5;236m▄\e[38;5;7;48;5;236m▄\e[38;5;187;48;5;239m▄\e[38;5;223;48;5;144m▄\e[38;5;223;48;5;187m▄\e[38;5;223;48;5;223m▄▄\e[38;5;223;48;5;229m▄\e[38;5;229;48;5;229m▄▄▄▄▄\e[38;5;223;48;5;229m▄▄\e[38;5;229;48;5;229m▄▄\e[38;5;223;48;5;229m▄\e[38;5;229;48;5;229m▄\e[38;5;223;48;5;229m▄▄▄▄\e[38;5;223;48;5;223m▄▄▄\e[m" << endl;
cout << "\e[38;5;240;48;5;240m▄\e[38;5;101;48;5;101m▄\e[38;5;246;48;5;246m▄\e[38;5;246;48;5;144m▄\e[38;5;101;48;5;246m▄\e[38;5;241;48;5;242m▄\e[38;5;240;48;5;240m▄\e[38;5;243;48;5;241m▄\e[38;5;138;48;5;242m▄\e[38;5;101;48;5;144m▄\e[38;5;240;48;5;138m▄\e[38;5;238;48;5;239m▄\e[38;5;239;48;5;239m▄\e[38;5;237;48;5;240m▄\e[38;5;236;48;5;236m▄\e[38;5;237;48;5;237m▄▄▄\e[38;5;238;48;5;239m▄\e[38;5;241;48;5;241m▄\e[38;5;101;48;5;247m▄\e[38;5;187;48;5;187m▄▄▄▄▄▄▄▄▄▄\e[38;5;223;48;5;187m▄\e[38;5;59;48;5;237m▄\e[38;5;237;48;5;236m▄▄\e[38;5;235;48;5;235m▄▄\e[38;5;234;48;5;234m▄▄\e[38;5;235;48;5;234m▄\e[38;5;234;48;5;235m▄\e[38;5;235;48;5;234m▄\e[38;5;236;48;5;235m▄\e[38;5;239;48;5;235m▄\e[38;5;241;48;5;242m▄\e[38;5;242;48;5;101m▄\e[38;5;144;48;5;144m▄\e[38;5;180;48;5;187m▄\e[38;5;144;48;5;144m▄\e[38;5;95;48;5;236m▄▄\e[38;5;101;48;5;238m▄\e[38;5;223;48;5;238m▄\e[38;5;223;48;5;137m▄\e[38;5;223;48;5;223m▄▄▄▄\e[48;5;223m \e[38;5;223;48;5;223m▄▄▄\e[38;5;223;48;5;229m▄▄▄▄▄\e[38;5;223;48;5;223m▄\e[48;5;223m \e[38;5;223;48;5;223m▄▄▄\e[48;5;223m \e[38;5;223;48;5;223m▄▄▄▄▄▄▄\e[m" << endl;
cout << "\e[38;5;240;48;5;240m▄\e[38;5;245;48;5;101m▄\e[38;5;247;48;5;246m▄\e[38;5;246;48;5;246m▄\e[38;5;101;48;5;101m▄\e[38;5;59;48;5;241m▄▄\e[38;5;240;48;5;101m▄\e[38;5;239;48;5;95m▄▄▄\e[38;5;237;48;5;238m▄▄\e[38;5;237;48;5;237m▄\e[38;5;237;48;5;236m▄▄\e[38;5;237;48;5;237m▄\e[38;5;238;48;5;238m▄\e[38;5;239;48;5;239m▄\e[38;5;242;48;5;101m▄\e[38;5;144;48;5;246m▄\e[38;5;223;48;5;187m▄▄\e[38;5;223;48;5;223m▄▄▄▄▄▄\e[38;5;223;48;5;187m▄\e[38;5;187;48;5;187m▄\e[38;5;144;48;5;223m▄\e[38;5;95;48;5;101m▄\e[38;5;59;48;5;239m▄\e[38;5;235;48;5;237m▄\e[38;5;235;48;5;235m▄\e[38;5;236;48;5;234m▄▄\e[38;5;236;48;5;233m▄\e[38;5;236;48;5;235m▄\e[38;5;234;48;5;234m▄\e[38;5;239;48;5;235m▄\e[38;5;240;48;5;239m▄\e[38;5;239;48;5;240m▄\e[38;5;240;48;5;240m▄\e[38;5;242;48;5;241m▄\e[38;5;101;48;5;101m▄\e[38;5;144;48;5;180m▄\e[38;5;144;48;5;144m▄\e[38;5;144;48;5;180m▄\e[38;5;180;48;5;187m▄▄\e[38;5;181;48;5;187m▄▄\e[38;5;187;48;5;223m▄\e[38;5;223;48;5;223m▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄\e[48;5;223m \e[38;5;223;48;5;223m▄▄▄▄▄▄▄▄▄\e[m" << endl;
cout << "\e[38;5;241;48;5;239m▄\e[38;5;242;48;5;101m▄\e[38;5;242;48;5;246m▄▄\e[38;5;242;48;5;101m▄\e[38;5;59;48;5;240m▄\e[38;5;241;48;5;239m▄\e[38;5;241;48;5;240m▄\e[38;5;138;48;5;95m▄\e[38;5;239;48;5;238m▄\e[38;5;238;48;5;239m▄\e[38;5;239;48;5;95m▄\e[38;5;237;48;5;237m▄\e[38;5;238;48;5;238m▄\e[38;5;237;48;5;237m▄\e[38;5;238;48;5;238m▄\e[38;5;237;48;5;238m▄\e[38;5;238;48;5;238m▄\e[38;5;240;48;5;239m▄\e[38;5;144;48;5;242m▄\e[38;5;187;48;5;144m▄\e[38;5;223;48;5;223m▄▄\e[38;5;187;48;5;223m▄▄\e[38;5;180;48;5;223m▄\e[38;5;144;48;5;187m▄\e[38;5;144;48;5;144m▄▄▄\e[38;5;95;48;5;180m▄\e[38;5;101;48;5;187m▄\e[38;5;239;48;5;144m▄\e[38;5;238;48;5;101m▄\e[38;5;235;48;5;241m▄\e[38;5;237;48;5;237m▄\e[38;5;236;48;5;235m▄\e[38;5;234;48;5;234m▄\e[38;5;235;48;5;234m▄\e[38;5;239;48;5;233m▄\e[38;5;240;48;5;240m▄▄\e[38;5;239;48;5;240m▄\e[38;5;239;48;5;239m▄\e[38;5;241;48;5;240m▄\e[38;5;242;48;5;59m▄\e[38;5;101;48;5;101m▄\e[38;5;101;48;5;144m▄\e[38;5;246;48;5;144m▄\e[38;5;101;48;5;144m▄\e[38;5;144;48;5;144m▄\e[38;5;187;48;5;95m▄\e[38;5;144;48;5;144m▄\e[38;5;137;48;5;187m▄\e[38;5;144;48;5;187m▄\e[38;5;180;48;5;241m▄\e[38;5;187;48;5;223m▄▄▄\e[38;5;223;48;5;223m▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄\e[38;5;187;48;5;223m▄\e[m" << endl;
cout << "\e[38;5;240;48;5;59m▄\e[38;5;59;48;5;241m▄\e[38;5;240;48;5;241m▄\e[38;5;59;48;5;241m▄\e[38;5;240;48;5;59m▄\e[38;5;59;48;5;241m▄\e[38;5;240;48;5;241m▄\e[38;5;243;48;5;101m▄\e[38;5;242;48;5;137m▄\e[38;5;241;48;5;59m▄\e[38;5;238;48;5;237m▄\e[38;5;237;48;5;237m▄▄▄▄\e[38;5;237;48;5;238m▄\e[38;5;237;48;5;237m▄\e[38;5;237;48;5;239m▄\e[38;5;239;48;5;241m▄\e[38;5;101;48;5;144m▄\e[38;5;101;48;5;180m▄\e[38;5;59;48;5;144m▄\e[38;5;101;48;5;180m▄\e[38;5;239;48;5;137m▄\e[38;5;95;48;5;137m▄\e[38;5;239;48;5;144m▄First Time? - Hang Man 0.1\e[38;5;101;48;5;246m▄\e[38;5;101;48;5;144m▄\e[38;5;144;48;5;144m▄\e[38;5;101;48;5;180m▄\e[38;5;187;48;5;187m▄▄▄▄\e[38;5;223;48;5;223m▄▄▄▄\e[38;5;187;48;5;223m▄▄▄▄▄▄▄▄▄▄\e[38;5;187;48;5;187m▄▄▄▄▄▄\e[m" << endl;
cout << "\e[38;5;240;48;5;240m▄▄\e[38;5;239;48;5;239m▄▄▄\e[38;5;240;48;5;239m▄\e[38;5;59;48;5;240m▄\e[38;5;101;48;5;101m▄\e[38;5;246;48;5;101m▄\e[38;5;101;48;5;241m▄\e[38;5;59;48;5;239m▄\e[38;5;238;48;5;237m▄▄\e[38;5;236;48;5;237m▄▄\e[38;5;236;48;5;236m▄▄\e[38;5;238;48;5;236m▄\e[38;5;239;48;5;237m▄\e[38;5;235;48;5;237m▄\e[38;5;236;48;5;236m▄\e[38;5;235;48;5;236m▄▄\e[38;5;236;48;5;238m▄\e[38;5;237;48;5;237m▄\e[38;5;236;48;5;238m▄\e[38;5;235;48;5;237m▄\e[38;5;237;48;5;237m▄\e[38;5;236;48;5;236m▄\e[38;5;101;48;5;241m▄\e[38;5;144;48;5;137m▄\e[38;5;144;48;5;239m▄\e[38;5;95;48;5;59m▄\e[38;5;237;48;5;238m▄\e[38;5;239;48;5;238m▄\e[38;5;238;48;5;239m▄\e[38;5;238;48;5;237m▄▄\e[38;5;238;48;5;238m▄\e[38;5;240;48;5;239m▄\e[38;5;239;48;5;239m▄▄\e[38;5;239;48;5;240m▄\e[38;5;239;48;5;237m▄\e[38;5;239;48;5;240m▄\e[38;5;238;48;5;240m▄\e[38;5;238;48;5;239m▄\e[38;5;240;48;5;236m▄\e[38;5;59;48;5;241m▄\e[38;5;241;48;5;242m▄\e[38;5;241;48;5;243m▄\e[38;5;59;48;5;243m▄\e[38;5;241;48;5;243m▄\e[38;5;242;48;5;101m▄\e[38;5;101;48;5;247m▄\e[38;5;144;48;5;144m▄\e[38;5;101;48;5;180m▄\e[38;5;144;48;5;187m▄\e[38;5;180;48;5;187m▄\e[38;5;187;48;5;187m▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄\e[m" << endl;
cout << "\e[38;5;246;48;5;238m▄\e[38;5;144;48;5;238m▄\e[38;5;246;48;5;238m▄\e[38;5;144;48;5;238m▄▄▄▄▄\e[38;5;144;48;5;59m▄\e[38;5;144;48;5;241m▄\e[38;5;144;48;5;242m▄\e[38;5;95;48;5;238m▄\e[38;5;236;48;5;236m▄\e[38;5;237;48;5;236m▄▄\e[38;5;236;48;5;237m▄\e[38;5;240;48;5;237m▄\e[38;5;243;48;5;240m▄\e[38;5;101;48;5;101m▄\e[38;5;101;48;5;240m▄\e[38;5;101;48;5;236m▄\e[38;5;239;48;5;234m▄\e[38;5;239;48;5;236m▄\e[38;5;238;48;5;236m▄\e[38;5;238;48;5;235m▄\e[38;5;238;48;5;236m▄\e[38;5;239;48;5;236m▄\e[38;5;239;48;5;237m▄\e[38;5;144;48;5;239m▄\e[38;5;137;48;5;144m▄\e[38;5;95;48;5;137m▄\e[38;5;240;48;5;241m▄\e[38;5;237;48;5;238m▄\e[38;5;236;48;5;236m▄\e[38;5;239;48;5;239m▄\e[38;5;239;48;5;238m▄\e[38;5;239;48;5;239m▄\e[38;5;238;48;5;238m▄\e[38;5;238;48;5;237m▄\e[38;5;238;48;5;238m▄\e[38;5;237;48;5;239m▄\e[38;5;239;48;5;240m▄\e[38;5;238;48;5;238m▄\e[38;5;239;48;5;239m▄\e[38;5;238;48;5;238m▄▄\e[38;5;239;48;5;237m▄\e[38;5;239;48;5;239m▄\e[38;5;240;48;5;240m▄\e[38;5;240;48;5;59m▄\e[38;5;240;48;5;240m▄\e[38;5;240;48;5;239m▄\e[38;5;239;48;5;240m▄\e[38;5;240;48;5;59m▄\e[38;5;241;48;5;242m▄\e[38;5;242;48;5;101m▄▄▄\e[38;5;144;48;5;144m▄\e[38;5;181;48;5;144m▄\e[38;5;181;48;5;187m▄\e[38;5;187;48;5;187m▄\e[38;5;180;48;5;180m▄\e[38;5;144;48;5;144m▄\e[38;5;101;48;5;144m▄▄▄▄▄▄\e[38;5;101;48;5;250m▄\e[38;5;101;48;5;187m▄▄▄▄▄\e[38;5;245;48;5;187m▄\e[38;5;101;48;5;187m▄▄\e[38;5;101;48;5;251m▄\e[m" << endl;
cout << "\e[38;5;180;48;5;144m▄▄▄\e[38;5;144;48;5;144m▄\e[38;5;180;48;5;144m▄▄\e[38;5;180;48;5;180m▄▄▄▄\e[38;5;180;48;5;144m▄\e[38;5;245;48;5;144m▄\e[38;5;237;48;5;237m▄\e[38;5;239;48;5;238m▄\e[38;5;238;48;5;237m▄\e[38;5;235;48;5;236m▄\e[38;5;238;48;5;239m▄\e[38;5;239;48;5;241m▄\e[38;5;241;48;5;101m▄\e[38;5;242;48;5;101m▄\e[38;5;101;48;5;101m▄\e[38;5;243;48;5;240m▄\e[38;5;239;48;5;240m▄\e[38;5;59;48;5;240m▄\e[38;5;237;48;5;238m▄\e[38;5;238;48;5;239m▄▄\e[38;5;242;48;5;240m▄\e[38;5;180;48;5;144m▄\e[38;5;187;48;5;180m▄\e[38;5;187;48;5;144m▄\e[38;5;240;48;5;240m▄\e[38;5;236;48;5;237m▄\e[38;5;239;48;5;241m▄\e[38;5;242;48;5;239m▄▄\e[38;5;240;48;5;239m▄▄\e[38;5;59;48;5;239m▄\e[38;5;238;48;5;238m▄\e[38;5;240;48;5;238m▄\e[38;5;245;48;5;239m▄\e[38;5;240;48;5;239m▄\e[38;5;238;48;5;238m▄\e[38;5;238;48;5;237m▄\e[38;5;236;48;5;237m▄\e[38;5;238;48;5;238m▄\e[38;5;239;48;5;239m▄\e[38;5;239;48;5;240m▄\e[38;5;240;48;5;240m▄\e[38;5;239;48;5;240m▄\e[38;5;239;48;5;239m▄▄\e[38;5;239;48;5;240m▄\e[38;5;240;48;5;240m▄\e[38;5;240;48;5;59m▄\e[38;5;241;48;5;241m▄\e[38;5;101;48;5;241m▄\e[38;5;101;48;5;59m▄\e[38;5;242;48;5;101m▄\e[38;5;243;48;5;101m▄▄\e[38;5;101;48;5;138m▄\e[38;5;101;48;5;144m▄\e[38;5;101;48;5;101m▄\e[38;5;242;48;5;243m▄\e[38;5;239;48;5;243m▄\e[38;5;239;48;5;241m▄\e[38;5;59;48;5;242m▄\e[38;5;239;48;5;241m▄\e[38;5;240;48;5;243m▄\e[38;5;239;48;5;101m▄▄\e[38;5;239;48;5;242m▄\e[38;5;240;48;5;242m▄\e[38;5;239;48;5;241m▄\e[38;5;59;48;5;241m▄\e[38;5;239;48;5;241m▄\e[38;5;240;48;5;242m▄\e[38;5;240;48;5;243m▄\e[m" << endl;
cout << "\e[38;5;144;48;5;144m▄\e[38;5;144;48;5;180m▄\e[38;5;180;48;5;180m▄▄\e[38;5;180;48;5;7m▄\e[38;5;7;48;5;180m▄▄▄\e[38;5;144;48;5;180m▄\e[38;5;101;48;5;180m▄\e[38;5;242;48;5;180m▄\e[38;5;95;48;5;95m▄\e[38;5;59;48;5;240m▄\e[38;5;239;48;5;239m▄▄\e[38;5;238;48;5;238m▄\e[38;5;237;48;5;237m▄\e[38;5;239;48;5;239m▄\e[38;5;241;48;5;241m▄\e[38;5;241;48;5;59m▄\e[38;5;238;48;5;242m▄\e[38;5;236;48;5;239m▄\e[38;5;240;48;5;238m▄\e[38;5;240;48;5;241m▄\e[38;5;242;48;5;59m▄\e[38;5;236;48;5;238m▄▄\e[38;5;144;48;5;144m▄\e[38;5;180;48;5;180m▄\e[38;5;180;48;5;187m▄\e[38;5;101;48;5;187m▄\e[38;5;236;48;5;239m▄\e[38;5;59;48;5;95m▄\e[38;5;101;48;5;95m▄\e[38;5;101;48;5;144m▄\e[38;5;240;48;5;101m▄\e[38;5;144;48;5;59m▄\e[38;5;101;48;5;246m▄\e[38;5;101;48;5;241m▄\e[38;5;144;48;5;239m▄\e[38;5;101;48;5;245m▄\e[38;5;239;48;5;242m▄\e[38;5;101;48;5;239m▄▄\e[38;5;238;48;5;238m▄\e[38;5;236;48;5;236m▄\e[38;5;236;48;5;237m▄\e[38;5;239;48;5;239m▄▄\e[38;5;240;48;5;240m▄\e[38;5;239;48;5;239m▄▄▄▄\e[48;5;239m \e[38;5;239;48;5;240m▄\e[38;5;239;48;5;59m▄\e[38;5;240;48;5;240m▄\e[38;5;241;48;5;242m▄\e[38;5;240;48;5;59m▄\e[38;5;241;48;5;242m▄\e[38;5;242;48;5;243m▄\e[38;5;101;48;5;101m▄▄\e[38;5;241;48;5;242m▄\e[38;5;101;48;5;144m▄\e[38;5;144;48;5;101m▄\e[38;5;242;48;5;239m▄\e[38;5;237;48;5;237m▄▄\e[38;5;237;48;5;238m▄\e[38;5;237;48;5;237m▄\e[38;5;236;48;5;236m▄\e[38;5;236;48;5;237m▄\e[38;5;236;48;5;238m▄\e[38;5;236;48;5;237m▄▄\e[38;5;235;48;5;237m▄\e[38;5;236;48;5;239m▄\e[38;5;236;48;5;240m▄\e[m" << endl;
}
void instructions()
{
clearScreen();
cout << " ___ _ _ _ _" << endl;
cout << "|_ _|_ __ ___| |_ _ __ _ _| | _| |_(_) ___ _ __ ___ _ __" << endl;
cout << " | || '_ \\/ __| __| '__| | | | |/ / __| |/ _ \\| '_ \\ / _ \\ '__|" << endl;
cout << " | || | | \\__ \\ |_| | | |_| | <| |_| | (_) | | | | __/ | " << endl;
cout << "|___|_| |_|___/\\__|_| \\__,_|_|\\_\\\\__|_|\\___/|_| |_|\\___|_|" << endl << endl;
cout << "Dessa instruktioner & regler g\u00E4ller f\u00F6r H\u00E4nga Gubbe" << endl << endl
<< "Spelet handlar om att gissa ett slumpm\u00E4ssigt utvalt ord" << endl
<< "Ordet \u00E4r dolt och anges med understr\u00E4ck som visar hur m\u00E5nga bokst\u00E4ver ordet inneh\u00E5ller" << endl
<< "Du har 10 gissningar innan gubben h\u00E4ngs, f\u00F6r varje felaktigt gissat bokstav f\u00F6rlorar du en gissning " << endl
<< "F\u00F6r varje bokstav du gissar r\u00E4tt visas bokstaven i ordet" << endl
<< "Du kan gissa p\u00E5 hela ordet n\u00E4r som helst, men gissar du fel kommer omg\u00E5ngen att avslutas." << endl
<< "Under din spelomg\u00E5ng kommer en slumpm\u00E4ssig bokstav att r\u00E4knas som 2 gissningar. Du f\u00E5r inte veta vilken bokstav detta \u00E4r." << endl << endl
<< "Lycka till!" << endl << endl << endl;
cout << "Tryck på valfri tangent f\u00F6r att forts\u00E4tta" << endl;
cin.ignore();
cin.get();
}
void endGame(bool& gameIsRunning) {
gameIsRunning = false;
}
void showMenu(vector<string>& words, string& guessString) {
int choice;
bool gameIsRunning = true;
bool roundIsRunning = true;
HighScore highscore;
const string filename = "highscore.txt";
if (!highscore.load(filename)) {
cerr << "Failed to load high score." << endl << endl;
}
clearScreen();
do
{
clearScreen();
//cout << "Huvudmeny" << endl << endl
cout << " _ _ __ __ " << endl;
cout << "| | | | __ _ _ __ __ _ | \\/ | __ _ _ __ " << endl;
cout << "| |_| |/ _` | '_ \\ / _` | | |\\/| |/ _` | '_ \\" << endl;
cout << "| _ | (_| | | | | (_| | | | | | (_| | | | |" << endl;
cout << "|_| |_|\\__,_|_| |_|\\__, | |_| |_|\\__,_|_| |_|" << endl;
cout << " |___/" << endl << endl;
cout
<<"V\u00E4lj ett alternativ: " << endl
<< "1. Spela" << endl
<< "2. Highscore" << endl
<< "3. Instruktioner" << endl
<< "4. Avsluta" << endl << endl
<< "Ditt val: ";
cin >> choice;
switch(choice)
{
case 1:
gamePlay(words, guessString, roundIsRunning);
break;
case 2:
highscore.display();
break;
case 3:
cout << endl << "Instruktioner" << endl << endl;
instructions();
break;
case 4:
endGame(gameIsRunning);
break;
default:
cout <<"Felaktigt val, f\u00F6rs\u00F6k igen!" << endl;
break;
}
} while (gameIsRunning);
clearScreen();
splashScreen();
cout << endl << endl << setw(57) << "Tack f\u00F6r att du spelade!" << endl;
sleepForSeconds(3);
}
void endRunningRound(bool& roundIsRunning) {
roundIsRunning = false;
}
void gamePlay(vector<string>& words, string& guessString, bool& roundIsRunning){
string randomWord = Randomizer(words);
Game game(randomWord);
HighScore highscore;
const string filename = "highscore.txt";
cout << "Random word: " << randomWord << endl; // Debug
//cout << "Random letter: " << (game.mysteryLetter()) << endl; // Debug
sleepForSeconds(1);
int attempts = 0;
while(!game.endOfAttempts()) {
game.displayStatus();
cout << endl <<"Gissa en bokstav eller ord: ";
cin >> guessString;
if(guessString == "0") {
endRunningRound(roundIsRunning);
break;
}
if(!game.guess(guessString[0], guessString) || game.hasGuessedString) { // Behövs guessString här egentligen? Det är ju bara en bokstav som ska gissas och om det är en string ska vi hoppa direkt till förkorat eller vunnit?
if (!game.hasGuessedString) {
cout << "Fel gissning!" << endl;
sleepForSeconds(2);
}
} else {
if (!game.hasGuessedString) {
cout << "R\u00E4tt gissning!" << endl;
sleepForSeconds(2);
}
}
if(game.win()) { // Den här körs när man har gissat rätt bokstäver.
game.win();
int attempts = game.incorrectGuesses.size();
cout << "Grattis! Du vann! " << "Du gissade r\u00E4tt ord: " << randomWord << endl;
cout << "Antal felgissningar: " << attempts << endl;
string name;
if (highscore.isNewHighScore(attempts)) {
cout << "That's a new high score!" << endl;
cout << "Enter name: ";
cin >> name;
highscore.update(name, attempts);
if (!highscore.save(filename)) {
cerr << "Failed to save high score." << endl;
}
}
cout << endl;
cout << "Tryck p\u00E5 valfri tangent f\u00F6r att forts\u00E4tta" << endl;
cin.ignore();
cin.get();
break;
}
}
if(!game.win() && !game.hasGuessedString) { // Den här körs när man har gissat på hela ordet och får korrekt, vilket den inte ska
cout << "Spelet \u00E4r \u00F6ver! Ordet var: " << randomWord << endl
<< "Tryck p\u00E5 valfri tangent f\u00F6r att forts\u00E4tta" << endl;
cin.ignore();
cin.get();
}
}
string Randomizer(vector<string> list) {
random_device rd;
mt19937 gen(rd());
uniform_int_distribution<> dis(0, list.size() - 1);
int index = dis(gen);
return list.at(index);
}
int main ()
{
setlocale(LC_ALL, "sv_SE.UTF-8");
clearScreen();
splashScreen();
cout << endl << setw(57) <<"V\u00E4lkommen till spelet H\u00E4nga Gubbe!" << endl << endl << endl;
sleepForSeconds(3);
vector<string>words = loadWordsFromFile("words.txt");
string guessString;
showMenu(words, guessString);
return 0;
}