Commit 644cf7a3 authored by Marius Frinken's avatar Marius Frinken
Browse files

marius' stuff for the third tutorial session

parent 4e713c13
%sometimes you may want to "tag" things onto a existing data structure
% e.g. process(ListOfTriples) needs a list of triples
%but you only have a list of pairs
%does something
%now we need to merge .i.e tag on a dummy value 0 in our naive case here
ListOfTriples = [(A,B,0)|TempListOfTriples],!.
%Prolog offers multiple ways of sorting, this is one
comp_triples(Delta, (C1,_,_),(C2,_,_)):-
my_sort(ListOfTriples, SortedListOfTriples):-
%normal lists can bes sorted with sort(List,SortedList)
%interface for your homework:
% dfs(GoalValue, Tree, PathString, Cost)
% GoalValue is a String e.g. "G"
% Tree is a tree e.g. tree("A",[(1,tree("B",[]))])
% PathString shall contain the correct path from the beginning straight to the goal in the end
% if you do not like strings, you may implement path as list
% Cost is a number that shall contain the summed up cost in the end
%Only the iterative deepening differs from that interface, as we have to give a Stepsize:
% idfs(GoalValue,Tree,PathString,Cost,StepSize)
% also please use write or any other form of writing to show the order in whch your code expands the nodes
% that helps you and us to determine whether you code actually performs a BFS, DFS and so on
% (and you could verify your answer to 3.1 with that technique)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment