public static Streak GetLongestLosingStreak(List <Match> matches) { var streaks = new Streaks(); foreach (var match in matches) { if (!match.WonTheMatch(match.RedPlayer1.Id)) { streaks.Add(match.RedPlayer1.Id); streaks.Add(match.RedPlayer2.Id); streaks.Reset(match.BluePlayer1.Id); streaks.Reset(match.BluePlayer2.Id); } else { streaks.Add(match.BluePlayer1.Id); streaks.Add(match.BluePlayer2.Id); streaks.Reset(match.RedPlayer1.Id); streaks.Reset(match.RedPlayer2.Id); } } return(streaks.GetLongestStreak()); }
public void ShotEnemy(int Score) { this.Sc += Score + Streak; Streak++; MaxStreak = Math.Max(MaxStreak, Streak); Streaks?.Invoke(this, this); }
public static int GetPlayersLongestLosingStreak(string playerId, List <Match> matches) { var streaks = new Streaks(); foreach (var match in matches.Where(x => x.ContainsPlayer(playerId))) { if (!match.WonTheMatch(playerId)) { streaks.Add(playerId); } else { streaks.Reset(playerId); } } return(streaks.GetLongestStreak().Count); }
public static int GetPlayersLongestWinningStreak(string playerId, List<Match> matches) { var streaks = new Streaks(); foreach (var match in matches.Where(x => x.ContainsPlayer(playerId))) { if (match.WonTheMatch(playerId)) { streaks.Add(playerId); } else { streaks.Reset(playerId); } } return streaks.GetLongestStreak().Count; }
public static Streak GetLongestWinningStreak(List<Match> matches) { var streaks = new Streaks(); foreach (var match in matches) { if (match.WonTheMatch(match.RedPlayer1.Id)) { streaks.Add(match.RedPlayer1.Id); streaks.Add(match.RedPlayer2.Id); streaks.Reset(match.BluePlayer1.Id); streaks.Reset(match.BluePlayer2.Id); } else { streaks.Add(match.BluePlayer1.Id); streaks.Add(match.BluePlayer2.Id); streaks.Reset(match.RedPlayer1.Id); streaks.Reset(match.RedPlayer2.Id); } } return streaks.GetLongestStreak(); }