public void Play() { _shotCount = 0; var target = _firingRange.NextTarget(); _io.WriteLine(target.GetBearing()); _io.WriteLine($"Target sighted: approximate coordinates: {target}"); while (true) { _io.WriteLine($" Estimated distance: {target.EstimateDistance()}"); _io.WriteLine(); var explosion = Shoot(); if (explosion.IsTooClose) { _io.WriteLine("You blew yourself up!!"); return; } _io.WriteLine(explosion.GetBearing()); if (explosion.IsHit) { ReportHit(explosion.DistanceToTarget); return; } ReportMiss(explosion); } }
static void Main(string[] args) { DisplayTitleAndInstructions(); var firingRange = new FiringRange(); while (true) { Game.Play(firingRange); Console.WriteLine(); Console.WriteLine(); Console.WriteLine(); Console.WriteLine(); Console.WriteLine(); Console.WriteLine("Next target..."); Console.WriteLine(); firingRange.NextTarget(); } }