Jump to content
N-Europe

Recommended Posts

Posted

Hey guys,

 

Ok, heres the deal. I hate prolog. Unfortunately i have to take Knowledge Based Systems as one of my units at University. I cant for the life of me understand it, it just confuses me with other programming ive learnt. So, im pleading for help on some work i have to do.

 

Take this maze: we have to do a search to find the best route from start to the finnish, the finnish being the tower. The best route should be found by looking at each nodes noise value. The values are as follows:

 

noise_level(start,2).

noise_level(holly_bush,4).

noise_level(pond,2).

noise_level(skull,12).

noise_level(bones,10).

noise_level(killer_badger,4).

noise_level(apple_tree,13).

noise_level(warning_sign,20).

noise_level(bench,45).

noise_level(tower,100).

noise_level(spike,50).

noise_level(large_toad,30).

noise_level(pear_tree,26).

noise_level(statue,28).

 

I know that best search methods for doing this are either Best First or Hil Climbing search and that a bubble sort is needed somewhere but, i just cant do it.

 

If anyone could help i would be so grateful, id even send you money. Serious!

 

Need help by thursday.

 

Yours begging, Jav :kiss:

Posted

Oh! I'm doing Prolog also. A bitch isn't it. What i'm doing is alot harder though, so i think i can help you a little.

The problem is, i don't understand what your query is. As in, what the hell are you trying to do, you said you want to go from start to finish, but there is no finish.

So i am assuming that you want start(whatever,2) and work the numbers so that they are in order...

 

So i guess, maybe...

bubblesort(X,Y) :- noise_level(X,Y).

bubblesort(Y) :-

Wait. Your not sorting it you just said you need a sort somewhere, so what are you trying to do?

Explain!

Posted

I can't help you but I had the option of doing a Prolog module in my final year. Fortunately there was other things on offer so I managed to avoid it. We did equally bad things in the 1st and 2nd years though.. Haskell.. Occam.. both totally geeky and pointless.

Posted

Ah great Faz, someone who knows something!

 

Ok well, the finnish is the tower, as that has the highest noise value (100).

 

I probably shouldve shown a picture of the maze, you can only go to certain nodes from wherever you're at. I have the paths ive written, theyre at uni though il get those later to post. They go as in like

 

valid_path(start, skull);

valid_path(start,holly_bush);

valid_path(holly_bush, skull);

valid_path(skull,apple_tree);

etc etc

 

What i think its getting at is right, you start at 'start' and theres a few nodes you can get to from there, get prolog to choose the best suited node from the noise values of those. For instance, from 'start' you can get to 'holly_bush' or 'skull', we'd want it to choose skull as its noise value is 12 and holly bush's is only 4.

 

Where the bubble sort comes in im not sure, i just know we need it. Ive added you on msn, il hopefully catch you online when im at uni! Hope ive explained it a bit better.

Posted

Have you not learned the theory behind having to find the shortest route to and from certain destinations? I "learned" it, but i don't remember if i still have it or not... There was certain steps in the algorithm i seen.

Posted

Bump........................... !

(When i posted last time it didnt bring the thread to the top and the last poster was like you so blah)

×
×
  • Create New...