-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstratEval.java
More file actions
82 lines (73 loc) · 1.51 KB
/
Copy pathstratEval.java
File metadata and controls
82 lines (73 loc) · 1.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
public class StratEval {
public static int materialBalance(String[][] pos)
{
int materialEval=0;
int materialW=0; int materialB=0;
for(int i=0; i<64; i++)
{
switch (pos[i/8][i%8])
{
case "P":
materialW+=100;
break;
case "B":
materialW+=340;
break;
case "N":
materialW+=320;
break;
case "R":
materialW+=500;
break;
case "Q":
materialW+=900;
break;
case "K":
materialW+=100000;
break;
case "p":
materialB+=100;
break;
case "b":
materialB+=340;
break;
case "n":
materialB+=320;
break;
case "r":
materialB+=500;
break;
case "q":
materialB+=900;
break;
case "k":
materialB+=100000;
break;
}
}
materialEval = 2*(materialW-materialB);
return materialEval;
}
public static int globalEval(String[][] pos) // END RESULT: Addition of other classes, no eval
{
int eval=0;
eval+=materialBalance(pos)+Activity.piecePlacement(pos)+PawnStructure.spaceW(pos)
-PawnStructure.spaceB(pos)+PawnStructure.pawnCenter(pos)+ Activity.development();
for (int i=0; i<64; i++)
{
if(BB.controlB()[i] && BB.piecesW[i] && !BB.controlW()[i]) // attackedW
eval-=20;
if(BB.controlW()[i] && BB.piecesB[i] && !BB.controlB()[i]) // attackedB
eval+=20;
if(BB.pTakesB[i] && BB.piecesW[i])
eval+=40;
if(BB.pTakesW[i] && BB.piecesB[i])
eval-=40;
}
if(Board.kCastlingW) eval+=30;
if(Board.qCastlingW) eval+=10;
if(Board.kCastlingB) eval-=30;
if(Board.qCastlingB) eval-=10;
return eval;
}
}