-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplayers.cpp
47 lines (38 loc) · 1010 Bytes
/
players.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
#include "players.hpp"
#include "board.hpp"
using namespace std;
players::players() : position(0), complete(false) {}
void players::set_name(string name) {
this->name = name;
}
string players::get_name() {
return name;
}
void players::set_position(int position) {
this->position = position;
}
int players::get_position() {
return position;
}
void players::set_complete(bool complete) {
this->complete = complete;
}
bool players::get_complete() {
return complete;
}
void players::move() {
board *Board = board::getBoard();
int step;
do {
cout << endl << name << "'s Turn" << endl;
cout << "Press ENTER to throw dice...";
cin.ignore();
cin.get();
step = Board->roll();
cout << "You Got a " << step << endl;
if (step + position <= 100) {
position = Board->snake_ladder(position + step, this);
}
this_thread::sleep_for(chrono::seconds(1));
} while (step == 6 && position != 100);
}