Im working on solving a task, where i have to walk thorugh a labyrinth with doors to get to a specific room and i have to find out the way. I created this program with help but don’t quite understand it, could someone please do so?
(tuer=door; richtung=direction/arrow; weg=the path; Start/Ende=start/end; Loesung=solution; Punkt =Point, Knot)
tuer(a,b).
tuer(b,e).
tuer(b,c).
tuer(d,e).
tuer(c,d).
tuer(e,f).
tuer(g,e).
richtung(X, Y):-tuer (X,Y).
richtung(X,Y):-tuer (Y, X).
%Now is the point of not understanding anything
weg(Start,Ziel, Loesung): -richtung (Start, X), richtung (Y, Ziel),
weg (Start, [Start], Ziel, Loesung).
weg(Ziel, Weg,Ziel, Loesung):-Loesung = Weg.
weg(PunktA, Weg, Ziel, Loesung):-
richtung (PunktA, PunktX),
\+(member(PunktX, Weg)),
append(Weg, [PunktX], WegNeu),
weg (PunktX, WegNeu, Ziel, Loesung).
Thank you in advance!