Ai Forums Home Welcome Guest    Wednesday, April 26, 2017
Ai Site > Ai Forums > Alan and other chatbots > Finding a route through a maze ... Last PostsLoginRegisterWhy Register
Topic: Finding a route through a maze using Prolog

posted 11/5/2014  00:52Send e-mail to userReply with quote
Finding a route through a maze using Prolog

An artificially intelligent robot is asked to navigate a maze as shown in Figure 1. It is placed at a certain position (the starting position – a room) in the maze and is asked to try to reach another position (the goal position – a room). Positions are identified by (X, Y) coordinates.

a b c

d f


Figure 1

The figure 1 represents a maze in which we are asked "is there a route from point X to point Y?"

Assume, that the following knowledge base (i.e., facts) describes the paths through the maze.

link(a,b). link(b,c). link(c,d). link(f,c). link(b,e). link(d,e). link(e,f).

Even at this point we could put these in a Prolog program and start asking simple questions (by writing queries in the console) such as “Is there a link between points b and a?”.
Task 1

Write a predicate that defines a route between any two adjacent points (X and Y for example) based on the fact that there is a link between them and a recursive predicate that covers the more general case of a route between any two non-adjacent points (X and Z for example) by establishing for a fact that there is a link between X and a third point in the maze (say Y) and a route between Y and Z.

Hand in:
a. Inference networks for the rules.
b. A Prolog program called
c. A detailed description of the operation of the predicates.

'Send Send email to user    Reply with quote Reply with quote    Edit message Edit message

Forums Home    The Artificial Intelligence Forum    Hal and other child machines    Language Mind and Consciousness  
Contact Us Terms of Use