Ergebnis 1 bis 2 von 2

Thema: Prolog Labyrinth

  1. #1
    zoe
    Gast

    Standard Prolog Labyrinth

    Hallo zusammen,
    ich muss einen Weg aus einem Labyrinth in Prolog programmieren, dabei Schleifen vermeiden, den Weg in einer Liste speichern und als Ergebnis ausgeben. (In dieser Form: [south,east,east,west....])
    Die Liste muss ganz am Ende verkehrtherum wieder ausgegeben werden, damit die Reiehenfolge der Richtungen,die man gegangen ist, wieder stimmt.
    Weiß jemand wie das genau funktioniert?


    Meine Datenbank ist diese:
    Code:
    link(room(12,12),room(12,11),south).
    link(room(11,12),room(12,12),east).
    link(room(11,12),room(11,11),south).
    link(room(10,12),room(11,12),east).
    link(room(9,12),room(10,12),east).
    link(room(9,12),room(9,11),south).
    link(room(8,12),room(9,12),east).
    link(room(7,12),room(8,12),east).
    link(room(6,12),room(7,12),east).
    link(room(5,12),room(6,12),east).
    link(room(5,12),room(5,11),south).
    link(room(4,12),room(5,12),east).
    link(room(4,12),room(4,11),south).
    link(room(3,12),room(3,11),south).
    link(room(2,12),room(3,12),east).
    link(room(2,12),room(2,11),south).
    link(room(1,12),room(2,12),east).
    link(room(1,12),room(1,11),south).
    link(room(12,11),room(12,10),south).
    link(room(10,11),room(10,10),south).
    link(room(9,11),room(10,11),east).
    link(room(8,11),room(8,10),south).
    link(room(7,11),room(8,11),east).
    link(room(6,11),room(7,11),east).
    link(room(5,11),room(5,10),south).
    link(room(3,11),room(3,10),south).
    link(room(2,11),room(2,10),south).
    link(room(11,10),room(11,9),south).
    link(room(10,10),room(11,10),east).
    link(room(9,10),room(9,9),south).
    link(room(8,10),room(9,10),east).
    link(room(7,10),room(7,9),south).
    link(room(6,10),room(7,10),east).
    link(room(5,10),room(6,10),east).
    link(room(4,10),room(5,10),east).
    link(room(3,10),room(3,9),south).
    link(room(1,10),room(2,10),east).
    link(room(1,10),room(1,9),south).
    link(room(11,9),room(12,9),east).
    link(room(10,9),room(10,8),south).
    link(room(9,9),room(10,9),east).
    link(room(8,9),room(8,8),south).
    link(room(6,9),room(7,9),east).
    link(room(6,9),room(6,8),south).
    link(room(5,9),room(6,9),east).
    link(room(4,9),room(5,9),east).
    link(room(3,9),room(4,9),east).
    link(room(2,9),room(2,8),south).
    link(room(1,9),room(1,8),south).
    link(room(12,8),room(12,7),south).
    link(room(11,8),room(12,8),east).
    link(room(10,8),room(11,8),east).
    link(room(9,8),room(10,8),east).
    link(room(9,8),room(9,7),south).
    link(room(8,8),room(8,7),south).
    link(room(7,8),room(8,8),east).
    link(room(7,8),room(7,7),south).
    link(room(6,8),room(6,7),south).
    link(room(5,8),room(6,8),east).
    link(room(4,8),room(5,8),east).
    link(room(4,8),room(4,7),south).
    link(room(3,8),room(3,7),south).
    link(room(1,8),room(2,8),east).
    link(room(1,8),room(1,7),south).
    link(room(12,7),room(12,6),south).
    link(room(10,7),room(11,7),east).
    link(room(10,7),room(10,6),south).
    link(room(9,7),room(9,6),south).
    link(room(6,7),room(7,7),east).
    link(room(6,7),room(6,6),south).
    link(room(5,7),room(6,7),east).
    link(room(5,7),room(5,6),south).
    link(room(4,7),room(4,6),south).
    link(room(2,7),room(3,7),east).
    link(room(1,7),room(2,7),east).
    link(room(12,6),room(12,5),south).
    link(room(11,6),room(12,6),east).
    link(room(10,6),room(11,6),east).
    link(room(10,6),room(10,5),south).
    link(room(9,6),room(9,5),south).
    link(room(8,6),room(8,5),south).
    link(room(7,6),room(8,6),east).
    link(room(6,6),room(7,6),east).
    link(room(5,6),room(5,5),south).
    link(room(3,6),room(4,6),east).
    link(room(2,6),room(3,6),east).
    link(room(1,6),room(2,6),east).
    link(room(1,6),room(1,5),south).
    link(room(12,5),room(12,4),south).
    link(room(11,5),room(11,4),south).
    link(room(10,5),room(11,5),east).
    link(room(10,5),room(10,4),south).
    link(room(8,5),room(9,5),east).
    link(room(6,5),room(7,5),east).
    link(room(5,5),room(6,5),east).
    link(room(4,5),room(5,5),east).
    link(room(3,5),room(4,5),east).
    link(room(3,5),room(3,4),south).
    link(room(2,5),room(2,4),south).
    link(room(1,5),room(2,5),east).
    link(room(12,4),room(12,3),south).
    link(room(11,4),room(11,3),south).
    link(room(9,4),room(10,4),east).
    link(room(8,4),room(9,4),east).
    link(room(7,4),room(8,4),east).
    link(room(7,4),room(7,3),south).
    link(room(6,4),room(7,4),east).
    link(room(5,4),room(6,4),east).
    link(room(4,4),room(5,4),east).
    link(room(4,4),room(4,3),south).
    link(room(3,4),room(3,3),south).
    link(room(1,4),room(2,4),east).
    link(room(1,4),room(1,3),south).
    link(room(12,3),room(12,2),south).
    link(room(11,3),room(12,3),east).
    link(room(10,3),room(10,2),south).
    link(room(9,3),room(10,3),east).
    link(room(8,3),room(9,3),east).
    link(room(8,3),room(8,2),south).
    link(room(6,3),room(6,2),south).
    link(room(5,3),room(6,3),east).
    link(room(5,3),room(5,2),south).
    link(room(4,3),room(5,3),east).
    link(room(2,3),room(3,3),east).
    link(room(2,3),room(2,2),south).
    link(room(1,3),room(2,3),east).
    link(room(12,2),room(12,1),south).
    link(room(11,2),room(11,1),south).
    link(room(10,2),room(10,1),south).
    link(room(9,2),room(9,1),south).
    link(room(8,2),room(8,1),south).
    link(room(7,2),room(8,2),east).
    link(room(6,2),room(6,1),south).
    link(room(5,2),room(5,1),south).
    link(room(4,2),room(4,1),south).
    link(room(3,2),room(4,2),east).
    link(room(3,2),room(3,1),south).
    link(room(1,2),room(2,2),east).
    link(room(1,2),room(1,1),south).
    link(room(11,1),room(12,1),east).
    link(room(9,1),room(10,1),east).
    link(room(7,1),room(8,1),east).
    link(room(6,1),room(7,1),east).
    link(room(4,1),room(5,1),east).
    link(room(1,1),room(2,1),east).
    entry(room(1,11)).
    exit(room(10,1)).
    reverse_dir(north,south).
    reverse_dir(south,north).
    reverse_dir(west,east).
    reverse_dir(east,west).
    Danke schonmal für alle Tips und jede Unterstützung.
    Achtung: Dies ist ein alter Thread im HTML und Webmaster Forum
    Diese Diskussion ist älter als 90 Tage. Die darin enthaltenen Informationen sind möglicherweise nicht mehr aktuell. Erstelle bitte zu deiner Frage ein neues Thema im Forum !!!!!

  2. #2
    Forum Guru Avatar von The User
    Registriert seit
    28.10.2007
    Ort
    Zwischen Pazifik und Atlantik...
    Beiträge
    4.044
    Danke
    0
    Bekam 0 mal "Danke" in 0 Postings

    Standard

    [Eigenwebung]
    Schau mal hier, wie man eine Liste umdreht.
    [/Eigenwerbung]

    Viele liebe Grüße
    The User

Ähnliche Themen

  1. Prolog
    Von Sandra_DD im Forum Forum für alle anderen Programmiersprachen
    Antworten: 0
    Letzter Beitrag: 07.04.2008, 20:32
  2. Wegsuche mit Prolog
    Von cryptorius im Forum Forum für alle anderen Programmiersprachen
    Antworten: 1
    Letzter Beitrag: 13.03.2008, 19:59
  3. Prolog?
    Von The User im Forum Forum für alle anderen Programmiersprachen
    Antworten: 0
    Letzter Beitrag: 05.02.2008, 00:05
  4. Prolog, Rückschlüsse?
    Von Framgent im Forum Forum für alle anderen Programmiersprachen
    Antworten: 1
    Letzter Beitrag: 18.09.2007, 00:42
  5. Prolog Problem
    Von Bit2_Gosu im Forum Forum für alle anderen Programmiersprachen
    Antworten: 2
    Letzter Beitrag: 12.09.2007, 19:11

Stichworte

Berechtigungen

  • Neue Themen erstellen: Nein
  • Themen beantworten: Nein
  • Anhänge hochladen: Nein
  • Beiträge bearbeiten: Nein
  •