public SmartTargetFinder(ICheckpointMemory checkpointMemory, IInputContainer inputContainer, ISpeedCalculator speed, IAngleCalculator angleCalculator) { this.checkpointMemory = checkpointMemory; this.inputContainer = inputContainer; this.speed = speed; this.angleCalculator = angleCalculator; }
public SpeedstatsJobHandler( IKrakerApi krakerApi, ISpeedCalculator speedCalculator, string agentId, IHashCatCommandExecutorBuilder executorBuilder, SpeedStatJob job) : base(job, agentId, TempFilePaths.Null, executorBuilder, krakerApi) { _speedCalculator = speedCalculator; }
public AverageSpeedAnalizer( ITimeLocationsAnalizer timeLocationsAnalizer, IDistanceLocationsAnalizer distanceLocationsAnalizer, ISpeedCalculator speedCalculator, IAreaAnalizer areaAnalizer) { _timeLocationsAnalizer = timeLocationsAnalizer; _distanceLocationsAnalizer = distanceLocationsAnalizer; _speedCalculator = speedCalculator; _areaAnalizer = areaAnalizer; }
public ExtremumSpeedAnalizer( ITimeLocationsAnalizer timeLocationsAnalizer, IDistanceLocationsAnalizer distanceLocationsAnalizer, ISpeedCalculator speedCalculator, IExtremumSpeedAnalizer extremumSpeedAnalizer) { _timeLocationsAnalizer = timeLocationsAnalizer; _distanceLocationsAnalizer = distanceLocationsAnalizer; _speedCalculator = speedCalculator; _extremumSpeedAnalizer = extremumSpeedAnalizer; }
public ExtremumSpeedAnalizerTest(ITestOutputHelper testOutputHelper) { _testOutputHelper = testOutputHelper; _wayPoints = FileReaderContener.GetWayPoints().ToArray(); _timeLocationsAnalizer = new TimeLocationsAnalizer(); _distanceLocationsAnalizer = new DistanceLocationsAnalizer(); _speedCalculator = new SpeedCalculator(); _minimumSpeedAnalizer = new MinimumSpeedAnalizer(); _maximumSpeedAnalizer = new MaximumSpeedAnalizer(); }
public void SetUp() { _formatter = Substitute.For <IFormatter>(); _speed = new SpeedCalculator(); _writer = new FakeLogWriter(); _log = new ATM.Log(_writer); _seperationCalculator = new SeperationCalculator(_log); _clear = new FakeClear(); _render = new RenderData(_clear); _position = new PositionCalculator(); _uut = new AirTrafficController(_formatter, _seperationCalculator, _render, _position, _speed, _clear); }
public AirTrafficController(IFormatter receiver, ISeperationCalculator seperationCalculator, IRender render, IPositionCalculator positionCalculator, ISpeedCalculator speedCalculator, IClearConsole console) { // This will store the real or the fake transponder data receiver this.receiver = receiver; // Attach to the event of the real or the fake TDR this.receiver.FormattedDataReady += ReceiverOnFormattedDataReady; _seperationCalculator = seperationCalculator; _positionCalculator = positionCalculator; _speedCalculator = speedCalculator; _render = render; _clear = console; }
public AverageSpeedAnalizerTest(ITestOutputHelper testOutputHelper) { _testOutputHelper = testOutputHelper; _wayPoints = FileReaderContener.GetWayPoints().ToArray(); _timeLocationsAnalizer = new TimeLocationsAnalizer(); _distanceLocationsAnalizer = new DistanceLocationsAnalizer(); _speedCalculator = new SpeedCalculator(); _climbingAnalizer = new ClimbingAnalizer(); _descentAnalizer = new DescentAnalizer(); _flatAnalizer = new FlatAnalizer(); _anyAreaAnalizer = new AnyAreaAnalizer(); }
public JobHandlerBuilder(IKrakerApi krakerApi, IWorkedFoldersProvider workedFoldersProvider, ITempFileManager tempFileManager, IAgentIdManager agentIdManager, ISpeedCalculator speedCalculator, ILogger logger, IHashCatCommandExecutorBuilder executorBuilder) { _krakerApi = krakerApi; _workedFolders = workedFoldersProvider.Get(); _tempFileManager = tempFileManager; _agentIdManager = agentIdManager; _speedCalculator = speedCalculator; _logger = logger; _executorBuilder = executorBuilder; }
public WordListJobHandler( WordListJob job, IKrakerApi krakerApi, ITempFileManager tempFileManager, string tempFilesPath, IHashCatCommandExecutorBuilder executorBuilder, string agentId, ISpeedCalculator speedCalculator, ILogger logger) : base(job, agentId, tempFileManager.BuildTempFilePaths(tempFilesPath), executorBuilder, krakerApi) { _tempFileManager = tempFileManager; _speedCalculator = speedCalculator; _logger = logger; _tempFileManager.WriteBase64Content(_paths.HashFile, _job.Content); _tempFileManager.WriteBase64Content(_paths.PotFile, _job.PotContent ?? string.Empty); }
public void SetUp() { _uut = new ATM.SpeedCalculator(); }
public void Start(IInputContainer inputContainer, IInitialCheckpointGuesser initialCheckpointGuesser, ICheckpointMemory checkpointMemory, IBoostUseCalculator boostUseCalculator, ITargetFinding targetFinding, IThrustCalculator thrustCalculator, ISpeedCalculator speedCalculator, IGamestateCalculator gamestateCalculator) { // Game Loop while (true) { // Update input on start of each round inputContainer.Update(); gamestateCalculator.Recalculate(); speedCalculator.CalculateSpeed(inputContainer.PlayerPosition); #region Checkpoint calculations // Set first Checkpoint on game start (guessing) if (checkpointMemory.KnownCheckpoints.Count == 0) { checkpointMemory.AddCheckpoint(initialCheckpointGuesser.GuessInitialCheckPoint()); } // Create a new Checkpoint with current target if we don't know all the Checkpoints yet if (!checkpointMemory.AllCheckPointsKnown && checkpointMemory.GetCheckpointAtPosition(inputContainer.NextCheckpointLocation) == null) { checkpointMemory.AddCheckpoint(inputContainer.NextCheckpointLocation); } // Try to get the current target Checkpoint. If its null, then we add the newCP and set it as current // we use a threshold of 600 because we guessed the first Checkpoint checkpointMemory.CurrentCheckpoint = checkpointMemory.GetCheckpointAtPosition(inputContainer.NextCheckpointLocation); if (checkpointMemory.CurrentCheckpoint == null) { checkpointMemory.AddCheckpoint(inputContainer.NextCheckpointLocation); checkpointMemory.CurrentCheckpoint = checkpointMemory.GetCheckpointAtPosition(inputContainer.NextCheckpointLocation); } // if we target the first Checkpoint we can safely say, that we know all Checkpoints if (checkpointMemory.CurrentCheckpoint.Id == 0 && !checkpointMemory.AllCheckPointsKnown) { // update the first Checkpoint with exact values checkpointMemory.UpdateCheckpoint(checkpointMemory.CurrentCheckpoint, inputContainer.NextCheckpointLocation); checkpointMemory.AllCheckPointsKnown = true; } Checkpoint cpAfterNextCp = null; if (checkpointMemory.AllCheckPointsKnown) { checkpointMemory.NextCheckpoint = checkpointMemory.KnownCheckpoints.ToList() .Find(x => x.Id == checkpointMemory.CurrentCheckpoint.Id + 1) ?? checkpointMemory.KnownCheckpoints[0]; cpAfterNextCp = checkpointMemory.KnownCheckpoints.ToList().Find(x => x.Id == checkpointMemory.NextCheckpoint.Id + 1) ?? checkpointMemory.KnownCheckpoints[0]; } #endregion #region target finding Point target = targetFinding.GetTarget(inputContainer.PlayerPosition, checkpointMemory.CurrentCheckpoint, checkpointMemory.NextCheckpoint, cpAfterNextCp); #endregion #region thrust calculations string sThrust = thrustCalculator.GetThrust(inputContainer.DistanceToNextCheckPoint, inputContainer.AngleToNextCheckPoint, inputContainer.PlayerPosition, target); #endregion #region status messages if (false) { foreach (var cp in checkpointMemory.KnownCheckpoints) { Console.Error.WriteLine(cp.Id + " " + cp.Position.X + " " + cp.Position.Y + " " + cp.DistToNext); } Console.Error.WriteLine("cp count: " + checkpointMemory.KnownCheckpoints.Count); Console.Error.WriteLine("allCheckpointsKnown: " + checkpointMemory.AllCheckPointsKnown); Console.Error.WriteLine("nextCheckpointDist: " + inputContainer.DistanceToNextCheckPoint); Console.Error.WriteLine("nextCheckpointAngle: " + inputContainer.AngleToNextCheckPoint); //Console.Error.WriteLine("currentVectorAngle: " + currentVectorAngle); //Console.Error.WriteLine("currentVectorX: " + currentVectorX); //Console.Error.WriteLine("currentVectorY: " + currentVectorY); //Console.Error.WriteLine("nextCpVectorX: " + nextCpVectorX); //Console.Error.WriteLine("nextCpVectorY: " + nextCpVectorY); //Console.Error.WriteLine("lastPosition: " + lastPosition); //Console.Error.WriteLine("currentPosition: " + inputContainer.PlayerPosition); //Console.Error.WriteLine("currentVectorAngle: " + currentVectorAngle); //Console.Error.WriteLine("currentVectorAngle: " + currentVectorAngle); //Console.Error.WriteLine("distSlow: " + distSlow); //Console.Error.WriteLine("angleSlow: " + angleSlow); Console.Error.WriteLine("boostCpId: " + boostUseCalculator.GetBoostTargetCheckpoint().Id); //Console.Error.WriteLine("thrust: " + thrust); Console.Error.WriteLine("currentCP: " + checkpointMemory.CurrentCheckpoint.Id); Console.Error.WriteLine("nextCP: " + checkpointMemory.NextCheckpoint?.Id); } #endregion Console.WriteLine(target.X + " " + target.Y + " " + sThrust); } }