Java Reference
In-Depth Information
1 // Cheap main
2 public static void main( String [ ] args )
3 {
4 WordSearch p = null;
5
6 try
7 {
8 p = new WordSearch( );
9 }
10 catch( IOException e )
11 {
12 System.out.println( "IO Error: " );
13 e.printStackTrace( );
14 return;
15 }
16
17 System.out.println( "Solving..." );
18 p.solvePuzzle( );
19 }
figure 10.9
A simple main routine
for the word search
puzzle problem
C 2 is not a better move than what has already been seen. Thus we return that
C 2 is a draw and keep C 1 as the best move seen so far, as shown in
Figure 10.10. In general, then, a refutation is a countermove that proves that a
proposed move is not an improvement over moves previously considered.
figure 10.10
Alpha-beta pruning:
After H 2 a is evaluated,
C 2 , which is the
minimum of the H 2 's,
is at best a draw.
Consequently, it
cannot be an
improvement over C 2 .
We therefore do not
need to evaluate H 2 b ,
H 2 c , and H 2 d and can
proceed directly to C 3 .
C 1
C 2
C 3
Use best result
Use worst result
H 2 a
H 2 b
H 2 c
H 2 d
DRAW
DRAW
?
?
?
 
Search WWH ::




Custom Search