Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

prolog

  • 24-10-2005 12:36pm
    #1
    Registered Users, Registered Users 2 Posts: 272 ✭✭


    Just started prolog and cant seem to get my head around it would it be possible to get some hint's and tips on how to if statementd running ......
    my Objective:
    “Write a Prolog program to work out a fire escape route from a burning building.”

    • Each floor is comprised of rooms (grey areas) and corridors (white areas).
    • Rooms and corridors are connected together (e.g. a room’s door opens onto a corridor).
    • There are 3 exits: the front door, the back door, and the fire escape (which can only be used from the first floor).
    • A flight of stairs connects the 2 floors.
    any tips on this ?It would be a great help


Comments

  • Registered Users, Registered Users 2 Posts: 7,501 ✭✭✭BrokenArrows


    Are you trying to program it from an already predefined set of rules or are you going to define the rules yourself


  • Registered Users, Registered Users 2 Posts: 272 ✭✭hannable80


    yeah comes out a bit like :
    ?- fire-escape(f4,[cf2,f3],R).

    R = [f4,f5,cf5,stairs,cg3,cg4,cg5,cg8,front-door,exit]
    More (y/n)? y

    R = [f4,f5,cf5,stairs,cg3,cg1,cg2,g9,back-door,exit]
    More (y/n)? y

    R = [f4,f5,cf5,cf4,cf3,cf7,fire-escape,exit]
    More (y/n)? y

    no

    just looking for notes and stuff about loops


  • Registered Users, Registered Users 2 Posts: 4,003 ✭✭✭rsynnott


    Loops? In Prolog? You're probably expected to use recursion, and lots of it! Prolog's nice, once you get used to its huge eccentricities.


Advertisement