2021 - Player
Actual Code
class Player
{
protected int piecesInSupply, fuel, VPs, lumber;
protected string name;
public Player(string n, int v, int f, int l, int t)
{
name = n;
VPs = v;
fuel = f;
lumber = l;
piecesInSupply = t;
}
public virtual string GetStateString()
{
return "VPs: " + VPs.ToString() + " Pieces in supply: " + piecesInSupply.ToString() + " Lumber: " + lumber.ToString() + " Fuel: " + fuel.ToString();
}
public virtual int GetVPs()
{
return VPs;
}
public virtual int GetFuel()
{
return fuel;
}
public virtual int GetLumber()
{
return lumber;
}
public virtual string GetName()
{
return name;
}
public virtual void AddToVPs(int n)
{
VPs += n;
}
public virtual void UpdateFuel(int n)
{
fuel += n;
}
public virtual void UpdateLumber(int n)
{
lumber += n;
}
public int GetPiecesInSupply()
{
return piecesInSupply;
}
public virtual void RemoveTileFromSupply()
{
piecesInSupply -= 1;
}
}
Things to note
Protected and virtual are used in this class, this heavily suggests that it will be used as a parent class in the future.
Constructor is used for this class.