player.h

/*

Programmer: Jennifer Leopold

Date: April 6, 2018

File: player.h

Purpose: This file contains the definition of a Player class.

*/

#ifndef PLAYER_H

#define PLAYER_H

#include <iostream>

#include <cstdlib>

#include "path.h"

#include "rescue.h"

using namespace std;

enum Pawn {RED, GREEN, BLUE, ORANGE};

struct Intersection

{

Pawn pawn;

unsigned int position;

};

const unsigned int NUM_INTERSECTIONS = 4;

const unsigned int NUM_PLAYERS_INTERSECTED_WITH = 2;

const Intersection INTERSECTIONS[NUM_INTERSECTIONS]

[NUM_PLAYERS_INTERSECTED_WITH] =

{{{BLUE, 23}, {GREEN, 32}}, // RED's intersections

{{RED, 23}, {ORANGE, 32}}, // GREEN's intersections

{{ORANGE, 23}, {RED, 32}}, // BLUE's intersections

{{GREEN, 23}, {BLUE, 32}}}; // ORANGE's intersections

const unsigned int NUM_PAWN_COLORS = 4;

const string PAWN_COLORS[NUM_PAWN_COLORS] =

{"red", "green", "blue", "yellow"};

class Player

{

private:

static const unsigned int INIT_NUM_LIVES = 3;

static const Pawn DEFAULT_PAWN = RED;

string m_name;

Path m_path;

Pawn m_pawn;

unsigned int m_numLives;

public:

Player();

Player(const string userName, const Pawn userPawn);

Path getPath() const { return(m_path); }

unsigned int getNumLives() const { return(m_numLives); }

string PawnToString() const { return(PAWN_COLORS[m_pawn]); }

friend ostream& operator <<(ostream& outs, const Player& p);

bool move(unsigned int numSpaces);

};

#endif