Ejemplo n.º 1
0
        protected override void PerformYAction(int currentTurn)
        {
            var stationsWithMultiplePlayers = EnumFactory.All <StationLocation>()
                                              .Where(stationLocation => stationLocation.IsOnShip())
                                              .Where(stationLocation => SittingDuck.GetPlayerCount(stationLocation) > 1);

            SittingDuck.KnockOutPlayers(stationsWithMultiplePlayers);
        }
Ejemplo n.º 2
0
 private bool IsAnyPlayerPresent()
 {
     return(SittingDuck.GetPlayerCount(CurrentStation) != 0);
 }
Ejemplo n.º 3
0
 protected override void PerformYAction(int currentTurn)
 {
     ChangeDecks();
     Attack(SittingDuck.GetPlayerCount(CurrentStation));
 }
Ejemplo n.º 4
0
        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();
            }
        }