Exemple #1
0
    internal void Run()
    {
        int numberOflaps  = int.Parse(Console.ReadLine());
        int lengthOfTrack = int.Parse(Console.ReadLine());


        while (true)
        {
            string input = Console.ReadLine();

            try
            {
                raceTower.SetTrackInfo(numberOflaps, lengthOfTrack);
                CommandParser(input);
            }
            catch (ArgumentException ex)
            {
                Console.WriteLine(ex.Message);
            }

            if (raceTower.HasEnd)
            {
                break;
            }
        }

        Driver winer = raceTower.GetWiner();

        Console.WriteLine($"{winer.Name} wins the race for {winer.TotalTime:f3} seconds.");
    }