Better logic for AI