Różnice

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

Odnośnik do tego porównania

pl:prolog:pllib:best-move [2019/06/27 15:50]
pl:prolog:pllib:best-move [2019/06/27 15:50] (aktualna)
Linia 1: Linia 1:
 +====== Best-move ======
 +{{tag>​algorithms}}
 +===== Description =====
 +Choosing the best move 
 +
 +**Source**: ​ The Art of Prolog
 +===== Download =====
 +Program source code: {{best-move.pl}}
 +===== Listing =====
 +<code prolog>
 +/*
 +    evaluate_and_choose(Moves,​Position,​Record,​BestMove) :-
 + Chooses the BestMove from the set of Moves from the current
 + Position, Record records the current best move.
 +*/
 +     ​evaluate_and_choose([Move|Moves],​Position,​Record,​BestMove) :-
 + move(Move,​Position,​Position1),​
 + value(Position1,​Value), ​
 + update(Move,​Value,​Record,​Record1), ​
 + evaluate_and_choose(Moves,​Position,​Record1,​BestMove).
 +     ​evaluate_and_choose([],​Position,​(Move,​Value),​Move).
 +
 + update(Move,​Value,​(Move1,​Value1),​(Move1,​Value1)) :- 
 +    Value =< Value1.
 + update(Move,​Value,​(Move1,​Value1),​(Move,​Value)) :- 
 +   Value > Value1.
 +
 +%  Program 20.9   ​Choosing the best move 
 +</​code>​
 +===== Comments =====
  
pl/prolog/pllib/best-move.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