Kung,  implemented most functions except AI