This is a slightly more complex version of Pets in which the Prolog program has a prompt/2 predicate used to get information from the user. In the example, it is used to ask the user for the sound the pet makes.
prompt/2 is implemented as an extended predicate in the C++ class derived from CLogicServer, illustrating the technique of having extended predicates associated with instances of classes derived from the Logic Server.
This is a trivial console example, where there is no real point in having multiple instances of the prompt/2 predicate, but the technique is important for GUI applications where, for example, different instances of the Logic Server might be associated with different windows on the screen.
Copyright ©1987-2004 Amzi! inc. All Rights Reserved. Amzi! is a registered trademark and Logic Server and e-Prolog are trademarks of Amzi! inc.