Algorithm helps artificial intelligence systems dodge 'adversarial' inputs