diff options
-rw-r--r-- | src/Board/Board.ts | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/Board/Board.ts b/src/Board/Board.ts index 4ba7a4c..1525c6c 100644 --- a/src/Board/Board.ts +++ b/src/Board/Board.ts @@ -14,7 +14,17 @@ export default class Board { } print() { - this.tiles.forEach(tile => tile.print()); + const maxY = _.maxBy(this.tiles, 'position.y').position.y; + const minY = _.minBy(this.tiles, 'position.y').position.y; + + _.range(maxY, minY - 1, -1) + .map(y => { + const rowTiles = _.filter(this.tiles, { position: { y } }); + // console.log({ rowTiles, y }); + console.log(rowTiles.map(tile => ` ${tile.sides[North]} `).join()); + console.log(rowTiles.map(tile => `${tile.sides[West]}${tile.center}${tile.sides[East]}`).join()); + console.log(rowTiles.map(tile => ` ${tile.sides[South]} `).join()); + }); } getAttachments(tile: Tile): Attachment[] { |