aboutsummaryrefslogtreecommitdiff
path: root/src/Board/Board.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/Board/Board.ts')
-rw-r--r--src/Board/Board.ts21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/Board/Board.ts b/src/Board/Board.ts
index f1aa45b..59afd31 100644
--- a/src/Board/Board.ts
+++ b/src/Board/Board.ts
@@ -1,26 +1,27 @@
import _ from 'lodash';
-import Tile, { Feature } from "../Tile/Tile";
+import Tile, { Feature } from '../Tile/Tile';
+import TileOnBoard from '../Tile/TileOnBoard';
const { Road, Town, Empty } = Feature;
export default class Board {
- cells: Tile[];
+ tiles: TileOnBoard[];
- constructor(cells?: Tile[]) {
- if (cells) this.cells = cells;
- else this.cells = [new Tile(Road, [Town, Road, Empty, Road])]
+ constructor(tiles?: TileOnBoard[]) {
+ if (tiles) this.tiles = tiles;
+ else this.tiles = [new TileOnBoard(Road, [Town, Road, Empty, Road])]
}
print() {
- this.cells.forEach(cell => cell.print());
+ this.tiles.forEach(tile => tile.print());
}
- getAttachments(cell: Tile) {
- return _.flatten(this.cells.map(attachTo => attachTo.getAttachments(cell)));
+ getAttachments(tile: Tile) {
+ return _.flatten(this.tiles.map(attachTo => attachTo.getAttachments(tile)));
}
- getLegalMoves(cell: Tile) {
- const attachments = this.getAttachments(cell);
+ getLegalMoves(tile: Tile) {
+ const attachments = this.getAttachments(tile);
console.log(attachments);
}
}