For gun aiming, see Robocode/Game_Physics#Firing_Pitfall. This can cause your aim to be a tick behind. I think most robots don't worry about it. But if you do worry about it, what I do is predict robot positions 1 tick into the future and use that for aiming. It's not exact, but works well enough for me.