Added AIPlayer and some logic to Main and Engine.