# How can I calculate the most efficient movement vector when already moving?

So, for context, this isn't a math problem in a text book, but an issue I've run into while coding a video game. However, due to the nature of the problem, I felt posting this in the mathematics section would make more sense.

This video game does a fairly basic simulation of objects moving without friction in a 2D environment. The 'ships' move by rotating or firing an engine at a set acceleration rate until they hit a maximum velocity.

So, to move between two points they point at it, accelerate, and at some point reverse the direction they're facing and fire their engine to come to a halt at the desired point.

My problem is this:

If the ship is already moving, doing this means a huge waste of fuel firing the engine - as you have to accelerate almost infinitely to change your thrust vector.

So, for now, they bring themselves to a halt and then move as normal.

However, surely there is another way to do this that feels less clumsy?

That is, if a ship is at position A and wants to reach position B, but is already moving at a given speed along an entirely different motion vector, how can I find out what the angle and amount of acceleration required would be to alter the ship's motion vector to be aiming towards B - and how much 'fuel' (time spent accelerating) would be required?

(I'm aware this is almost more physics than pure mathematics, but it's also in a totally frictionless, fictional simulated environment and not one which is built to resemble reality in more than a passing way, so I felt that asking here would make the most sense.)