.


:




:

































 

 

 

 





, , . , ( ), . , , , . , , . . . , , ( ).

, " " " ". () , , , . .



II. Prolog


 

. , . , , , . , , MI N. , , , . MIN , . , ( ) , . 22.2. , , , MI N. . . , , , . . 22,2 4, -. MIN b-d .. . , . , . , .


M1N



. 22.2. ( ) . , , , .. , ( Prolog 22.1)

22.1. , 22.2, Prolog "' % ""moves(" Position, PositionList): ''""


moves (a, moves t b, moves (c, moves(d, moves (e, moves(f,


b,c


 


22.



moves(g, (oyp]).

% min_tc_ move (Pos): KIN Pos

min_tKmove (). rain_to_inove().

h max"to_move(;:

max_to_move{ a).

ma>:_to_jnove { d).

max_to_move{ e).

ma>:_to_move { f).

max_t<3_move (g).

% staticval { Pos, Value): Value - Pos

staticval[ i, 1). staticvaK j, 4). staticvaK k, 5). staticval(1, 6}. staticvaK m, 2). staticvaK n, 1), staticvaK o, 1). staticvaK P, 1),

. , , .

. :

v(P)

:

V[P)

, Pi,,.., , - . , .

( = 0), V () = v (P).

- , V () = max ViPJ,

i

- MIN, V(P) = min V(Pi),

i

Prolog1, , 22.2. : minimax{ Pos, BestSuccF Val)

Val Pos, a BestSucc , Pos (, Val). moves(, PosList)

; PosList Pos. , moves , ( ), : best) PosList, BestPos, BestVal;



II. Prolog


"" BestPos PosList. BestVal BestPos 5. "" , , .





:


: 2015-10-01; !; : 700 |


:

:

, .
==> ...

1538 - | 1334 -


© 2015-2024 lektsii.org - -

: 0.013 .