static void Main(string[] args) { var raceTower = new RaceTower(); var engine = new Engin(raceTower); engine.Start(); }
static void Main(string[] args) { RaceTower racetower = new RaceTower(); var numberOfLaps = int.Parse(Console.ReadLine()); var length = int.Parse(Console.ReadLine()); racetower.SetTrackInfo(numberOfLaps, length); while (racetower.RaceIsOver == false) { var input = Console.ReadLine().Split(' ').ToList(); var command = input[0]; switch (command) { case "RegisterDriver": racetower.RegisterDriver(input.Skip(1).ToList()); break; case "Leaderboard": Console.WriteLine(racetower.GetLeaderboard()); break; case "CompleteLaps": var result = racetower.CompleteLaps(input.Skip(1).ToList()); if (result.Length != 0) { Console.WriteLine(result); } break; case "Box": racetower.DriverBoxes(input.Skip(1).ToList()); break; case "ChangeWeather": racetower.ChangeWeather(input.Skip(1).ToList()); break; } } }
public static void Main(string[] args) { RaceTower raceTower = new RaceTower(); int totalNumberOfLaps = int.Parse(Console.ReadLine()); int trackLength = int.Parse(Console.ReadLine()); raceTower.SetTrackInfo(totalNumberOfLaps, trackLength); while (raceTower.raceIsOver == false) { var input = Console.ReadLine(); var separated = input.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).ToList(); var command = separated[0]; var data = separated.Skip(1).ToList(); switch (command) { case "RegisterDriver": raceTower.RegisterDriver(data); break; case "Leaderboard": Console.WriteLine(raceTower.GetLeaderboard()); break; case "CompleteLaps": Console.WriteLine(raceTower.CompleteLaps(data)); break; case "Box": raceTower.DriverBoxes(data); break; case "ChangeWeather": raceTower.ChangeWeather(data); break; } } }
static void Main(string[] args) { var numberOfLaps = int.Parse(Console.ReadLine()); var trackLength = int.Parse(Console.ReadLine()); var raceTower = new RaceTower(); raceTower.SetTrackInfo(numberOfLaps, trackLength); var input = Console.ReadLine(); while (true) { var tokens = input.Split(" ", StringSplitOptions.RemoveEmptyEntries); string result = string.Empty; var command = tokens[0]; try { switch (command) { case "RegisterDriver": raceTower.RegisterDriver(tokens.Skip(1).ToList()); break; case "Leaderboard": result = raceTower.GetLeaderboard(); if (result != "") { Console.WriteLine(result); } break; case "CompleteLaps": result = raceTower.CompleteLaps(tokens.Skip(1).ToList()); if (result != "") { Console.WriteLine(result); } break; case "Box": raceTower.DriverBoxes(tokens.Skip(1).ToList()); break; case "ChangeWeather": raceTower.ChangeWeather(tokens.Skip(1).ToList()); break; } } catch (ArgumentException ae) { if (ae.Message != "") { Console.WriteLine(ae.Message); } } if (raceTower.IsRaceOver()) { break; } input = Console.ReadLine(); } Console.WriteLine(raceTower.GetWinner()); }
public Engine(RaceTower raceTower) { this.raceTower = raceTower; }