-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLogicos.cpp
More file actions
73 lines (58 loc) · 1.12 KB
/
Logicos.cpp
File metadata and controls
73 lines (58 loc) · 1.12 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
#include "Logicos.h"
#include <cstdlib>
Logicos::Logicos(int difficulte)
{
switch(difficulte){
case 0 : _cmt = 10;
break;
case 1 : _cmt = 7;
break;
case 2 : _cmt = 5;
break;
}
_difficulte = difficulte;
_score_jeu = 0;
_val_rand = rand()%100;
_reussi = false;
}
void Logicos::set_reponse(int nb){
_reponse_user = nb;
}
int Logicos::get_val_rand(){
return _val_rand;
}
int Logicos::get_score_jeu(){
return _score_jeu;
}
void Logicos::set_score_jeu(){
switch(_difficulte){
case 0 : _score_jeu = 2;
break;
case 1 : _score_jeu = 4;
break;
case 2 : _score_jeu = 6;
break;
}
}
int Logicos::get_cmt(){
return _cmt;
}
void Logicos::set_cmt(int nb){
_cmt = nb;
}
bool Logicos::get_reussi(){
return _reussi;
}
int Logicos::compare(){
if(_reponse_user < _val_rand){
_cmt--;
return 1;
}else if(_reponse_user > _val_rand){
_cmt--;
return 2;
}else{
_reussi = true;
_cmt = 0;
return 0;
}
}