add AI code and tons of tests