| 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 |
1
1
1
1
1
1
1
8908
1
1
4984
4984
44012
215496
4984
4984
4984
4984
4984
4984
14707
14707
9862
9862
9862
9862
9862
9862
48890
48890
39167
39167
39167
39167
39167
39028
39028
39028
4845
1
8908
8908
1
4777
6608
13216
4777
4777
1857
1857
1831
1831
1831
4751
1
4454
4454
4454
4454
| "use strict";
Object.defineProperties(exports, {
Royal: {get: function() {
return Royal;
}},
__esModule: {value: true}
});
var $__0 = require('./brands'),
KINGSIDE = $__0.KINGSIDE,
QUEENSIDE = $__0.QUEENSIDE;
var Point = require('./point').Point;
var $__2 = require('./mobility'),
Mobility = $__2.Mobility,
quadrants = $__2.quadrants;
var Castling = require('./castling').Castling;
var RoyalMobility = function RoyalMobility() {
$traceurRuntime.defaultSuperCall(this, $RoyalMobility.prototype, arguments);
};
var $RoyalMobility = RoyalMobility;
($traceurRuntime.createClass)(RoyalMobility, {adjacentPoints: $traceurRuntime.initGeneratorFunction(function $__10(position, p0) {
var $__9,
m,
n,
$__7,
$__8,
o,
$__5,
$__6,
p1;
return $traceurRuntime.createGeneratorInstance(function($ctx) {
while (true)
switch ($ctx.state) {
case 0:
$__9 = this, m = $__9.m, n = $__9.n;
$ctx.state = 14;
break;
case 14:
$__7 = [new Point(m, n), new Point(n, m)][$traceurRuntime.toProperty(Symbol.iterator)]();
$ctx.state = 7;
break;
case 7:
$ctx.state = (!($__8 = $__7.next()).done) ? 9 : -2;
break;
case 9:
o = $__8.value;
$ctx.state = 10;
break;
case 10:
$__5 = quadrants[$traceurRuntime.toProperty(Symbol.iterator)]();
$ctx.state = 4;
break;
case 4:
$ctx.state = (!($__6 = $__5.next()).done) ? 5 : 7;
break;
case 5:
p1 = $__6.value;
$ctx.state = 6;
break;
case 6:
$ctx.state = 2;
return p0.sum(p1.product(o));
case 2:
$ctx.maybeThrow();
$ctx.state = 4;
break;
default:
return $ctx.end();
}
}, $__10, this);
})}, {}, Mobility);
var CastlingMobility = function CastlingMobility(color, side) {
this.color = color;
this.side = side;
};
($traceurRuntime.createClass)(CastlingMobility, {adjacentPoints: $traceurRuntime.initGeneratorFunction(function $__11(position, p0) {
return $traceurRuntime.createGeneratorInstance(function($ctx) {
while (true)
switch ($ctx.state) {
case 0:
$ctx.state = (position.castling.isLegal(this.color, this.side)) ? 1 : -2;
break;
case 1:
$ctx.state = 2;
return p0.sum(Castling.kingOffset(this.color, this.side));
case 2:
$ctx.maybeThrow();
$ctx.state = -2;
break;
default:
return $ctx.end();
}
}, $__11, this);
})}, {}, Mobility);
function Royal() {
this.mobility.push(new RoyalMobility(1, 0));
this.mobility.push(new RoyalMobility(1, 1));
this.mobility.push(new CastlingMobility(this.color, KINGSIDE));
this.mobility.push(new CastlingMobility(this.color, QUEENSIDE));
}
|