public int DetermineRent(IPlayer player, RealEstateSpace space)
        {
            if (space is UtilitySpace)
            {
                return DetermineUtilityRent(player.MostRecentRoll);
            }

            var railroadSpace = space as RailroadSpace;

            if (railroadSpace != null)
            {
                return DetermineRailroadRent(railroadSpace);
            }

            var propertySpace = space as PropertySpace;

            if (propertySpace != null)
            {
                return DeterminePropertyRent(propertySpace);
            }

            return 0;
        }
        public void PurchaseCurrentSpace(IPlayer player, RealEstateSpace space)
        {
            if (player.Cash >= space.Cost && !space.IsOwned)
            {
                player.Cash -= space.Cost;
                space.Owner = player;

                Console.WriteLine("{0} purchased \"{1}\" for ${2}.", player.Name, space.Name, space.Cost);
            }
        }
 private void BuyOrRent(IPlayer player, RealEstateSpace space)
 {
     if (space.IsOwned)
     {
         PayRent(player, space);
     }
     else
     {
         PurchaseCurrentSpace(player, space);
     }
 }
        public void PayRent(IPlayer player, RealEstateSpace space)
        {
            int totalRent = DetermineRent(player, space);

            if (space.Owner != player)
            {
                MoveCashFromBuyerToOwner(player, space.Owner, totalRent, space.Name);
            }
        }