Example #1
0
        internal InterestLevel InterestLevelOfAddress(ulong thisAddress)
        {
            if (thisAddress == 0 || addressFilters.Length == 0)
            {
                return(InterestLevel.Interesting);
            }
            foreach (ulong address in addressFilters)
            {
                InterestLevel level = InterestLevel.Interesting;
                if (showParents)
                {
                    level |= InterestLevel.Parents;
                }
                if (showChildren)
                {
                    level |= InterestLevel.Children;
                }

                if (address == thisAddress)
                {
                    return(level);
                }
            }
            return(InterestLevel.Ignore);
        }
Example #2
0
        internal InterestLevel InterestLevelForParentsAndChildren()
        {
            InterestLevel interestLevel = InterestLevel.Ignore;

            if (showParents)
            {
                interestLevel |= InterestLevel.Parents;
            }
            if (showChildren)
            {
                interestLevel |= InterestLevel.Children;
            }
            return(interestLevel);
        }
Example #3
0
        public void UpdateMatchTwitterStatus(int matchId, bool tweetSent, InterestLevel matchInterest)
        {
            var connection = new SQLiteConnection(GetDbConnectionString());

            connection.Open();

            var sql     = @"update matches set tweetSent = @tweetSent, interestLevel = @matchInterest where matchId = @matchId;";
            var command = new SQLiteCommand(sql, connection);

            command.Parameters.AddWithValue("matchId", matchId);
            command.Parameters.AddWithValue("tweetSent", tweetSent);
            command.Parameters.AddWithValue("matchInterest", matchInterest.ToString());

            command.ExecuteNonQuery();
        }
    void FixedUpdate()
    {
        if (currentItemOfInterest == null)
        {
            targetRotation = transform.parent.rotation;
        }
        else
        {
            targetRotation = Quaternion.LookRotation(currentItemOfInterest.transform.position - transform.position);
        }



        rotateToTarget();
        currentItemOfInterest = null;
    }
        /// <summary>
        /// Component that segments stream of points into trips knowing
        /// the fact that trips should only end at "interesting" locations
        /// </summary>
        public PoiTripExtractorModule(
            ILocationRepository locationRepository,
            [Configurable(InterestLevel.Manual)] InterestLevel minimumInterestLevel,
            [Configurable(1200)] long timeoutDwellTime,
            [Configurable(5)] int minimumTripPoints,
            [Configurable(3000)] double minimumTripDistance)
            : base(minimumTripPoints, minimumTripDistance)
        {
            if (timeoutDwellTime < 0)
            {
                throw new ModuleConfigurationException("Timeout dwell time must not be negative");
            }

            this.locationRepository   = locationRepository.ThrowIfNull(nameof(locationRepository));
            this.timeoutDwellTime     = timeoutDwellTime;
            this.minimumInterestLevel = minimumInterestLevel;
        }
Example #6
0
        internal InterestLevel InterestLevelOfName(string name, string[] typeFilters)
        {
            if (name == "<root>" || typeFilters.Length == 0)
            {
                return(InterestLevel.Interesting);
            }
            string        bestFilter = "";
            InterestLevel bestLevel  = InterestLevel.Ignore;

            foreach (string filter in typeFilters)
            {
                InterestLevel level      = InterestLevel.Interesting;
                string        realFilter = filter.Trim();
                if (realFilter.Length > 0 && (realFilter[0] == '~' || realFilter[0] == '!'))
                {
                    level      = InterestLevel.Ignore;
                    realFilter = realFilter.Substring(1).Trim();
                }
                else
                {
                    if (showParents)
                    {
                        level |= InterestLevel.Parents;
                    }
                    if (showChildren)
                    {
                        level |= InterestLevel.Children;
                    }
                }

                // Check if the filter is a prefix of the name
                if (string.Compare(name, 0, realFilter, 0, realFilter.Length, caseInsensitive, CultureInfo.InvariantCulture) == 0)
                {
                    // This filter matches the type name
                    // Let's see if it's the most specific (i.e. LONGEST) one so far.
                    if (realFilter.Length > bestFilter.Length)
                    {
                        bestFilter = realFilter;
                        bestLevel  = level;
                    }
                }
            }
            return(bestLevel);
        }
Example #7
0
        internal void AssignInterestLevelToObject(ulong id, GcObject gcObject, BuildTypeGraphOptions options, FilterForm filterForm)
        {
            // The initial interest level in objects is the one of their type
            InterestLevel interestLevel = gcObject.Type(this).interestLevel;

            if (filterForm.signatureFilters.Length != 0)
            {
                string signature = SignatureOfObject(id, gcObject, BuildTypeGraphOptions.LumpBySignature);
                interestLevel &= filterForm.InterestLevelOfTypeName(gcObject.Type(this).name, signature, readNewLog.finalizableTypes.ContainsKey(gcObject.Type(this).typeID));
            }

            if (filterForm.addressFilters.Length != 0)
            {
                interestLevel &= filterForm.InterestLevelOfAddress(id);
            }

            gcObject.InterestLevel |= interestLevel;

            // Check if this is an interesting object, and we are supposed to mark its ancestors
            if ((gcObject.InterestLevel & InterestLevel.InterestingParents) == InterestLevel.InterestingParents)
            {
                for (GcObject parentObject = gcObject.parent; parentObject != null; parentObject = parentObject.parent)
                {
                    // As long as we find uninteresting objects, mark them for display
                    // When we find an interesting object, we stop, because either it
                    // will itself mark its parents, or it isn't interested in them (and we
                    // respect that despite the interest of the current object, somewhat arbitrarily).
                    if ((parentObject.InterestLevel & InterestLevel.InterestingParents) == InterestLevel.Ignore)
                    {
                        parentObject.InterestLevel |= InterestLevel.Display;
                    }
                    else
                    {
                        break;
                    }
                }
            }

            // It's tempting here to mark the descendants as well, but they may be reached via
            // long reference paths, when there are shorter ones that were deemed uninteresting
            // Instead, we look whether our parent objects are interesting and want to show their
            // descendants, but we have to do that in a separate pass.
        }
    void OnTriggerStay(Collider other)
    {
        InterestLevel otherItemOfInterest = other.gameObject.GetComponent <InterestLevel>();

        if (otherItemOfInterest != null)        //("ObjectOfInterest").Equals(Regex.Replace(other.gameObject.name, @"\_(\(.*\))", ""))
        {
            Vector3    deltaPosition        = other.transform.position - transform.position;
            Quaternion possibleLookRotation = Quaternion.LookRotation(deltaPosition);
            if (Quaternion.Angle(transform.parent.rotation, possibleLookRotation) <= lookAngle)
            {
                if (Mathf.Pow(deltaPosition.x, 2) + Mathf.Pow(deltaPosition.z, 2) > lookMinDistanceSquared)
                {
                    if (currentItemOfInterest == null || otherItemOfInterest == null ||
                        currentItemOfInterest.levelOfInterest
                        < otherItemOfInterest.levelOfInterest)
                    {
                        currentItemOfInterest = otherItemOfInterest;
                    }
                }
            }
        }
    }
        private void GatherInterestedTeams(Player client, League l)
        {
            //interestedTeams.Clear();
            contractOffers.Clear();

            Console.WriteLine("Client's Skill: " + client.CurrentSkill + "/" + client.PotentialSkill);

            foreach (Team t in l.TeamList)
            {
                bool          interested    = false;
                InterestLevel interestLevel = InterestLevel.None;

                List <Player> playersAtPosition = new List <Player>();
                foreach (Player p in t.Roster)
                {
                    if (p.Position == client.Position)
                    {
                        playersAtPosition.Add(p);
                    }
                }

                playersAtPosition = playersAtPosition.OrderByDescending(o => o.CurrentSkill).ToList();

                // check if player is better than anyone on the roster at same position
                if (client.CurrentSkill > playersAtPosition[0].CurrentSkill)
                {
                    interested = true;
                    if (client.Age <= 30)
                    {
                        interestLevel = InterestLevel.VeryHigh;
                    }
                    else if (playersAtPosition[0].PotentialSkill > client.PotentialSkill && playersAtPosition[0].Age <= client.Age)
                    {
                        interestLevel = InterestLevel.Medium;
                    }
                    else
                    {
                        interestLevel = InterestLevel.High;
                    }
                    Console.WriteLine("Starter's Current Skill: " + playersAtPosition[0].CurrentSkill);
                }
                // check if player has more potential than last guy on roster at same position
                else if (client.PotentialSkill > playersAtPosition[playersAtPosition.Count - 1].PotentialSkill)
                {
                    interested = true;
                    if (client.Age <= 30)
                    {
                        interestLevel = InterestLevel.Low;
                    }
                    else
                    {
                        interestLevel = InterestLevel.VeryLow;
                    }
                    Console.WriteLine("Worst Players's Potential Skill: " + playersAtPosition[playersAtPosition.Count - 1].PotentialSkill);
                }
                // young player with comparable upside to end of bench player
                else if (client.Age <= playersAtPosition[playersAtPosition.Count - 1].Age - 3 && client.PotentialSkill >= playersAtPosition[playersAtPosition.Count - 1].PotentialSkill - 10)
                {
                    interested    = true;
                    interestLevel = InterestLevel.Medium;
                    Console.WriteLine("Worst Players's Potential Skill: " + playersAtPosition[playersAtPosition.Count - 1].PotentialSkill);
                }

                //if (interested) interestedTeams.Add(t);
                if (interestLevel != InterestLevel.None)
                {
                    GenerateContract(interestLevel, t);
                }
            }

            Console.WriteLine("Teams Interested:");
            //foreach (Team t in interestedTeams)
            foreach (Contract c in contractOffers)
            {
                Console.WriteLine("- " + c.Team.City + " " + c.Team.Mascot);
            }

            mainForm.lblNumberOfTeamsInterested.Text = "# of Teams Interested: " + contractOffers.Count.ToString();
            if (contractOffers.Count > 0)
            {
                mainForm.gbNegotiationFocus.Visible = true;
            }
            else
            {
                mainForm.gbNegotiationFocus.Visible = false;
            }

            foreach (Contract c in contractOffers)
            {
                Console.WriteLine(c.Team.Abbreviation + " offers " + c.Years + "-yr @ " + c.YearlySalary.ToString("C0"));
            }
        }
        public void GenerateContract(InterestLevel interestLevel, Team t)
        {
            int  randomNumber            = world.rnd.Next(1, 101);
            int  years                   = 0;
            int  maxYears                = 0;
            int  yearlySalary            = 0;
            int  maxSalaryWillingToOffer = 0;
            bool willingToNegotiate      = false;

            if (interestLevel == InterestLevel.None)
            {
                years              = 0;
                yearlySalary       = 0;
                willingToNegotiate = false;
            }
            else if (interestLevel == InterestLevel.VeryLow)
            {
                if (randomNumber > 50)
                {
                    years                   = 1;
                    yearlySalary            = client.League.MinSalary;
                    maxSalaryWillingToOffer = client.League.MinSalary;
                }
                else
                {
                    years                   = 1;
                    yearlySalary            = client.League.MinSalary;
                    maxSalaryWillingToOffer = client.League.MinSalary;
                }
                willingToNegotiate = false;
            }
            else if (interestLevel == InterestLevel.Low)
            {
                years                   = 1;
                yearlySalary            = client.League.MinSalary;
                maxSalaryWillingToOffer = world.rnd.Next(client.League.MinSalary, client.League.MinSalary + 750000);
                maxYears                = world.rnd.Next(1, 3);

                /*if (relationship.Relationship >= 75)
                 *  willingToNegotiate = true;
                 * else
                 *  willingToNegotiate = false;*/
            }
            else if (interestLevel == InterestLevel.Medium)
            {
                years    = world.rnd.Next(1, 3);
                maxYears = world.rnd.Next(1, 3);
                if (maxYears < years)
                {
                    maxYears = years;
                }
                yearlySalary = client.DetermineYearlySalary(world.rnd);
                double percent    = world.rnd.Next(1, 21);
                double maxPercent = world.rnd.Next(5, 101);
                yearlySalary            = Convert.ToInt32((double)yearlySalary * (1 - (percent / 100)));
                maxSalaryWillingToOffer = Convert.ToInt32((double)yearlySalary * (1 + ((maxPercent + 25) / 100)));

                if (yearlySalary > maxSalaryWillingToOffer)
                {
                    int temp = yearlySalary;
                    yearlySalary            = maxSalaryWillingToOffer;
                    maxSalaryWillingToOffer = temp;
                }

                willingToNegotiate = true;
            }
            else if (interestLevel == InterestLevel.High)
            {
                years    = world.rnd.Next(2, 4);
                maxYears = world.rnd.Next(2, 5);
                if (maxYears < years)
                {
                    maxYears = years + 1;
                }
                yearlySalary            = client.DetermineYearlySalary(world.rnd);
                maxSalaryWillingToOffer = Convert.ToInt32((double)yearlySalary * (1 + (world.rnd.Next(20, 101) / 100)));
                willingToNegotiate      = true;
            }
            else // interestLevel == "VERY HIGH"
            {
                years    = world.rnd.Next(3, 5);
                maxYears = world.rnd.Next(3, 5);
                if (maxYears < years)
                {
                    maxYears = years;
                }
                yearlySalary = client.DetermineYearlySalary(world.rnd);
                double percent = world.rnd.Next(10, 26);
                yearlySalary = Convert.ToInt32((double)yearlySalary * (1 + (percent / 100)));
                if (yearlySalary > client.League.MaxSalary)
                {
                    yearlySalary = client.League.MaxSalary;
                }
                maxSalaryWillingToOffer = Convert.ToInt32((double)yearlySalary * (1 + (world.rnd.Next(50, 151) / 100)));
                if (yearlySalary > maxSalaryWillingToOffer)
                {
                    maxSalaryWillingToOffer = yearlySalary;
                }
                willingToNegotiate = true;
            }

            if (yearlySalary > client.League.MaxSalary)
            {
                yearlySalary = client.League.MaxSalary;
            }
            if (maxSalaryWillingToOffer > client.League.MaxSalary)
            {
                maxSalaryWillingToOffer = client.League.MaxSalary;
            }

            Contract contract = new Contract(years, yearlySalary, Convert.ToInt32((double)yearlySalary / (double)league.MonthsInSeason), league.SeasonStart, league.SeasonEnd, 0, 0, PaySchedule.Monthly);

            contract.Team = t;

            contractOffers.Add(contract);
        }