예제 #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);
        }
예제 #2
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);
        }