Lines of Code | 27 |
Duplicated Lines | 0 |
Ratio | 0 % |
Coverage | 12.5% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | /** |
||
5 | "use strict"; |
||
6 | |||
7 | /** |
||
8 | * Class with Bishop logic |
||
9 | */ |
||
10 | class Bishop { |
||
11 | /** |
||
12 | * init |
||
13 | */ |
||
14 | constructor(color) { |
||
15 | this.symbol = "B"; |
||
16 | this.moved = 0; |
||
17 | this.active = true; |
||
18 | this.color = color; |
||
19 | } |
||
20 | |||
21 | legalMove(x, y, nx, ny) { |
||
22 | 6 | if (x == nx && y !== ny || x !== nx && y == ny) { |
|
23 | return true |
||
24 | } |
||
25 | |||
26 | return false; |
||
27 | } |
||
28 | } |
||
29 | |||
30 | |||
31 | module.exports = Bishop; |
||
32 |