algorithm of autodriving