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

prolog

Options
  • 24-10-2005 1:36pm
    #1
    Registered Users 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 Posts: 7,500 ✭✭✭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 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 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