-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtypes.ts
61 lines (51 loc) · 1.26 KB
/
types.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// tslint:disable:max-classes-per-file
export enum CellType {
black,
empty,
outside,
}
export enum ClueDirection {
across,
down,
}
export class Clue {
public clueNumber: number;
public direction: ClueDirection;
public initialPosition: Position;
public clue: string;
constructor(clueNumber: number, direction: ClueDirection, row: number, col: number) {
this.clueNumber = clueNumber;
this.direction = direction;
this.initialPosition = new Position(row, col);
}
}
export class Position {
public row: number;
public col: number;
constructor(row: number, col: number) {
this.row = row;
this.col = col;
}
}
export class Cell {
public solution: string = '';
public type: CellType;
public clueNumber: number;
public clues: Array<{ clueNumber: number; direction: ClueDirection }> = [];
public position: Position;
public wordBoundaryAcross: boolean;
public wordBoundaryDown: boolean;
constructor(row: number, col: number) {
this.position = new Position(row, col);
}
public isFillable() { return this.type === CellType.empty; }
}
export class Message {
public position: Position;
public solution: string;
}
export class Puzzle {
public language: string;
public cells: Cell[][] = [];
public clues: Clue[];
}