Some bugs in the ai...
= .= Check the algorithm later....