initial AI code