-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathtest.html
117 lines (117 loc) · 4.53 KB
/
test.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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Scalachessjs test</title>
<script>
var worker = new Worker('target/scala-2.11/scalachessjs-fastopt.js');
worker.addEventListener('message', function(e) {
switch (e.data.topic) {
case 'init':
console.info('init', e.data.payload);
break;
case 'dests':
console.timeEnd('dests');
console.info('dest', e.data.payload);
break;
case 'situation':
console.info('situation', e.data.payload);
break;
case 'move':
console.timeEnd('move');
console.info('move', e.data);
break;
case 'drop':
console.timeEnd('drop');
console.info('drop', e.data.payload);
break;
case 'threefoldTest':
console.timeEnd('threefoldTest');
console.info('threefoldTest', e.data.payload);
break;
case 'pgnDump':
console.timeEnd('pgnDump');
console.info('pgnDump', e.data.payload.pgn);
break;
case 'error':
console.error(e.data.payload);
break;
}
});
worker.postMessage({
topic: 'init',
payload: {
variant: 'crazyhouse'
}
});
function dests() {
console.time('dests');
worker.postMessage({
topic: 'dests',
payload: {
fen: 'rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1',
variant: 'kingOfTheHill'
}
});
}
function move() {
console.time('move');
worker.postMessage({
topic: 'move',
reqid: String(performance.now()),
payload: {
fen: 'rnbqkbnr/pppp1ppp/8/4p3/4P3/8/PPPP1PPP/RNBQKBNR w KQkq - 0 2 +0+0',
variant: 'threeCheck',
pgnMoves: ['e4', 'e5'],
uciMoves: ['e2e4', 'e7e5'],
orig: 'd2',
dest: 'd4',
path: '0'
}
});
}
function drop() {
console.time('drop');
worker.postMessage({
topic: 'drop',
payload: {
fen: 'r6k/ppp2qbp/7P/3p1pP1/5Rp1/4Pp1n/P1P2PPP/1R1Q1RK1/bbnnbn b - - 73 38',
variant: 'crazyhouse',
pgnMoves: [],
uciMoves: [],
role: 'knight',
pos: 'c5',
path: '0'
}
});
}
function threefoldTest() {
console.time('threefoldTest');
worker.postMessage({
topic: 'threefoldTest',
payload: {
initialFen: 'rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1',
variant: 'standard',
pgnMoves: ["e4", "d6", "d4", "g6", "Nc3", "Nf6", "f4", "Bg7", "Nf3", "c5", "dxc5", "Qa5", "Bd3", "Qxc5", "Qe2", "O-O", "Be3", "Qa5", "O-O", "Bg4", "Rad1", "Nc6", "Bc4", "Nh5", "Bb3", "Bxc3", "bxc3", "Qxc3", "f5", "Nf6", "h3", "Bxf3", "Qxf3", "Na5", "Rd3", "Qc7", "Bh6", "Nxb3", "cxb3", "Qc5+", "Kh1", "Qe5", "Bxf8", "Rxf8", "Re3", "Rc8", "fxg6", "hxg6", "Qf4", "Qxf4", "Rxf4", "Nd7", "Rf2", "Ne5", "Kh2", "Rc1", "Ree2", "Nc6", "Rc2", "Re1", "Rfe2", "Ra1", "Kg3", "Kg7", "Rcd2", "Rf1", "Rf2", "Re1", "Rfe2", "Rf1", "Re3", "a6", "Rc3", "Re1", "Rc4", "Rf1", "Rdc2", "Ra1", "Rf2", "Re1", "Rfc2", "g5", "Rc1", "Re2", "R1c2", "Re1", "Rc1", "Re2", "R1c2", "Re1", "Rc1"]
}
});
}
function pgnDump() {
console.time('pgnDump');
worker.postMessage({
topic: 'pgnDump',
payload: {
initialFen: 'rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1',
variant: 'standard',
pgnMoves: ["e4", "d6", "d4", "g6", "Nc3", "Nf6", "f4", "Bg7", "Nf3", "c5", "dxc5", "Qa5", "Bd3", "Qxc5", "Qe2", "O-O", "Be3", "Qa5", "O-O", "Bg4", "Rad1", "Nc6", "Bc4", "Nh5", "Bb3", "Bxc3", "bxc3", "Qxc3", "f5", "Nf6", "h3", "Bxf3", "Qxf3", "Na5", "Rd3", "Qc7", "Bh6", "Nxb3", "cxb3", "Qc5+", "Kh1", "Qe5", "Bxf8", "Rxf8", "Re3", "Rc8", "fxg6", "hxg6", "Qf4", "Qxf4", "Rxf4", "Nd7", "Rf2", "Ne5", "Kh2", "Rc1", "Ree2", "Nc6", "Rc2", "Re1", "Rfe2", "Ra1", "Kg3", "Kg7", "Rcd2", "Rf1", "Rf2", "Re1", "Rfe2", "Rf1", "Re3", "a6", "Rc3", "Re1", "Rc4", "Rf1", "Rdc2", "Ra1", "Rf2", "Re1", "Rfc2", "g5", "Rc1", "Re2", "R1c2", "Re1", "Rc1", "Re2", "R1c2", "Re1", "Rc1"],
white: 'Georges Abitbol',
black: 'Monsieur Hugues'
}
});
}
</script>
</head>
<body>
<h1>Scalachessjs test page</h1>
</body>
</html>