-
Notifications
You must be signed in to change notification settings - Fork 0
/
rook.ts
37 lines (31 loc) · 800 Bytes
/
rook.ts
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
import { Color } from '../types/color';
import { Piece } from '../base/piece';
import { PieceType } from '../types/piece-type';
import { RegularMove } from '../moves/regular-move';
import { Move } from '../base/moving-strategy';
import { SlideDirection, SlidingMove } from '../moves/sliding-move';
export class Rook extends Piece {
constructor(protected _color: Color) {
super(_color);
}
get type() {
return PieceType.ROOK;
}
get image(): string {
return `${this.color}Rook.png`;
}
get materialValue(): number {
return 5;
}
get isKing(): boolean {
return false;
}
get moves(): Move[] {
return [
new SlidingMove(SlideDirection.TOP),
new SlidingMove(SlideDirection.RIGHT),
new SlidingMove(SlideDirection.BOTTOM),
new SlidingMove(SlideDirection.LEFT),
];
}
}