1 #include "types.h"
2 #include "strategie.h"
3 #include "val_strategie.h"
4 
stratcalc(play_board,depth,i,j)5 int stratcalc(play_board,depth,i,j)
6 
7 board play_board;
8 int i,j,depth;
9 {
10 int a;
11 
12 if (!(play_board[i][j])&&(i!=0)&&(j!=0)&&(i!=9)&&(j!=7))
13 	{
14 	if (depth)
15 		{
16 		a=stratcalc(play_board,depth-1,i-1,j);
17 		a+=stratcalc(play_board,depth-1,i+1,j);
18 		a+=stratcalc(play_board,depth-1,i-1,j-1);
19 		a+=stratcalc(play_board,depth-1,i,j-1);
20 		a+=stratcalc(play_board,depth-1,i+1,j-1);
21 		a+=stratcalc(play_board,depth-1,i-1,j+1);
22 		a+=stratcalc(play_board,depth-1,i,j+1);
23 		a+=stratcalc(play_board,depth-1,i+1,j+1);
24 		a+=!play_board[i][j];
25 		}
26 	else
27 		{
28 		a=liberte(play_board,i,j);
29 		};
30 	return(a);
31 	}
32 else
33 	{
34 	return(0);
35 	};
36 }
37 
move(play_board,i,j)38 int move(play_board,i,j)
39 
40 board play_board;
41 int i,j;
42 {
43 int a,ii,jj,dump;
44 
45 a=-1000;
46 dump=stratcalc(play_board,PROF,i-1,j-1);
47 if (dump>a)
48 	{
49 	ii=i-1;
50 	jj=j-1;
51 	a=dump;
52 	};
53 dump=stratcalc(play_board,PROF,i-1,j);
54 if (dump>a)
55 	{
56 	ii=i-1;
57 	jj=j;
58 	a=dump;
59 	};
60 dump=stratcalc(play_board,PROF,i-1,j+1);
61 if (dump>a)
62 	{
63 	ii=i-1;
64 	jj=j+1;
65 	a=dump;
66 	};
67 dump=stratcalc(play_board,PROF,i,j-1);
68 if (dump>a)
69 	{
70 	ii=i;
71 	jj=j-1;
72 	a=dump;
73 	};
74 dump=stratcalc(play_board,PROF,i,j+1);
75 if (dump>a)
76 	{
77 	ii=i;
78 	jj=j+1;
79 	a=dump;
80 	};
81 dump=stratcalc(play_board,PROF,i+1,j-1);
82 if (dump>a)
83 	{
84 	ii=i+1;
85 	jj=j-1;
86 	a=dump;
87 	};
88 dump=stratcalc(play_board,PROF,i+1,j);
89 if (dump>a)
90 	{
91 	ii=i+1;
92 	jj=j;
93 	a=dump;
94 	};
95 dump=stratcalc(play_board,PROF,i+1,j+1);
96 if (dump>a)
97 	{
98 	ii=i+1;
99 	jj=j+1;
100 	a=dump;
101 	};
102 dump=10*ii+jj;
103 return(dump);
104 }
105