Różnice

Różnice między wybraną wersją a wersją aktualną.

Odnośnik do tego porównania

pl:prolog:pllib:depth-first_framework [2019/06/27 15:50] (aktualna)
Linia 1: Linia 1:
 +====== Depth-first framework ======
 +{{tag>​framework problem_solving}}
 +===== Description =====
 +A depth-first state-transition framework for problem solving
 +
 +**Source**: ​ The Art of Prolog
 +===== Download =====
 +Program source code: {{depth-first_framework.pl}}
 +===== Listing =====
 +<code prolog>
 +/​*  ​
 +  solve_dfs(State,​History,​Moves) :-
 +      Moves is the sequence of moves to reach a desired final state 
 + from the current State, where History contains the states ​
 + visited previously.
 +*/
 +
 +:-  op(900,​fy,​not).
 +
 +     ​solve_dfs(State,​History,​[]) :- 
 + final_state(State).
 +     ​solve_dfs(State,​History,​[Move|Moves]) :-
 + move(State,​Move),​
 + update(State,​Move,​State1),​
 + legal(State1),​
 + not member(State1,​History),​
 + solve_dfs(State1,​[State1|History],​Moves).
 +
 +/*  Testing the framework */​
 +
 +     ​test_dfs(Problem,​Moves) :-
 +        initial_state(Problem,​State),​ solve_dfs(State,​[State],​Moves).
 +
 +%  Program 20.1  A depth-first state-transition framework for problem solving
 +</​code>​
 +===== Comments =====
  
pl/prolog/pllib/depth-first_framework.txt · ostatnio zmienione: 2019/06/27 15:50 (edycja zewnętrzna)
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0