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