Design and Implementation of AI in Games