import _ from 'lodash'; import Tile, { Feature } from "../Tile/Tile"; const { Road, Town, Empty } = Feature; export default class Board { cells: Tile[]; constructor(cells?: Tile[]) { if (cells) this.cells = cells; else this.cells = [new Tile(Road, [Town, Road, Empty, Road])] } print() { this.cells.forEach(cell => cell.print()); } getAttachments(cell: Tile) { return _.flatten(this.cells.map(attachTo => attachTo.getAttachments(cell))); } getLegalMoves(cell: Tile) { const attachments = this.getAttachments(cell); console.log(attachments); } }