Improved AI and fixed some illegal moves.