Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Prolog

Name: Anonymous 2013-03-14 3:20

We've been using Prolog in one of my classes this semester.  It's pretty neat!

So far, our assignments have been writing evaluators and a super-shitty compiler for Little Languages represented as Prolog lists -- essentially S-expressions.

It's amazing how much one can do with three or four lines of code!

Anyhow, what do you guys think of /b/rolog?

Name: Anonymous 2013-03-14 21:03

Any experts in Prolog and Breadth-First Search want to give any pointers? :(

"breadth_seek(Goal) such that, when invoked with Goal instantiated to a goal node for breadth first search, breadth_seek will invoke breadth_iterate zero or more times, until Goal appears on (i.e. is mapped by) the openlist.  If breadth_iterate fails before this happens, breath_seek(Goal) should also fail."

We have a dynamic list for the open and closed lists:
:- dynamic openlist/1, closedlist/1.

we also have a mapped(K, M), where K is the key and M is the list, I.E if K appears in the list M, then the result is Yes, if it isn't, the result is No.

This is my breadth_iterate so far, but I believe it's probably wrong:
breadth_iterate :-
      %take the first node off the open list
      %expand it (see all nodes within one step)
      %change open and closed lists
      %splits openlist into head and tail, gets first node 
      closedlist(Mclosed),
      openlist(Mopen),
 
      openlist([(OpenNode,ClosedNode)|Tail]),
      back_map(OpenNode, Mapping),
    
      append([(OpenNode,ClosedNode)], Mclosed, NewClosedList),
      append(Mopen, Mapping, NewOpenList),   
      mapdiff(NewOpenList, NewClosedList, M3),
    
      retractall(openlist(Mopen)),
      retractall(closedlist(Mclosed)),
      assert(openlist(M3)),
    
      %assert(openlist(NewOpenList)),
      assert(closedlist(NewClosedList)).
      %append(Mclosed, ClosedNode, NewClosedList).

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List