-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpseudoCode
50 lines (42 loc) · 834 Bytes
/
pseudoCode
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
alpha beta prunning
int AB(int depth, int alpha,int beta)
{
MoveScore = -INF;
depth < 1 ? return ScoreFromSidePOV();
for(each node in position)
{
MakeMove;
moveScore = -AB(depth-1,-beta,-alpha);
takemove;
if(moveScore >= beta )
return beta;
if(moveScore > alpha)
alpha = moveScore;
}
return alpha;
}
////////////////////////////////////////////////
int search(depth)
{
int currDepth = 1;
iterativeDeepen(depth)
{
alphabeta();
currDepth++;
}
}
int alphabeta()
{
IsRepeated() return 0;
IsInterrtupt() { SetQuit(); return 0; }
GenMoves();
probeMove(); -> Need Hash Table
if(have PvMove) OrderPvMove();
LoopMoves()
{
Make();
alphabeta(depth -1);
Take();
isBetaCut() -> return beta;
isAlphacut() { note bestMove , increase alpha};
}