Trees game

Description

A game tree

Source: PROLOG programming for artificial intelligence, 3rd Edition, Harlow, 2001, ISBN 0-201-40375-7.

Download

Program source code: trees_game.pl

Listing

%  A game tree (Figure 22.2 translated to Prolog)
 
%  moves( Position, PositionList): possible moves
 
moves( a, [b,c]).
moves( b, [d,e]).
moves( c, [f,g]).
moves( d, [i,j]).
moves( e, [k,l]).
moves( f, [m,n]).
moves( g, [o,p]).
 
% min_to_move( Pos): Player 'min' to move in Pos
 
min_to_move( b).
min_to_move( c).
 
% max_to_move Pos): Player 'max' to move in Pos
 
max_to_move( a).
max_to_move( d).
max_to_move( e).
max_to_move( f).
max_to_move( g).
 
% staticval( Pos, Value):  Value is the static value of Pos
 
staticval( i, 1).
staticval( j, 4).
staticval( k, 5).
staticval( l, 6).
staticval( m, 2).
staticval( n, 1).
staticval( o, 1).
staticval( p, 1).

Comments

pl/prolog/pllib/trees_game.txt · ostatnio zmienione: 2017/07/17 08:08 (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