Пример #1
0
            List <int> Search(List <int> keys, List <Chest> chests, List <List <int> > keyToChest, Visited v, int depth)
            {
                int hash = v.GetHashCode() & ((1 << VisitedHashLen) - 1);

                foreach (var h in VisitedList[hash])
                {
                    if (h == v)
                    {
                        return(null);
                    }
                }
                VisitedList[hash].Add(v);
                VisitedListCount++;
                if (VisitedListCount > VisitedListCapacity)
                {
                    for (int i = 0; i < VisitedList.Length; i++)
                    {
                        VisitedList[i] = new List <Visited>();
                    }
                }

                List <int> nexts = new List <int>();

                foreach (var k in keys.Distinct())
                {
                    if (k < keyToChest.Count)
                    {
                        nexts.AddRange(keyToChest[k]);
                    }
                }
                nexts.Sort();
                foreach (var n in nexts)
                {
                    if (v[n] == false)
                    {
                        List <int> nkeys = keys.ToList();
                        nkeys.Remove(chests[n].ToOpen);
                        nkeys.AddRange(chests[n].Keys);
                        nkeys.Sort();
                        Visited nv = v.Clone();
                        nv[n] = true;
                        if (depth < chests.Count - 1)
                        {
                            List <int> r = Search(nkeys, chests, keyToChest, nv, depth + 1);
                            if (r != null)
                            {
                                r.Insert(0, n + 1);
                                return(r);
                            }
                        }
                        else
                        {
                            return(new List <int> {
                                n + 1
                            });
                        }
                    }
                }
                return(null);
            }
Пример #2
0
 // override object.GetHashCode
 public override int GetHashCode()
 {
     unchecked
     {
         int hash = 13;
         hash = (hash * 7) + Row.GetHashCode();
         hash = (hash * 7) + Column.GetHashCode();
         hash = (hash * 7) + Visited.GetHashCode();
         return(hash);
     }
 }
        public override int GetHashCode()
        {
            int hash = 1;

            if (Visited != false)
            {
                hash ^= Visited.GetHashCode();
            }
            if (TimeNow != 0L)
            {
                hash ^= TimeNow.GetHashCode();
            }
            return(hash);
        }
Пример #4
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (Id.Length != 0)
            {
                hash ^= Id.GetHashCode();
            }
            if (LastModifiedTimestampMs != 0L)
            {
                hash ^= LastModifiedTimestampMs.GetHashCode();
            }
            if (Latitude != 0D)
            {
                hash ^= Latitude.GetHashCode();
            }
            if (Longitude != 0D)
            {
                hash ^= Longitude.GetHashCode();
            }
            if (OwnedByTeam != 0)
            {
                hash ^= OwnedByTeam.GetHashCode();
            }
            if (GuardPokemonId != 0)
            {
                hash ^= GuardPokemonId.GetHashCode();
            }
            if (GuardPokemonCp != 0)
            {
                hash ^= GuardPokemonCp.GetHashCode();
            }
            if (Enabled != false)
            {
                hash ^= Enabled.GetHashCode();
            }
            if (Type != 0)
            {
                hash ^= Type.GetHashCode();
            }
            if (GymPoints != 0L)
            {
                hash ^= GymPoints.GetHashCode();
            }
            if (IsInBattle != false)
            {
                hash ^= IsInBattle.GetHashCode();
            }
            hash ^= activeFortModifier_.GetHashCode();
            if (lureInfo_ != null)
            {
                hash ^= LureInfo.GetHashCode();
            }
            if (CooldownCompleteTimestampMs != 0L)
            {
                hash ^= CooldownCompleteTimestampMs.GetHashCode();
            }
            if (Sponsor != 0)
            {
                hash ^= Sponsor.GetHashCode();
            }
            if (RenderingType != 0)
            {
                hash ^= RenderingType.GetHashCode();
            }
            if (DeployLockoutEndMs != 0L)
            {
                hash ^= DeployLockoutEndMs.GetHashCode();
            }
            if (guardPokemonDisplay_ != null)
            {
                hash ^= GuardPokemonDisplay.GetHashCode();
            }
            if (Closed != false)
            {
                hash ^= Closed.GetHashCode();
            }
            if (raidInfo_ != null)
            {
                hash ^= RaidInfo.GetHashCode();
            }
            if (gymDisplay_ != null)
            {
                hash ^= GymDisplay.GetHashCode();
            }
            if (Visited != false)
            {
                hash ^= Visited.GetHashCode();
            }
            if (SameTeamDeployLockoutEndMs != 0L)
            {
                hash ^= SameTeamDeployLockoutEndMs.GetHashCode();
            }
            if (AllowCheckin != false)
            {
                hash ^= AllowCheckin.GetHashCode();
            }
            if (ImageUrl.Length != 0)
            {
                hash ^= ImageUrl.GetHashCode();
            }
            if (InEvent != false)
            {
                hash ^= InEvent.GetHashCode();
            }
            if (BannerUrl.Length != 0)
            {
                hash ^= BannerUrl.GetHashCode();
            }
            return(hash);
        }