-
Notifications
You must be signed in to change notification settings - Fork 5
/
mtdf.html
88 lines (80 loc) · 2.6 KB
/
mtdf.html
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
83
84
85
86
87
88
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
'use strict';
var Engine = new Worker("mtdf_worker.js");
var GameBoard = [
//0 1 2 3 4 5 6 7 8 9 0 1 2 3 4
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], //0
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], //1
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], //2
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], //3
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], //4
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], //5
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], //6
[0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0], //7
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], //8
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], //9
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], //10
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], //11
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], //12
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], //13
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], //14
]
// GameBoard[7][7] = -1;
// GameBoard[8][8] = 1;
// GameBoard[6][6] = -1;
// GameBoard[7][5] = 1;
// GameBoard[9][7] = -1;
// GameBoard[8][7] = 1;
// GameBoard[8][6] = -1;
// GameBoard[7][6] = 1;
// GameBoard[6][8] = -1;
// GameBoard[5][9] = 1;
// GameBoard[6][5] = -1;
// GameBoard[6][7] = 1;
// GameBoard[5][8] = -1;
// GameBoard[9][8] = 1;
// GameBoard[10][8] = -1;
// GameBoard[8][9] = 1;
// GameBoard[7][8] = -1;
// GameBoard[10][9] = 1;
// GameBoard[11][10] = -1;
// GameBoard[11][9] = 1;
// GameBoard[9][9] = -1;
// GameBoard[8][10] = 1;
// GameBoard[8][11] = -1;
// GameBoard[7][10] = 1;
// GameBoard[6][11] = -1;
// GameBoard[6][10] = 1;
// GameBoard[9][10] = -1;
// GameBoard[4][8] = 1;
// GameBoard[7][11] = -1;
// GameBoard[5][11] = 1;
// GameBoard[10][11] = -1;
// GameBoard[9][11] = 1;
// GameBoard[12][9] = -1;
// GameBoard[7][9] = 1;
// GameBoard[8][8] = -1;
// GameBoard[7][7] = 1;
// GameBoard[8][8] = -1;
// GameBoard[7][7] = 1;
// GameBoard[8][8] = -1;
// GameBoard[7][7] = 1;
Engine.onmessage = function(e) {
console.log(e.data.bestmove);
console.log(`Cache Hits: ${e.data.CacheHits}`)
console.log(`Cache Cutoffs: ${e.data.CacheCutoffs}`)
console.log(`Cache Puts: ${e.data.CachePuts}`)
console.log(`function calls ${e.data.fc}`)
console.log(`Call to iterative mtdf took ${e.data.time} seconds.`)
console.log(`StateCacheHits: ${e.data.StateCacheHits}`)
console.log(`StateCachePuts: ${e.data.StateCachePuts}`)
console.log(e.data.firstMoves)
}
var MaximumTimeForMove=60000;
Engine.postMessage([GameBoard,1,MaximumTimeForMove]);
</script>
</head>
</html>