working AI, fixed player toggle bug in single player mode.