Fixed most of emulator. Implementing logic for AI turns