aboutsummaryrefslogtreecommitdiffstats
path: root/Player.cpp
blob: 48fb76c1f05c8520a2f6ef6630f0c9c289eb35cd (plain)
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
#include "Player.h"

Player::Player(int playerID) {
    _playerID = playerID;

    cout << "Enter Player " << playerID << "'s name:" << endl;
    cout << " > ";
    cin >> _name;
    cout << endl;

    cout << "Enter " << _name << "'s symbol:" << endl;
    cout << " > ";
    cin >> _symbol;
    cout << endl;
}

int Player::getPlayerID() {
    return _playerID;
}

string Player::getName() {
    return _name;
}

char Player::getSymbol() {
    return _symbol;
}

int Player::getMoveX() {
    int moveX = -1;
    while(moveX == -1) {
        cout << "Enter letter coordinate:" << endl;
        cout << " > ";
        string testMoveX;
        cin >> testMoveX;
        if(testMoveX == "A" || testMoveX == "a") {
            moveX = 1;
        } else if(testMoveX == "B" || testMoveX == "b") {
            moveX = 2;
        }
        else if(testMoveX == "C" || testMoveX == "c") {
            moveX = 3;
        }
        cout << endl;
    }
    return moveX;
}

int Player::getMoveY() {
    int moveY = -1;
    while(moveY == -1) {
        cout << "Enter number coordinate:" << endl;
        cout << " > ";
        string testMoveY;
        cin >> testMoveY;
        if(testMoveY == "1") {
            moveY = 1;
        }
        else if(testMoveY == "2") {
            moveY = 2;
        }
        else if(testMoveY == "3") {
            moveY = 3;
        }
        cout << endl;
    }
    return moveY;
}