AI implementation #3, needs recursion refactoring