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