ai implementation of the ghost