当前位置: 首页>>代码示例>>C#>>正文


C# GameState.LocationIsBlocked方法代码示例

本文整理汇总了C#中FuryOfDracula.GameLogic.GameState.LocationIsBlocked方法的典型用法代码示例。如果您正苦于以下问题:C# GameState.LocationIsBlocked方法的具体用法?C# GameState.LocationIsBlocked怎么用?C# GameState.LocationIsBlocked使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FuryOfDracula.GameLogic.GameState的用法示例。


在下文中一共展示了GameState.LocationIsBlocked方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AddBlueBackedCardToAllPossibleTrails

 public void AddBlueBackedCardToAllPossibleTrails(GameState game)
 {
     List<PossibleTrailSlot[]> newPossibilityTree = new List<PossibleTrailSlot[]>();
     foreach (PossibleTrailSlot[] trail in PossibilityTree)
     {
         Location currentLocation = Location.Nowhere;
         for (int i = 0; i < 6; i++)
         {
             if (trail[i].Location != Location.Nowhere)
             {
                 currentLocation = trail[i].Location;
                 break;
             }
         }
         List<PossibleTrailSlot> possibleCards = new List<PossibleTrailSlot>();
         List<Location> possibleLocations = game.Map.LocationsConnectedBySeaTo(currentLocation);
         foreach (Location location in possibleLocations)
         {
             if (!TrailContainsLocation(trail, location) && game.Map.TypeOfLocation(location) == LocationType.Sea && !game.LocationIsBlocked(location))
             {
                 possibleCards.Add(new PossibleTrailSlot(location, Power.None, game.TimeOfDay, CardBack.Blue));
             }
         }
         foreach (PossibleTrailSlot possibleCard in possibleCards)
         {
             PossibleTrailSlot[] newTrail = new PossibleTrailSlot[6];
             for (int i = 5; i > 0; i--)
             {
                 newTrail[i] = trail[i - 1];
             }
             newTrail[0] = possibleCard;
             newPossibilityTree.Add(newTrail);
         }
     }
     PossibilityTree = newPossibilityTree;
     if (PossibilityTree.Count() == 0)
     {
         Console.WriteLine("Dracula stopped believing he exists after running AddBlueBackedCardToAllPossibleTrails");
         PossibilityTree.Add(GetActualTrail(game));
     }
 }
开发者ID:UncleGus,项目名称:dracula,代码行数:41,代码来源:DecisionMaker.cs

示例2: AddBlueBackedCardToTrail

 public List<PossibleTrailSlot[]> AddBlueBackedCardToTrail(GameState game, PossibleTrailSlot[] trail)
 {
     List<PossibleTrailSlot[]> newPossibilityTree = new List<PossibleTrailSlot[]>();
     Location currentLocation = Location.Nowhere;
     for (int i = 0; i < 6; i++)
     {
         if (trail[i].Location != Location.Nowhere)
         {
             currentLocation = trail[i].Location;
             break;
         }
     }
     List<PossibleTrailSlot> possibleCards = new List<PossibleTrailSlot>();
     List<Location> possibleLocations = game.Map.LocationsConnectedBySeaTo(currentLocation);
     foreach (Location location in possibleLocations)
     {
         if (!TrailContainsLocation(trail, location) && game.Map.TypeOfLocation(location) == LocationType.Sea && !game.LocationIsBlocked(location))
         {
             possibleCards.Add(new PossibleTrailSlot(location, Power.None, game.TimeOfDay, CardBack.Blue));
         }
     }
     foreach (PossibleTrailSlot possibleCard in possibleCards)
     {
         PossibleTrailSlot[] newTrail = new PossibleTrailSlot[6];
         for (int i = 5; i > 0; i--)
         {
             newTrail[i] = trail[i - 1];
         }
         newTrail[0] = possibleCard;
         newPossibilityTree.Add(newTrail);
     }
     return newPossibilityTree;
 }
开发者ID:UncleGus,项目名称:dracula,代码行数:33,代码来源:DecisionMaker.cs

示例3: ChooseDestinationAndPower

        public Location ChooseDestinationAndPower(GameState game, out Power power)
        {
            Location destination;
            if ((game.Dracula.AdvanceMoveLocation != Location.Nowhere && !game.LocationIsBlocked(game.Dracula.AdvanceMoveLocation)) || game.Dracula.AdvanceMovePower != Power.None)
            {
                power = game.Dracula.AdvanceMovePower;
                destination = game.Dracula.AdvanceMoveLocation;
                game.Dracula.AdvanceMoveLocation = Location.Nowhere;
                game.Dracula.AdvanceMovePower = Power.None;
                return destination;
            }
            var currentNumberOfPossibleCurrentLocations = NumberOfPossibleCurrentLocations;
            var currentActualTrail = GetActualTrail(game);
            var possibleMoves = GetPossibleMovesFromTrail(game, currentActualTrail);
            var possibleCurrentOrangeBackedLocations = new List<Location>();
            foreach (var trail in PossibilityTree)
            {
                possibleCurrentOrangeBackedLocations.AddRange(GetPossibleCurrentLocationsFromPossibilityTree(AddOrangeBackedCardToTrail(game, trail)));
            }
            var possibleCurrentBlueBackedLocations = new List<Location>();
            foreach (var trail in PossibilityTree)
            {
                possibleCurrentBlueBackedLocations.AddRange(GetPossibleCurrentLocationsFromPossibilityTree(AddBlueBackedCardToTrail(game, trail)));
            }
            var possibleWolfFormLocations = new List<Location>();
            foreach (var trail in PossibilityTree)
            {
                possibleCurrentBlueBackedLocations.AddRange(GetPossibleCurrentLocationsFromPossibilityTree(AddWolfFormCardToTrail(game, trail)));
            }
            var uniquePossibleCurrentOrangeBackedLocations = new List<Location>();
            var uniquePossibleCurrentBlueBackedLocations = new List<Location>();
            var uniquePossibleWolfFormLocations = new List<Location>();
            foreach (var location in possibleCurrentOrangeBackedLocations)
            {
                if (!uniquePossibleCurrentOrangeBackedLocations.Contains(location))
                {
                    uniquePossibleCurrentOrangeBackedLocations.Add(location);
                }
            }
            foreach (var location in possibleCurrentBlueBackedLocations)
            {
                if (!uniquePossibleCurrentBlueBackedLocations.Contains(location))
                {
                    uniquePossibleCurrentBlueBackedLocations.Add(location);
                }
            }
            foreach (var location in possibleWolfFormLocations)
            {
                if (!uniquePossibleWolfFormLocations.Contains(location))
                {
                    uniquePossibleWolfFormLocations.Add(location);
                }
            }

            var numberOfPossibleOrangeBackedLocationsThatWouldBeRevealed = uniquePossibleCurrentOrangeBackedLocations.Count(loc => game.HuntersAt(loc).Any());

            var numberOfPossibleLocationsAfterMove = new List<int>();
            foreach (var move in possibleMoves)
            {
                if ((game.HuntersAt(move.Location).Any() && game.Map.TypeOfLocation(move.Location) != LocationType.Sea) || move.Location == Location.CastleDracula)
                {
                    numberOfPossibleLocationsAfterMove.Add(1);
                }
                else
                {
                    if (move.Power == Power.None || move.Power == Power.Hide)
                    {
                        if (move.CardBack == CardBack.Orange)
                        {
                            numberOfPossibleLocationsAfterMove.Add(uniquePossibleCurrentOrangeBackedLocations.Count() - numberOfPossibleOrangeBackedLocationsThatWouldBeRevealed);
                        }
                        else if (move.CardBack == CardBack.Blue)
                        {
                            numberOfPossibleLocationsAfterMove.Add(uniquePossibleCurrentBlueBackedLocations.Count());
                        }
                    }
                    else if (move.Power == Power.Feed || move.Power == Power.DarkCall)
                    {
                        numberOfPossibleLocationsAfterMove.Add(currentNumberOfPossibleCurrentLocations);
                    }
                    else if (move.Power == Power.DoubleBack)
                    {
                        var doubleBackSlot = GetIndexOfLocationInTrail(move.Location, currentActualTrail);
                        var uniquePossibleDoubleBackLocations = new List<Location>();
                        foreach (var trail in PossibilityTree)
                        {
                            if (DoubleBackToPositionIsValidForTrail(game, trail, doubleBackSlot) && !uniquePossibleDoubleBackLocations.Contains(trail[doubleBackSlot].Location))
                            {
                                uniquePossibleDoubleBackLocations.Add(trail[doubleBackSlot].Location);
                            }
                        }
                        numberOfPossibleLocationsAfterMove.Add(uniquePossibleDoubleBackLocations.Count() - uniquePossibleDoubleBackLocations.Count(loc => game.HuntersAt(loc).Any()));
                    }
                    else if (move.Power == Power.WolfForm)
                    {
                        numberOfPossibleLocationsAfterMove.Add(uniquePossibleWolfFormLocations.Count() - uniquePossibleWolfFormLocations.Count(loc => game.HuntersAt(loc).Any()));
                    }
                }
            }

//.........这里部分代码省略.........
开发者ID:UncleGus,项目名称:dracula,代码行数:101,代码来源:DecisionMaker.cs

示例4: AddWolfFormToAllPossibleTrails

 public void AddWolfFormToAllPossibleTrails(GameState game)
 {
     List<PossibleTrailSlot[]> newPossibilityTree = new List<PossibleTrailSlot[]>();
     foreach (PossibleTrailSlot[] trail in PossibilityTree)
     {
         Location currentLocation = Location.Nowhere;
         for (int i = 0; i < 6; i++)
         {
             if (trail[i].Location != Location.Nowhere)
             {
                 currentLocation = trail[i].Location;
                 break;
             }
         }
         List<Location> possibleDestinations = new List<Location>();
         List<Location> locationsToAdd = game.Map.LocationsConnectedByRoadTo(currentLocation);
         foreach (Location location in locationsToAdd)
         {
             if (!game.LocationIsBlocked(location) && !possibleDestinations.Contains(location))
             {
                 possibleDestinations.Add(location);
             }
         }
         List<Location> moreLocationsToAdd = new List<Location>();
         foreach (Location location in possibleDestinations)
         {
             locationsToAdd = game.Map.LocationsConnectedByRoadTo(location);
             foreach (Location loc in locationsToAdd)
             {
                 if (!game.LocationIsBlocked(loc) && !possibleDestinations.Contains(loc) && !TrailContainsLocation(trail, loc))
                 {
                     moreLocationsToAdd.Add(loc);
                 }
             }
         }
         possibleDestinations.AddRange(moreLocationsToAdd);
         List<PossibleTrailSlot> possibleCards = new List<PossibleTrailSlot>();
         foreach (Location location in possibleDestinations)
         {
             possibleCards.Add(new PossibleTrailSlot(location, Power.WolfForm, game.TimeOfDay, CardBack.Orange));
         }
         foreach (PossibleTrailSlot possibleCard in possibleCards)
         {
             PossibleTrailSlot[] newTrail = new PossibleTrailSlot[6];
             for (int i = 5; i > 0; i--)
             {
                 newTrail[i] = trail[i - 1];
             }
             newTrail[0] = possibleCard;
             newPossibilityTree.Add(newTrail);
         }
     }
     PossibilityTree = newPossibilityTree;
     if (PossibilityTree.Count() == 0)
     {
         Console.WriteLine("Dracula stopped believing he exists after running AddWolfFormToAllPossibleTrails");
         PossibilityTree.Add(GetActualTrail(game));
     }
 }
开发者ID:UncleGus,项目名称:dracula,代码行数:59,代码来源:DecisionMaker.cs

示例5: AddOrangeBackedCardToTrail

 public List<PossibleTrailSlot[]> AddOrangeBackedCardToTrail(GameState game, PossibleTrailSlot[] trail)
 {
     List<PossibleTrailSlot[]> newPossibilityTree = new List<PossibleTrailSlot[]>();
     Location currentLocation = GetCurrentLocationFromTrail(trail);
     List<PossibleTrailSlot> possibleCards = new List<PossibleTrailSlot>();
     List<Location> possibleLocations = game.Map.LocationsConnectedByRoadTo(currentLocation);
     foreach (Location location in possibleLocations)
     {
         if (!TrailContainsLocation(trail, location) && !game.LocationIsBlocked(location))
         {
             possibleCards.Add(new PossibleTrailSlot(location, Power.None, game.TimeOfDay, CardBack.Orange));
         }
     }
     if (!TrailContainsPower(trail, Power.Hide))
     {
         possibleCards.Add(new PossibleTrailSlot(Location.Nowhere, Power.Hide));
     }
     foreach (PossibleTrailSlot possibleCard in possibleCards)
     {
         PossibleTrailSlot[] newTrail = new PossibleTrailSlot[6];
         for (int i = 5; i > 0; i--)
         {
             newTrail[i] = trail[i - 1];
         }
         newTrail[0] = possibleCard;
         newPossibilityTree.Add(newTrail);
     }
     return newPossibilityTree;
 }
开发者ID:UncleGus,项目名称:dracula,代码行数:29,代码来源:DecisionMaker.cs

示例6: AddOrangeBackedCardToAllPossibleTrails

 public void AddOrangeBackedCardToAllPossibleTrails(GameState game)
 {
     var newPossibilityTree = new List<PossibleTrailSlot[]>();
     var list = PossibilityTree.FindAll(trail => TrailContainsPower(trail, Power.Hide));
     foreach (var trail in PossibilityTree)
     {
         var currentLocation = GetCurrentLocationFromTrail(trail);
         var possibleCards = new List<PossibleTrailSlot>();
         var possibleLocations = game.Map.LocationsConnectedByRoadTo(currentLocation);
         foreach (var location in possibleLocations)
         {
             if (!TrailContainsLocation(trail, location) && !game.LocationIsBlocked(location))
             {
                 possibleCards.Add(new PossibleTrailSlot(location, Power.None, game.TimeOfDay, CardBack.Orange));
             }
         }
         if (!TrailContainsPower(trail, Power.Hide))
         {
             possibleCards.Add(new PossibleTrailSlot(Location.Nowhere, Power.Hide));
         }
         foreach (var possibleCard in possibleCards)
         {
             var newTrail = new PossibleTrailSlot[6];
             for (int i = 5; i > 0; i--)
             {
                 newTrail[i] = trail[i - 1];
             }
             newTrail[0] = possibleCard;
             newPossibilityTree.Add(newTrail);
         }
     }
     PossibilityTree = newPossibilityTree;
     if (PossibilityTree.Count() == 0)
     {
         Console.WriteLine("Dracula stopped believing he exists after running AddOrangeBackedCardToAllPossibleTrails");
         PossibilityTree.Add(GetActualTrail(game));
     }
 }
开发者ID:UncleGus,项目名称:dracula,代码行数:38,代码来源:DecisionMaker.cs

示例7: AddWolfFormCardToTrail

 private List<PossibleTrailSlot[]> AddWolfFormCardToTrail(GameState game, PossibleTrailSlot[] trail)
 {
     var currentLocation = GetCurrentLocationFromTrail(trail);
     var tempLocationList = game.Map.LocationsConnectedByRoadOrSeaTo(currentLocation);
     tempLocationList.RemoveAll(loc => game.LocationIsBlocked(loc));
     var possibleDestinations = new List<Location>();
     foreach (var location in tempLocationList)
     {
         possibleDestinations.Add(location);
         possibleDestinations.AddRange(game.Map.LocationsConnectedByRoadTo(location));
     }
     possibleDestinations.RemoveAll(loc => game.LocationIsBlocked(loc) || TrailContainsLocation(trail, loc) || game.Map.TypeOfLocation(loc) == LocationType.Sea);
     var uniquePossibleDestinations = new List<Location>();
     foreach (var location in possibleDestinations)
     {
         if (!uniquePossibleDestinations.Contains(location))
         {
             uniquePossibleDestinations.Add(location);
         }
     }
     var newPossibilityTree = new List<PossibleTrailSlot[]>();
     foreach (var location in uniquePossibleDestinations)
     {
         var newTrail = new PossibleTrailSlot[6];
         for (int i = 5; i > 0; i--)
         {
             if (trail[i - 1] != null)
             {
                 newTrail[i] = trail[i - 1];
             }
         }
         newTrail[0] = new PossibleTrailSlot(location, Power.WolfForm, game.TimeOfDay, CardBack.Orange);
     }
     return newPossibilityTree;
 }
开发者ID:UncleGus,项目名称:dracula,代码行数:35,代码来源:DecisionMaker.cs

示例8: GetPossibleMovesFromTrail

        public List<PossibleTrailSlot> GetPossibleMovesFromTrail(GameState game, PossibleTrailSlot[] trail)
        {
            var possibleMoves = new List<PossibleTrailSlot>();
            var currentLocation = GetCurrentLocationFromTrail(trail);
            var locationsInTrail = GetLocationsFromTrail(trail);
            var possiblePowers = Enumerations.GetAvailablePowers(game.TimeOfDay);
            possiblePowers.RemoveAll(power => GetPowersFromTrail(trail).Contains(power));
            if (game.Map.TypeOfLocation(currentLocation) == LocationType.Sea)
            {
                possiblePowers.Remove(Power.Feed);
                possiblePowers.Remove(Power.DarkCall);
                possiblePowers.Remove(Power.Hide);
            }
            possiblePowers.RemoveAll(pow => TrailContainsPower(trail, pow));
            var possibleDestinationsByDoubleBack = game.Map.LocationsConnectedByRoadOrSeaTo(currentLocation).Intersect(locationsInTrail);
            var possibleDestinationsByRoadOrSea = game.Map.LocationsConnectedByRoadOrSeaTo(currentLocation);
            possibleDestinationsByRoadOrSea.RemoveAll(location => possibleDestinationsByDoubleBack.Contains(location) || game.LocationIsBlocked(location));
            var possibleDestinationsByWolfForm = new List<Location>();
            if (possiblePowers.Contains(Power.WolfForm))
            {
                possibleDestinationsByWolfForm = game.Map.LocationsConnectedByRoadOrSeaTo(currentLocation);
                possibleDestinationsByWolfForm.RemoveAll(loc => game.LocationIsBlocked(loc));
                var secondLayerOfDestinations = new List<Location>();
                var temporaryLayerOfDestinations = new List<Location>();
                foreach (var destination in possibleDestinationsByWolfForm)
                {
                    temporaryLayerOfDestinations.Clear();
                    temporaryLayerOfDestinations.AddRange(game.Map.LocationsConnectedByRoadOrSeaTo(destination));
                    temporaryLayerOfDestinations.RemoveAll(loc => game.LocationIsBlocked(loc) || game.Map.TypeOfLocation(loc) == LocationType.Sea || possibleDestinationsByWolfForm.Contains(loc) || secondLayerOfDestinations.Contains(loc) || locationsInTrail.Contains(loc));
                    secondLayerOfDestinations.AddRange(temporaryLayerOfDestinations);
                }
                possibleDestinationsByWolfForm.AddRange(secondLayerOfDestinations);
                possibleDestinationsByWolfForm.RemoveAll(loc => locationsInTrail.Contains(loc));
            }

            foreach (var destination in possibleDestinationsByRoadOrSea)
            {
                if (game.Map.TypeOfLocation(destination) == LocationType.Sea)
                {
                    possibleMoves.Add(new PossibleTrailSlot(destination, Power.None, game.TimeOfDay, CardBack.Blue));
                }
                else
                {
                    possibleMoves.Add(new PossibleTrailSlot(destination, Power.None, game.TimeOfDay, CardBack.Orange));
                }
            }
            if (possiblePowers.Contains(Power.DoubleBack))
            {
                foreach (var destination in possibleDestinationsByDoubleBack)
                {
                    if (game.Map.TypeOfLocation(destination) == LocationType.Sea)
                    {
                        possibleMoves.Add(new PossibleTrailSlot(destination, Power.DoubleBack, game.TimeOfDay, CardBack.Blue));
                    }
                    else
                    {
                        possibleMoves.Add(new PossibleTrailSlot(destination, Power.DoubleBack, game.TimeOfDay, CardBack.Orange));
                    }
                }
            }
            foreach (var power in possiblePowers)
            {
                if (power == Power.Hide)
                {
                    possibleMoves.Add(new PossibleTrailSlot(Location.Nowhere, power, game.TimeOfDay, CardBack.Orange));
                }
                else if (power == Power.DarkCall || power == Power.Feed)
                {
                    possibleMoves.Add(new PossibleTrailSlot(Location.Nowhere, power, game.TimeOfDay, CardBack.Power));
                }
            }
            foreach (var destination in possibleDestinationsByWolfForm)
            {
                possibleMoves.Add(new PossibleTrailSlot(destination, Power.WolfForm, game.TimeOfDay, CardBack.Orange));
            }
            return possibleMoves;
        }
开发者ID:UncleGus,项目名称:dracula,代码行数:77,代码来源:DecisionMaker.cs

示例9: AddDoubleBackToAllPossibleTrails

 public void AddDoubleBackToAllPossibleTrails(GameState game, int doubleBackSlot)
 {
     List<PossibleTrailSlot[]> newPossibilityTree = new List<PossibleTrailSlot[]>();
     foreach (PossibleTrailSlot[] trail in PossibilityTree)
     {
         Location currentLocation = GetCurrentLocationFromTrail(trail);
         if (trail[doubleBackSlot].Power != Power.Hide && game.Map.LocationsConnectedByRoadOrSeaTo(currentLocation).Contains(trail[doubleBackSlot].Location) && !game.LocationIsBlocked(trail[doubleBackSlot].Location))
         {
             PossibleTrailSlot[] newPossibleTrail = new PossibleTrailSlot[6];
             for (int i = 5; i > doubleBackSlot; i--)
             {
                 newPossibleTrail[i] = trail[i];
             }
             for (int i = doubleBackSlot; i > 0; i--)
             {
                 newPossibleTrail[i] = trail[i - 1];
             }
             newPossibleTrail[0] = trail[doubleBackSlot];
             newPossibleTrail[0].Power = Power.DoubleBack;
             newPossibilityTree.Add(newPossibleTrail);
         }
     }
     PossibilityTree = newPossibilityTree;
     if (PossibilityTree.Count() == 0)
     {
         Console.WriteLine("Dracula stopped believing he exists after running AddDoubleBackToAllPossibleTrails");
         PossibilityTree.Add(GetActualTrail(game));
     }
 }
开发者ID:UncleGus,项目名称:dracula,代码行数:29,代码来源:DecisionMaker.cs


注:本文中的FuryOfDracula.GameLogic.GameState.LocationIsBlocked方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。