protected override void PerformYAction(int currentTurn) { var stationsWithMultiplePlayers = EnumFactory.All <StationLocation>() .Where(stationLocation => stationLocation.IsOnShip()) .Where(stationLocation => SittingDuck.GetPlayerCount(stationLocation) > 1); SittingDuck.KnockOutPlayers(stationsWithMultiplePlayers); }
private bool IsAnyPlayerPresent() { return(SittingDuck.GetPlayerCount(CurrentStation) != 0); }
protected override void PerformYAction(int currentTurn) { ChangeDecks(); Attack(SittingDuck.GetPlayerCount(CurrentStation)); }
internal void MoveToMostPlayers() { var adjacentStations = new[] { new { NewStation = CurrentStation.RedwardStationLocation(), MoveCommand = new Action(MoveRed) }, new { NewStation = CurrentStation.BluewardStationLocation(), MoveCommand = new Action(MoveBlue) }, new { NewStation = CurrentStation.OppositeStationLocation(), MoveCommand = new Action(ChangeDecks) } } .Where(station => station.NewStation != null); var adjacentStationGroupWithMostPlayers = adjacentStations .Select(station => new { Station = station, PlayerCount = SittingDuck.GetPlayerCount(station.NewStation.Value) }) .GroupBy(station => station.PlayerCount) .OrderByDescending(group => group.Key) .First(); if (adjacentStationGroupWithMostPlayers.Count() == 1) { adjacentStationGroupWithMostPlayers.Single().Station.MoveCommand(); } }