diff options
author | eug-vs <eugene@eug-vs.xyz> | 2022-03-12 15:10:54 +0300 |
---|---|---|
committer | eug-vs <eugene@eug-vs.xyz> | 2022-03-12 15:10:54 +0300 |
commit | 2e6a4a8761bf037283f7eb8dbfd57ab7b9e977a9 (patch) | |
tree | 22012ec08067f92d8baf9ab3039f3f7cda3e7402 /src/Board/Board.ts | |
parent | 8aa2213390e01996e3f9682abfd5910c698df0e2 (diff) | |
download | carcassonne-engine-ts-2e6a4a8761bf037283f7eb8dbfd57ab7b9e977a9.tar.gz |
refactor: rename Cell -> Tile, Item -> Feature
Diffstat (limited to 'src/Board/Board.ts')
-rw-r--r-- | src/Board/Board.ts | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/Board/Board.ts b/src/Board/Board.ts index c511e89..f1aa45b 100644 --- a/src/Board/Board.ts +++ b/src/Board/Board.ts @@ -1,25 +1,25 @@ import _ from 'lodash'; -import Cell, { Item } from "../Cell/Cell"; +import Tile, { Feature } from "../Tile/Tile"; -const { Road, Town, Empty } = Item; +const { Road, Town, Empty } = Feature; export default class Board { - cells: Cell[]; + cells: Tile[]; - constructor(cells?: Cell[]) { + constructor(cells?: Tile[]) { if (cells) this.cells = cells; - else this.cells = [new Cell(Road, [Town, Road, Empty, Road])] + else this.cells = [new Tile(Road, [Town, Road, Empty, Road])] } print() { this.cells.forEach(cell => cell.print()); } - getAttachments(cell: Cell) { + getAttachments(cell: Tile) { return _.flatten(this.cells.map(attachTo => attachTo.getAttachments(cell))); } - getLegalMoves(cell: Cell) { + getLegalMoves(cell: Tile) { const attachments = this.getAttachments(cell); console.log(attachments); } |