コード例 #1
0
ファイル: Match.cs プロジェクト: Jopa-Przemyslaw/Tournament
 /// <summary>
 /// Initializes a new instance of the <see cref="Match" /> class.
 /// </summary>
 /// <param name="mainReferee">The main <see cref="Referee" />.</param>
 /// <param name="teamA">The <see cref="Team" /> a.</param>
 /// <param name="teamB">The <see cref="Team" /> b.</param>
 protected Match(Referee mainReferee, Team teamA, Team teamB)
 {
     this.mainReferee = mainReferee;
     this.teamA       = teamA;
     this.teamB       = teamB;
     matchScore       = new MatchScore(0, 0);
 }
コード例 #2
0
        public async Task <IActionResult> Put(int id, [FromBody] MatchScore score)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            var match = await simp.GetMatchAsync(id);

            if (match == null)
            {
                return(NotFound());
            }

            if (score.HostScore == 0 && score.GuestScore == 0)
            {
                match.Feeds.Clear();
            }

            match.HostScore  = score.HostScore;
            match.GuestScore = score.GuestScore;

            simp.UpdateAsync(match);

            await uof.Complete();

            var m = mapper.Map <Match, MatchDto>(match);

            await Clients.All.UpdateMatch(m);

            return(Ok(m));
        }
コード例 #3
0
ファイル: Match.cs プロジェクト: chrislemelin/CoffeeGem
 public Match(MatchScore score, GemType type, Position position, IToMatch source)
 {
     this.type     = type;
     this.score    = score;
     this.position = position;
     this.source   = source;
 }
コード例 #4
0
        public async Task <IActionResult> Create([Bind("Id,CompetitionId,Team1Id,Team2Id,Date,Played,Matchday")] Match match, int?home, int?away)
        {
            if (ModelState.IsValid)
            {
                var matchScore = new MatchScore();

                if (home != null && away != null)
                {
                    matchScore.Score1 = home.GetValueOrDefault();
                    matchScore.Score2 = away.GetValueOrDefault();
                }
                matchScore.Match = match;
                match.MatchScore = matchScore;

                _context.Add(match);
                if (match.Played)
                {
                    UpdateStats(match, null);
                }
                await _context.SaveChangesAsync();

                //UpdateStats(match);

                return(RedirectToAction("Details", "Competitions", new { id = match.CompetitionId }));
            }
            ViewData["CompetitionId"] = match.CompetitionId;
            ViewData["Team1Id"]       = new SelectList(_context.Team, "Id", "Age", match.Team1Id);
            ViewData["Team2Id"]       = new SelectList(_context.Team, "Id", "Age", match.Team2Id);
            return(View(match));
        }
コード例 #5
0
ファイル: SelectaSearcher.cs プロジェクト: danantal/Catapult
        public MatchScore Score(string searchString, string targetString)
        {
            var firstSearchChar = searchString[0];
            var restSearchChars = searchString.Substring(1);

            targetString = targetString.ToLowerInvariant();

            MatchScore bestMatch = NoMatch;

            for (var i = 0; i < targetString.Length; i++)
            {
                if (targetString[i] != firstSearchChar)
                {
                    continue;
                }

                var score = 1;
                var match = FindEndOfMatch(targetString, restSearchChars, score, i, ImmutableHashSet.Create(i));

                if (match?.Score < bestMatch.Score)
                {
                    bestMatch = match;
                }
            }

            return(bestMatch);
        }
コード例 #6
0
ファイル: MainContext.cs プロジェクト: StarkTT/TestTask
	void Awake() {
		curState = null;
		Menu = new MenuContext( this );
		Character = new CharacterContext( this );
		Map = new MapContext( this );
		EnterName = new EnterNameContext( this );
		MatchScore = new MatchScore( this );
		Header = new HeaderContext( this );
	}
コード例 #7
0
        public void Edit(int ID, MatchScoreModel viewModel)
        {
            MatchScore selectedMatchScore = _MatchScore.Find(ID);

            selectedMatchScore.IsDeleted    = viewModel.IsDeleted;
            selectedMatchScore.IsEnabled    = viewModel.IsEnabled;
            selectedMatchScore.Score        = viewModel.Score;
            selectedMatchScore.ScoreTitleID = viewModel.ScoreTitleID;
        }
コード例 #8
0
        private async void UpdateScore()
        {
            IEnumerable <Match> _matches = _matchRepository.GetAll();

            foreach (var match in _matches)
            {
                Random r           = new Random();
                bool   updateHost  = r.Next(0, 2) == 1;
                int    points      = r.Next(2, 4);
                bool   _matchEnded = false;

                if (updateHost)
                {
                    match.HostScore += points;
                }
                else
                {
                    match.GuestScore += points;
                }

                MatchScore score = new MatchScore()
                {
                    HostScore  = match.HostScore,
                    GuestScore = match.GuestScore
                };

                if (score.HostScore > 80 || score.GuestScore > 76)
                {
                    score.HostScore  = 0;
                    score.GuestScore = 0;
                    _matchEnded      = true;
                }
                // Update Score for all clients
                using (var client = new HttpClient())
                {
                    await client.PutAsJsonAsync <MatchScore>(Startup.API_URL + "matches/" + match.Id, score);
                }

                // Update Feed for subscribed only clients


                FeedViewModel _feed = new FeedViewModel()
                {
                    MatchId     = match.Id,
                    Description = _matchEnded == false ?
                                  (points + " points for " + (updateHost == true ? match.Host : match.Guest) + "!") :
                                  "Match started",
                    CreatedAt = DateTime.Now
                };
                using (var client = new HttpClient())
                {
                    await client.PostAsJsonAsync <FeedViewModel>(Startup.API_URL + "feeds", _feed);
                }
            }
        }
コード例 #9
0
ファイル: MatchesController.cs プロジェクト: wanasak/signalR
        public async void Put(int id, [FromBody] MatchScore score)
        {
            Match _match = _matchRepository.GetSingle(id);

            _match.HostScore  = score.HostScore;
            _match.GuestScore = score.GuestScore;

            _matchRepository.Commit();

            MatchViewModel _matchVM = Mapper.Map <Match, MatchViewModel>(_match);
            await Clients.All.UpdateMatch(_matchVM);
        }
コード例 #10
0
        public IActionResult GenerateMatches(int?id)
        {
            var competition = _context.Competition.SingleOrDefault(c => c.Id == id);

            if (competition == null)
            {
                return(NotFound());
            }

            var teams = from t in _context.Team
                        join tc in _context.TeamCompetition
                        on t.Id equals tc.TeamId
                        where tc.CompetitionId == id
                        select t;

            var teams2 = new List <Team>();

            teams2.AddRange(teams);

            foreach (var t in teams.ToList())
            {
                var flag = false;
                foreach (var t2 in teams2)
                {
                    foreach (var m in _context.Match.Where(x => x.Team1Id == t.Id && x.Team2Id == t2.Id).ToList())
                    {
                        flag = true;
                        break;
                    }
                    if (flag || t.Id == t2.Id)
                    {
                        continue;
                    }

                    MatchScore matchScore = new MatchScore();

                    Match match = new Match
                    {
                        CompetitionId = id,
                        Team1Id       = t.Id,
                        Team2Id       = t2.Id,
                        MatchScore    = matchScore
                    };
                    matchScore.Match = match;

                    _context.Add(match);
                }
            }
            _context.SaveChanges();

            return(RedirectToAction("Details", "Competitions", new { id }));
        }
コード例 #11
0
 public void Add(List <MatchScoreModel> viewModel)
 {
     foreach (var MSModel in viewModel)
     {
         var MatchScore = new MatchScore
         {
             IsDeleted    = false,
             IsEnabled    = true,
             MatchID      = MSModel.MatchID,
             Score        = MSModel.Score,
             ScoreTitleID = MSModel.ScoreTitleID
         };
         _MatchScore.Add(MatchScore);
     }
 }
コード例 #12
0
        public void AddCompetitionMatchScore(int competitionId, MatchScore matchScore)
        {
            using (var context = new FiflackDbContext())
            {
                var matchScoreDb    = _mapper.Map <MatchScoreDb>(matchScore);
                var savedMatchScore = context.MatchScores.Add(matchScoreDb);
                var copmetition     = context.Competitions.FirstOrDefault(x => x.Id == competitionId);

                var competitionMatch = new CompetitionMatchDb();
                competitionMatch.Match       = savedMatchScore;
                competitionMatch.Competition = copmetition;
                context.CompetitionMatches.Add(competitionMatch);

                context.SaveChanges();
            }
        }
コード例 #13
0
ファイル: SelectaSearcher.cs プロジェクト: danantal/Catapult
        private MatchScore FindEndOfMatch(string targetString, string chars, int score, int firstIndex, ImmutableHashSet <int> matchSet)
        {
            var lastIndex = firstIndex;
            var lastMatch = MatchType.Undefined;

            if (firstIndex == 0 || !char.IsLetterOrDigit(targetString[firstIndex - 1]))
            {
                lastMatch = MatchType.Boundary;
            }

            foreach (var c in chars)
            {
                var index = targetString.IndexOf(c, lastIndex + 1);

                if (index == -1)
                {
                    return(null);
                }

                if (index == lastIndex + 1)
                {
                    if (lastMatch != MatchType.Sequential)
                    {
                        score    += 1;
                        lastMatch = MatchType.Sequential;
                    }
                }
                else if (!char.IsLetterOrDigit(targetString[index - 1]))
                {
                    if (lastMatch != MatchType.Boundary)
                    {
                        score    += 1;
                        lastMatch = MatchType.Boundary;
                    }
                }
                else
                {
                    score    += index - lastIndex;
                    lastMatch = MatchType.Normal;
                }

                lastIndex = index;
                matchSet  = matchSet.Add(index);
            }

            return(MatchScore.Create(score, new Range(firstIndex, lastIndex), matchSet));
        }
コード例 #14
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,CompetitionId,MatchScoreId,Team1Id,Team2Id,Date,Played,Matchday")] Match match, int?home, int?away)
        {
            if (id != match.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    MatchScore mc = _context.MatchScore.SingleOrDefault(m => m.Match == match);
                    if (match.Played && home != null && away != null)
                    {
                        mc.Score1 = home.GetValueOrDefault();
                        mc.Score2 = away.GetValueOrDefault();
                    }

                    var oldMatch = _context.Match.Include(m => m.MatchScore).AsNoTracking().SingleOrDefault(m => m.Id == match.Id);

                    UpdateStats(match, oldMatch);

                    _context.Update(match);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!MatchExists(match.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index"));
            }
            ViewData["Team1Id"] = new SelectList(_context.Team, "Id", "Name", match.Team1Id);
            ViewData["Team2Id"] = new SelectList(_context.Team, "Id", "Name", match.Team2Id);
            return(View(match));
        }
コード例 #15
0
        public async Task <Match> UpdateScore(int matchId, MatchScore score)
        {
            using (var dbContext = new TtcDbContext())
            {
                var match = await dbContext.Matches
                            .WithIncludes()
                            .SingleAsync(x => x.Id == matchId);

                if (match.IsSyncedWithFrenoy)
                {
                    return(await GetMatch(dbContext, match.Id));
                }

                match.AwayScore = score.Out;
                match.HomeScore = score.Home;
                dbContext.SaveChanges();

                return(await GetMatch(dbContext, match.Id));
            }
        }
コード例 #16
0
        private BBLSeason GetSeason(string url)
        {
            var season = new BBLSeason();
            var link   = "https://www.mykhel.com/" + url;
            var web    = new HtmlWeb();
            var doc    = web.Load(link);
            var nodes  = doc.DocumentNode.SelectNodes("//tr[contains(@class,'result')]");

            foreach (var node in nodes)
            {
                var match      = new Cricket.Match();
                var segments   = node.SelectSingleNode("td").SelectSingleNode("table").SelectSingleNode("tbody").SelectSingleNode("tr").SelectNodes("td");
                var dateText   = segments[0].SelectNodes("div")[0].InnerText;
                var groundText = segments[0].SelectNodes("div")[1].InnerText;
                var roundText  = segments[0].InnerText.Replace(dateText, "").Replace(groundText, "");

                var number = 0;
                switch (roundText)
                {
                case ("Final 1,  "):
                    number = 3;
                    break;
                }
                match.Number = number;
                match.Date   = Util.StringToDate(dateText);
                match.Ground = Util.GetGroundByName(groundText.Trim().Split(',')[0]);


                var home = segments[1].SelectNodes("div")[0].SelectNodes("span")[0].InnerText.Trim();
                var away = segments[1].SelectNodes("div")[1].SelectNodes("span")[0].InnerText.Trim();
                match.Home = Cricket.Team.FindByName(home);
                match.Away = Cricket.Team.FindByName(away);

                var resultText = segments[2].InnerText;

                if (segments[2].InnerHtml.Contains("No Result"))
                {
                    match.HomeScore     = new MatchScore();
                    match.AwayScore     = new MatchScore();
                    match.Abandoned     = true;
                    match.Result.Victor = Victor.Abandoned;
                }
                else
                {
                    match.HomeScore = MatchScore.Str2ScoreEnglish(segments[1].SelectNodes("div")[0].SelectNodes("span")[1].InnerText.Trim());
                    match.AwayScore = MatchScore.Str2ScoreEnglish(segments[1].SelectNodes("div")[1].SelectNodes("span")[1].InnerText.Trim());



                    match.Result.DuckworthLewisStern = resultText.Contains("(D/L)") || resultText.Contains("(DLS)");
                    if (resultText.Contains(home))
                    {
                        match.Result.Victor = Victor.Home;
                    }
                    else if (resultText.Contains(away))
                    {
                        match.Result.Victor = Victor.Away;
                    }
                    else
                    {
                        match.Result.Victor = Victor.Draw;
                    }

                    var margin = resultText.Replace(match.Home.Names[2], "").Replace(match.Away.Names[2], "").Replace("won by", "").Replace("runs", "").Replace("wickets", "").Replace("(D/L)", "").Replace("(DLS)", "").Trim();

                    if (resultText.Contains("runs"))
                    {
                        match.Result.MarginByRuns = Int32.Parse(margin);
                    }
                    if (resultText.Contains("wickets"))
                    {
                        match.Result.MarginByWickets = Int32.Parse(margin);
                    }
                }

                season.Matches.Add(match);
            }

            var i = 0;

            foreach (var m in season.Matches.OrderBy(m => m.Date))
            {
                i++;
                m.Number = i;
            }
            season.Year = season.Matches.OrderBy(m => m.Date).First().Date.Year;
            return(season);
        }
コード例 #17
0
 public IHttpActionResult AddMatchScoreForCompetition(int id, MatchScore matchScore)
 {
     _matchScoresRepository.AddCompetitionMatchScore(id, matchScore);
     return(Ok());
 }
コード例 #18
0
        public void UpdateMatchScore(MatchScoreUpdateInfo scoreUpdateInfo)
        {
            if (scoreUpdateInfo.SetScores.IsNullOrEmpty())
            {
                throw new ArgumentException("You must specify set scores.");
            }
            lock (m_lock)
            {
                UseDataContext(
                    dataContext =>
                {
                    var matchId       = scoreUpdateInfo.MatchId;
                    var dataSetScores = new Dictionary <int, MatchScore>();
                    scoreUpdateInfo.SetScores.ForEach(
                        setScore =>
                    {
                        var dataSetScore =
                            dataContext.MatchScores.FirstOrDefault(ms => ms.MatchId == matchId && ms.SetNumber == setScore.Number);
                        if (dataSetScore == null)
                        {
                            if (!dataSetScores.TryGetValue(setScore.Number, out dataSetScore))
                            {
                                dataSetScore           = new MatchScore();
                                dataSetScore.SetNumber = setScore.Number;
                                dataSetScore.MatchId   = matchId;
                                dataSetScore.Match     = dataContext.Matches.First(m => m.Id == matchId);
                                dataContext.MatchScores.InsertOnSubmit(dataSetScore);

                                dataSetScores[setScore.Number] = dataSetScore;
                            }
                            dataSetScore.SetNumber = setScore.Number;
                            if (setScore.Player1Points.HasValue)
                            {
                                dataSetScore.Player1Points = setScore.Player1Points.Value;
                            }
                            if (setScore.Player2Points.HasValue)
                            {
                                dataSetScore.Player2Points = setScore.Player2Points.Value;
                            }
                            if (setScore.BreakPoints.HasValue)
                            {
                                dataSetScore.BreakPoints = setScore.BreakPoints.Value;
                            }
                            if (
                                dataSetScore.Match.Status < (int)MatchStatus.Playing)
                            {
                                dataSetScore.Match.Status = (int)MatchStatus.Playing;
                            }
                        }
                    });

                    dataContext.SubmitChanges();

                    var match = dataContext.Matches.FirstOrDefault(m => m.Id == matchId);
                    if (match == null)
                    {
                        throw new ArgumentException("Match '{0}' could not be found, could not update score.".ParseTemplate(scoreUpdateInfo.MatchId));
                    }

                    var latest = scoreUpdateInfo.SetScores.OrderByDescending(s => s.Number).First();
                    match.Id   = matchId;
                    if (latest.Player1Points.HasValue)
                    {
                        match.Player1Points = latest.Player1Points.Value;
                    }
                    if (latest.Player2Points.HasValue)
                    {
                        match.Player2Points = latest.Player2Points.Value;
                    }
                    if (latest.BreakPoints.HasValue)
                    {
                        match.BreakPoints = latest.BreakPoints.Value;
                    }

                    dataContext.SubmitChanges();
                });
            }
        }
コード例 #19
0
ファイル: UserInfo.cs プロジェクト: jok886/6020FD772C01DD09
 //查询比赛排行榜列表
 public void queryTopPlayersInfo(MatchScore cMS)
 {
     m_kIndividualMission.queryTopPlayersInfo(cMS);
 }
コード例 #20
0
 public IngredientMatch(MatchScore score, GemType type, Position position)
 {
     this.score    = score;
     this.type     = type;
     this.position = position;
 }
コード例 #21
0
 public void AdicionarLivro(MatchScore livro)
 {
     livro.Id = contextDB.IdHistoricoContador++;
     contextDB.PersonalMatchScores.Add(livro);
 }
コード例 #22
0
        private BBLSeason GetSeason(string url, int year)
        {
            var season = new BBLSeason();

            ServicePointManager.Expect100Continue = true;
            ServicePointManager.SecurityProtocol  = SecurityProtocolType.Tls12;
            var web      = new HtmlWeb();
            var doc      = web.Load(url);
            var nodes    = doc.DocumentNode.SelectNodes("//div[contains(@style,'width: 100%; clear:both')]");
            var newYear  = false;
            var dateYear = year;

            foreach (var node in nodes)
            {
                var match    = new Cricket.Match();
                var segments = node.SelectNodes("table");//.SelectSingleNode("tbody").SelectSingleNode("tr").SelectSingleNode("td").SelectSingleNode("div");
                var dateText = segments[0].SelectSingleNode("tbody").SelectSingleNode("tr").SelectSingleNode("td").SelectSingleNode("div").GetDirectInnerText().Replace("()", "").Trim();
                if (dateText.Contains("January") && !newYear)
                {
                    newYear = true;
                    dateYear++;
                }
                dateText += " " + dateYear;
                var resultText = segments[2].SelectSingleNode("tbody").SelectSingleNode("tr").SelectSingleNode("td").SelectSingleNode("div").SelectSingleNode("b").GetDirectInnerText();
                var groundText = segments[2].SelectSingleNode("tbody").SelectSingleNode("tr").SelectSingleNode("td").SelectSingleNode("div").SelectSingleNode("small").SelectNodes("a")[0].InnerText;

                match.Date   = Util.StringToDate(dateText);
                match.Ground = Util.GetGroundByName(groundText.Trim().Split(',')[0]);

                var home = segments[1].SelectSingleNode("tbody").SelectSingleNode("tr").SelectNodes("td")[0].SelectSingleNode("div").SelectSingleNode("b").SelectSingleNode("a").InnerText;
                var away = segments[1].SelectSingleNode("tbody").SelectSingleNode("tr").SelectNodes("td")[2].SelectSingleNode("div").SelectSingleNode("b").SelectSingleNode("a").InnerText;
                match.Home = Cricket.Team.FindByName(home);
                match.Away = Cricket.Team.FindByName(away);



                if (resultText.Contains("No Result"))
                {
                    match.HomeScore     = new MatchScore();
                    match.AwayScore     = new MatchScore();
                    match.Abandoned     = true;
                    match.Result.Victor = Victor.Abandoned;
                }
                else
                {
                    match.HomeScore = MatchScore.Str2ScoreAustralian(segments[1].SelectSingleNode("tbody").SelectSingleNode("tr").SelectNodes("td")[0].SelectSingleNode("div").GetDirectInnerText().Trim());
                    match.AwayScore = MatchScore.Str2ScoreAustralian(segments[1].SelectSingleNode("tbody").SelectSingleNode("tr").SelectNodes("td")[2].SelectSingleNode("div").GetDirectInnerText().Trim());



                    match.Result.DuckworthLewisStern = resultText.Contains("(D/L)") || resultText.Contains("(DLS)");
                    if (resultText.Contains(home))
                    {
                        match.Result.Victor = Victor.Home;
                    }
                    else if (resultText.Contains(away))
                    {
                        match.Result.Victor = Victor.Away;
                    }
                    else
                    {
                        match.Result.Victor = Victor.Draw;
                    }

                    var margin = resultText.Replace(match.Home.Names[2], "").Replace(match.Away.Names[2], "").Replace("won by", "").Replace("runs", "").Replace("wickets", "").Replace("(D/L)", "").Replace("(DLS)", "").Trim();
                    margin = margin.Split('(')[0];
                    if (resultText.Contains("runs"))
                    {
                        match.Result.MarginByRuns = Int32.Parse(margin);
                    }
                    if (resultText.Contains("wickets"))
                    {
                        match.Result.MarginByWickets = Int32.Parse(margin);
                    }
                }

                season.Matches.Add(match);
            }

            var i = 0;

            foreach (var m in season.Matches.OrderBy(m => m.Date))
            {
                i++;
                m.Number = i;
            }
            season.Year = season.Matches.OrderBy(m => m.Date).First().Date.Year;
            return(season);
        }
コード例 #23
0
        public void Delete(int ID)
        {
            MatchScore selectedMatchScore = _MatchScore.Find(ID);

            selectedMatchScore.IsDeleted = true;
        }
コード例 #24
0
 public void TestInitialize()
 {
     _matchScore = new MatchScore();
 }
コード例 #25
0
ファイル: SelectaSearcher.cs プロジェクト: danantal/Catapult
        private static MatchScore GetBestMatch(string searchString, string targetString, int?lastIndex, int score, ImmutableHashSet <int> matchedIndexes, MatchType lastMatch)
        {
            if (searchString.Length == 0)
            {
                return(MatchScore.Create(score, new Range(0, 0), matchedIndexes));
            }

            var searchChar = char.ToLowerInvariant(searchString.First());

            var bestMatch = NoMatch;

            for (var i = lastIndex + 1 ?? 0; i < targetString.Length; i++)
            {
                if (char.ToLowerInvariant(targetString[i]) == searchChar)
                {
                    MatchType matchType;
                    var       nextScore = score;

                    if (i == lastIndex + 1)
                    {
                        matchType = MatchType.Sequential;
                    }
                    else if (i == 0 || !char.IsLetterOrDigit(targetString[i - 1]) || !char.IsLetterOrDigit(targetString[i]))
                    {
                        matchType = MatchType.Boundary;
                    }
                    else if (char.IsLower(targetString[i - 1]) && char.IsUpper(targetString[i]))
                    {
                        matchType = MatchType.Boundary;
                    }
                    else
                    {
                        matchType = MatchType.Normal;
                    }

                    if (lastMatch == MatchType.Normal)
                    {
                        if (lastIndex.HasValue)
                        {
                            nextScore += i - lastIndex.Value;
                        }
                    }
                    else if (lastMatch == MatchType.Boundary || lastMatch == MatchType.Sequential)
                    {
                        if (matchType == MatchType.Normal)
                        {
                            if (lastIndex.HasValue)
                            {
                                nextScore += i - lastIndex.Value;
                            }
                        }
                    }

                    if (Mode == SelectaMode.Strict && matchType == MatchType.Normal)
                    {
                        continue;
                    }

                    var match = GetBestMatch(searchString.Substring(1), targetString, i, nextScore, matchedIndexes.Add(i), matchType);

                    if (match.Score < bestMatch.Score)
                    {
                        bestMatch = match;
                    }
                }
            }

            return(bestMatch);
        }