First attempt at AI code DOES NOT WORK