示例#1
0
        private void FINALS_Click(object sender, EventArgs e)
        {
            var playersCount  = int.Parse(FinalPlayersCount.Text);
            var gPlayersCount = int.Parse(FinalGPlayersCount.Text);
            var rankedCount   = int.Parse(FinalRPlayersCount.Text);
            var ps            = Enumerable.Range(0, gPlayersCount).Select(i => new Player {
                Id = i + 1, Rank = i + 1                                                                 /* m_randomizer.Next(0, gPlayersCount) }*/
            });

            finalPlayers.Items.Clear();
            finalPlayers.Items.AddRange(ps.ToArray());
            var engine      = new FinalPositioningEngine();
            var evPositions = engine.Evaluate(new FinalPositioningParameters()
            {
                PlayersCount       = playersCount,
                RankedPlayersCount = rankedCount,
                Players            = ps.ToArray()
            });

            finalPositions.Items.Clear();
            var index = 1;

            foreach (var competitionPosition in evPositions)
            {
                finalPositions.Items.Add(string.Format("{0}:{1}", index, competitionPosition.PlayerId));
                index++;
            }
        }
示例#2
0
    private CompetitionPosition[] PositionFinalPlayersInCompetition(CompetitionDetails details, CompetitionPlayer[] players)
    {
        var positioningEngine     = new FinalPositioningEngine();
        var positioningParameters = new FinalPositioningParameters
        {
            QualifyingToFinal = details.Type.QualifyingToFinalPlayersCount,
            Players           = (from p in players select new Simple.SAMS.CompetitionEngine.Player
            {
                Id = p.Id,
                Rank = p.CompetitionRank,
                AccumulatedScore = p.AccumulatedScore.GetValueOrDefault(),
                AverageScore = p.AverageScore.GetValueOrDefault()
            }).ToArray <Simple.SAMS.CompetitionEngine.Player>()
        };

        return(positioningEngine.Evaluate(positioningParameters));
    }