-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGamer.h
More file actions
87 lines (61 loc) · 1.3 KB
/
Copy pathGamer.h
File metadata and controls
87 lines (61 loc) · 1.3 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
//
// Created by sword on 22.01.2020.
//
#ifndef UNTITLED2_GAMER_H
#define UNTITLED2_GAMER_H
#include <string>
#include <iostream>
using namespace std;
class Gamer {
public:
string word;
string name;
std::deque<int> visited_symbols{};
Gamer(string name, int lives){
this->name = name;
this->lives = lives;
}
int lives;
void zanulenie(){
visited_symbols = {0};
}
void word_right_now(){
for (int i = 0; i < this->word.length(); i++){
if(this->visited_symbols[i] == 0){
std::cout << "* ";
}
if(this->visited_symbols[i] == 1){
std::cout << word[i]<<" ";
}
}
std::cout << std::endl;
}
bool checkWin()
{
for (int i = 0; i < this->word.length(); i++)
{
if (this->visited_symbols[i] == 0)
{
return false;
}
}
return true;
}
int lives_cnt()
{
return lives;
}
string get_name()
{
return name;
}
string get_word()
{
return word;
}
void lose()
{
lives--;
}
};
#endif //UNTITLED2_GAMER_H