コード例 #1
0
ファイル: Player.cs プロジェクト: Sherbanm/PowerGrid_old
        public int CalculateIncome()
        {
            var orderedPowerStations = PowerStations.OrderByDescending(p => p.Power);
            List <PowerStation> stationsThatCanBePowered = new List <PowerStation>();

            foreach (var powerStation in PowerStations)
            {
                if (CanPower(powerStation))
                {
                    stationsThatCanBePowered.Add(powerStation);
                }
            }
            return(stationsThatCanBePowered.Sum(p => p.Power));
        }
コード例 #2
0
ファイル: Player.cs プロジェクト: Sherbanm/PowerGrid_old
 public int GetBiggestPowerStation()
 {
     return(PowerStations.OrderByDescending(p => p.Value).FirstOrDefault()?.Value ?? 0);
 }