Exemple #1
0
        public void VisualizeRace([Values(1)] int testIndex)
        {
            // Открой файл bin/Debug/*/racing/visualizer/index.html чтобы посмотреть реплей на тесте testIndex
            var greedyRacer = new RandomRacer();
            var test        = RaceProblemsRepo.GetTests().ElementAt(testIndex);

            RaceController.Play(test, greedyRacer, true);
        }
Exemple #2
0
        public void VisualizeRace([Values(8)] int testIndex)
        {
            // ������ ���� bin/Debug/*/racing/visualizer/index.html ����� ���������� ������ �� ����� testIndex
            var greedyRacer = new GreedyRacer();
            var test        = RaceProblemsRepo.GetTests().ElementAt(testIndex);

            RaceController.Play(test, greedyRacer, true);
        }
Exemple #3
0
        public void MeanAndConfForAll()
        {
            var count = RaceProblemsRepo.GetTests().Count();

            for (int i = 0; i < count; i++)
            {
                PlayOneTestManyTimes(i, 20);
            }

            var totalScore = CalculateScore();

            Console.WriteLine($"Total score is {totalScore}");
            Assert.That(totalScore, Is.GreaterThan(MinScoreToPassTest));
        }
Exemple #4
0
        public double CalculateScore()
        {
            var score = 0.0;
            var iTest = 0;

            foreach (var test in RaceProblemsRepo.GetTests())
            {
                var racer      = new RandomRacer();
                var finalState = RaceController.Play(test, racer, false);
                var testScore  = finalState.FlagsTaken * 100 - finalState.Time;
                Console.WriteLine(
                    $"Test #{iTest} score: {testScore} (flags: {finalState.FlagsTaken} of {test.Track.FlagsToTake}, time: {finalState.Time} of {test.Track.RaceDuration})");
                score += testScore;
                iTest++;
            }

            return(score);
        }
Exemple #5
0
        //[Test]
        public void PlayOneTestManyTimes(int testNumber, int repetitionCount)
        {
            var tests = RaceProblemsRepo.GetTests();
            var test  = tests.ElementAt(testNumber);
            var stat  = new StatValue();
            var racer = new DoubleRandomRacer();

            for (int i = 0; i < repetitionCount; i++)
            {
                var finalState = RaceController.Play(test, racer, false);
                var testScore  = finalState.FlagsTaken * 100 - finalState.Time;
                stat.Add(testScore);
            }
            var resWith = stat.Mean;

            Console.WriteLine(testNumber.ToString());
            Console.WriteLine("mean " + resWith.ToString());
            Console.WriteLine("conf " + stat.ConfIntervalSize.ToString());
        }
Exemple #6
0
        public double CalculateScore1(int depth    = 20, double flagsTakenc = 10000,
                                      double distc = 1, double nextFlagc    = 0.25)
        {
            var score = 0.0;
            var iTest = 0;

            foreach (var test in RaceProblemsRepo.GetTests())
            {
                var racer      = new GreedyRacer(depth, flagsTakenc, distc, nextFlagc);
                var finalState = RaceController.Play(test, racer, false);
                var testScore  = finalState.FlagsTaken * 100 - finalState.Time;
                Console.WriteLine(
                    $"Test #{iTest} score: {testScore} (flags: {finalState.FlagsTaken} of {test.Track.FlagsToTake}, time: {finalState.Time} of {test.Track.RaceDuration})");
                score += testScore;
                iTest++;
            }

            return(score);
        }