# What does distance divided by acceleration mean?

I'm reading a book named "Programming Game AI by Example". Here's a method to help an autonomous character to slow down when it's getting closer and closer to its target:

Vector2D SteeringBehavior::Arrive(Vector2D TargetPos, Deceleration deceleration)
{
Vector2D ToTarget = TargetPos - m_pVehicle->Pos();

//calculate the distance to the target
double dist = ToTarget.Length();

if (dist > 0)
{
//because Deceleration is enumerated as an int, this value is required
//to provide fine tweaking of the deceleration..
const double DecelerationTweaker = 0.3;

//calculate the speed required to reach the target given the desired
//deceleration
double speed =  dist / ((double)deceleration * DecelerationTweaker);

//make sure the velocity does not exceed the max
speed = min(speed, m_pVehicle->MaxSpeed());

//from here proceed just like Seek except we don't need to normalize
//the ToTarget vector because we have already gone to the trouble
//of calculating its length: dist.
Vector2D DesiredVelocity =  ToTarget * speed / dist;

return (DesiredVelocity - m_pVehicle->Velocity());
}

return Vector2D(0,0);
}


For this line:

//calculate the speed required to reach the target given the desired
//deceleration
double speed =  dist / ((double)deceleration * DecelerationTweaker);


The Deceleration is an enum like this.

//Arrive makes use of these to determine how quickly a vehicle
//should decelerate to its target
enum Deceleration{slow = 3, normal = 2, fast = 1};


I just don't understand how can it get a speed by dividing a distance by an acceleration (deceleration)? Did I misunderstand anything?

• Can you show us where deceleration is defined? This alludes to it being an enumeration. I'm wondering if it was perhaps just imprecisely named and does not correspond exactly to a m/s^2 change in speed over time. May 22 '18 at 12:07
• Sorry for missing that. I updated the code. It is an enum type.enum Deceleration{slow = 3, normal = 2, fast = 1}; May 23 '18 at 1:23