AI improvement

fixed many errors in AI implementation
fixe errors in runX: turn before the run