improve automatic snake movement:will not run into deadend