Fix AI and main loop for CLI game