public Character() { PInfoStats = new InfoStats( ); PLevelStats = new LevelStats( ); PPointStats = new PointStats( ); PCombatStats = new CombatStats( ); }
public bool Equals(Player other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return(CardStats.OrderBy(cs => cs.Key).SequenceEqual(other.CardStats.OrderBy(cs => cs.Key)) && ComputerDifficulty == other.ComputerDifficulty && ComputerPlayerId == other.ComputerPlayerId && Equals(ExperienceProgress, other.ExperienceProgress) && Equals(HumanPlayerId, other.HumanPlayerId) && IsHuman == other.IsHuman && LeaderId == other.LeaderId && LeaderPowerStats.OrderBy(lps => lps.Key).SequenceEqual(other.LeaderPowerStats.OrderBy(lps => lps.Key)) && PlayerCompletedMatch == other.PlayerCompletedMatch && PlayerMatchOutcome == other.PlayerMatchOutcome && PointStats.OrderBy(p => p.Key).SequenceEqual(other.PointStats.OrderBy(p => p.Key)) && Equals(RatingProgress, other.RatingProgress) && TeamId == other.TeamId && TeamPlayerIndex == other.TeamPlayerIndex && TimeInMatch.Equals(other.TimeInMatch) && UnitStats.OrderBy(us => us.Key).SequenceEqual(other.UnitStats.OrderBy(us => us.Key)) && WaveStats.OrderBy(ws => ws.Key).SequenceEqual(other.WaveStats.OrderBy(ws => ws.Key))); }
public IStats Analyze(Mouse baseline, Mouse subject, IEnumerable <Move> moves) { var stats = new PointStats (StatDescription , DefaultFactor , -Math.PI , Math.PI , 0.1 ); const double threshold = DisplacementInterval * DisplacementInterval; var baseD = Vec.Zero; var subjD = Vec.Zero; var crossTime = TimeSpan.MaxValue; foreach (var move in moves) { if (move.Time > crossTime) { if (baseD.MagnitudeSquared > threshold && subjD.MagnitudeSquared > threshold) { var angleDelta = subjD.Angle - baseD.Angle; // normalize to range [-pi, pi] angleDelta = Math.Atan2(Math.Sin(angleDelta), Math.Cos(angleDelta)); stats.AddPoint(crossTime, angleDelta); } // Reset trackers. baseD = Vec.Zero; subjD = Vec.Zero; crossTime = TimeSpan.MaxValue; } if (move.Mouse == baseline) { baseD += move.D; } else if (move.Mouse == subject) { subjD += move.D; } if (baseD.MagnitudeSquared >= threshold && subjD.MagnitudeSquared >= threshold) { // We've crossed the threshold - mark the time. // We'll keep eating moves until we find one later than this timestamp then add a datapoint. crossTime = move.Time; } } return(stats); }
public void Enqueue(PointStats stats, string pointTag) { lock (m_pointQueue) { m_pointQueue.Add(new Point { Tag = pointTag, Minimum = stats.Minimum, Maximum = stats.Maximum, Average = stats.Total / stats.Count, QualityFlags = (uint)stats.Flags, Timestamp = stats.StartTimestamp }); } }
public IStats Analyze(Mouse baseline, Mouse subject, IEnumerable <Move> moves) { var stats = new PointStats (StatDescription , DefaultFactor , 0.0 , 4.0 , 1.0 , 0.1 ); var baseD = 0.0; var subjD = 0.0; var crossTime = TimeSpan.MaxValue; foreach (var move in moves) { if (move.Time > crossTime) { if (Math.Abs(baseD) > 0.001) { var ratio = subjD / baseD; stats.AddPoint(crossTime, ratio); } // Reset trackers. baseD = 0.0; subjD = 0.0; crossTime = TimeSpan.MaxValue; } if (move.Mouse == baseline) { baseD += move.D.Magnitude; } else if (move.Mouse == subject) { subjD += move.D.Magnitude; } if (baseD >= DistanceInterval && subjD >= DistanceInterval) { // We've crossed the threshold - mark the time. // We'll keep eating moves until we find one later than this timestamp then add a datapoint. crossTime = move.Time; } } return(stats); }
private static void HandleReceivedMeasurement(Measurement measurement) { Guid signalID = measurement.GetSignalID(); PointStats stats = s_statistics.GetOrAdd(signalID, _ => new PointStats()); if (stats.Update(measurement)) { if (s_metadata is not null && s_metadata.TryGetValue(signalID, out string?pointTag) && !string.IsNullOrWhiteSpace(pointTag)) { s_pointQueue.Enqueue(stats, pointTag); s_processedAggregations++; } stats.Reset(); } if (s_processedAggregations > 1UL && DateTime.UtcNow.Ticks - s_lastDisplayTime > s_displayInterval) { s_lastDisplayTime = DateTime.UtcNow.Ticks; StatusMessage($"Processed {s_processedAggregations:N0} STTP measurement aggregations for publication to InfluxDB so far..."); } }
public IStats Analyze(Mouse baseline, Mouse subject, IEnumerable <Move> moves) { var stats = new PointStats (StatDescription , DefaultFactor , -250.0 , 250.0 , 100.0 , 10.0 ); var baseAnalyzer = new MouseLagProcessor(baseline, stats, isBaseline: true); var subjectAnalyzer = new MouseLagProcessor(subject, stats, isBaseline: false); foreach (var move in moves) { baseAnalyzer.ProcessMove(move, subjectAnalyzer); subjectAnalyzer.ProcessMove(move, baseAnalyzer); } return(stats); }
public override int GetHashCode() { unchecked { var hashCode = CardStats?.GetHashCode() ?? 0; hashCode = (hashCode * 397) ^ ComputerDifficulty.GetHashCode(); hashCode = (hashCode * 397) ^ ComputerPlayerId.GetHashCode(); hashCode = (hashCode * 397) ^ (ExperienceProgress != null ? ExperienceProgress.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (HumanPlayerId != null ? HumanPlayerId.GetHashCode() : 0); hashCode = (hashCode * 397) ^ IsHuman.GetHashCode(); hashCode = (hashCode * 397) ^ LeaderId; hashCode = (hashCode * 397) ^ (LeaderPowerStats?.GetHashCode() ?? 0); hashCode = (hashCode * 397) ^ PlayerCompletedMatch.GetHashCode(); hashCode = (hashCode * 397) ^ PlayerMatchOutcome.GetHashCode(); hashCode = (hashCode * 397) ^ (PointStats?.GetHashCode() ?? 0); hashCode = (hashCode * 397) ^ (RatingProgress != null ? RatingProgress.GetHashCode() : 0); hashCode = (hashCode * 397) ^ TeamId; hashCode = (hashCode * 397) ^ TeamPlayerIndex; hashCode = (hashCode * 397) ^ TimeInMatch.GetHashCode(); hashCode = (hashCode * 397) ^ (UnitStats?.GetHashCode() ?? 0); hashCode = (hashCode * 397) ^ (WaveStats?.GetHashCode() ?? 0); return(hashCode); } }
public IStats Analyze(Mouse baseline, Mouse subject, IEnumerable <Move> moves) { var stats = new PointStats (StatDescription , DefaultFactor , 0.0 , 100000.0 , 10000.0 , 1000.0 ); TimeSpan?start = null; var distance = 0.0; foreach (var move in moves) { if (move.Mouse != baseline) { continue; } if (start == null) { start = move.Time; } distance += move.D.Magnitude; if (distance >= DistanceInterval) { var time = move.Time - start.Value; var speed = distance / time.TotalSeconds; stats.AddPoint(move.Time, speed); distance = 0.0; start = move.Time; } } return(stats); }
public MouseLagProcessor(Mouse mouse, PointStats stats, bool isBaseline) { _mouse = mouse; _stats = stats; _isBaseline = isBaseline; }