Local search algorithm for AI class