For example, the Prolog predicate roompart1/5 calculates the closest part of the room (i.e. an object in the room) to a person. It takes the following arguments:
roompart1(+RoomParts, +LowerBound, +UpperBound, +Position1, -RoomPart1)
(+ means input and - means output)
RoomParts - list of room parts in the format [Position, Name]
LowerBound - Lowest position number
UpperBound - Highest position number
Position1 - The person's position
RoomPart1 - The closest room part to the person to return
A sample query for the program would read as follows:
roompart1([[0, space], [1, space], [2, table], [3, seat], [4, space]], 0, 4, 3, RoomPart).
The result would be:
RoomPart = seat
No comments:
Post a Comment