Labyrinth

Asked

Viewed 267 times

2

I’m a big fan of programming and I’m having a little problem that I can’t think of anything else.

The situation is as follows: I set out to do a programme on Prolog who is able to get out of a maze.

I have already researched a lot on the internet, but I was not very successful, I would like some indication of material or tip to take me the solution. Follow what I can get out of the material I read:

start:-
      Li=1,
      Ci=1,
      Lf=6,
      Cf=8,
      lab(La),
      imprime(La),
      tenta(Li, Ci, Lf, Cf, La).

  lab(La):-
      La =(" ############",
           " #i         #",
           " # # # #### #",
           " #   # # #  #",
           " # # #   # ##",
           " # # # ######",
           " #   #  #f  #",
           " # #### ### #",
           " # #      # #",
           " # ###### # #",
           " #   #      #",
           " ############",

  tenta(Li, Ci, Lf, Cf, La):-
      tentaright().

  tenta(Li, Ci, Lf, Cf, La):-
      tentadown().

  tenta(Li, Ci, Lf, Cf, La):-
      tentaleft().

  tenta(Li, Ci, Lf, Cf, La):-
      tentaup().

  resolve():-
      tenta(Li, Ci, Lf, Cf, La),
      resolve().

PS: The indentation may be a little strange, but it is because my development environment has numbering on the sides and removed here to be more aesthetic to post.

  • I can change the entrance?

  • feel free

  • hello, did you manage to solve the problem after? if yes, I think it would be interesting to post as answer :)

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.