Information Technology Reference
In-Depth Information
Figure 10.14.
Playing Boxes
?- win_move([ draw(min,6),draw(max,10),draw(min,2),draw(max,4),
draw(min,9),draw(max,1) ],
max, Move).
Move = [3, 8]
Yes
?- win_move([ draw(min,5),draw(max,10),draw(min,2),draw(max,4),
draw(min,9),draw(max,1) ],
max, Move).
Move = [7]
;
% Note: Draw one line only.
No
?- tie_move([
draw(max,10),draw(min,2),draw(max,4),
draw(min,9),draw(max,1) ],
min, Move).
No
% So Min loses from here.
?- win_move([
draw(min,2),draw(max,4),
draw(min,9),draw(max,1) ],
max, Move).
Move = [8]
;
Move = [10]
;
% As above
No
?- win_move([],max,M).
% Can the first player guarantee a win?
No
% ... After 2 minutes of computing
The third query backs up one step and asks if Min can avoid losing from the
configuration shown. The answer is that she cannot: the previous query showed
that she would not win if she drew line 5; the other lines are similar.
The next query backs up one more line and asks what Max can do to win in the
displayed T configuration. One thing he can do is to draw line 10, which leads to
the configuration of the previous query, where Min loses. The other thing Max
can do is to draw line 8, which also works.
The final query asks if Max can guarantee a win from the initial state. It takes a
while to explore the entire game tree to answer this question, but the final answer
is no.
10.3 Playing bigger games
It is not hard to see that every game considered in this chapter has to be one of the
following three types:
 
Search WWH ::




Custom Search