export enum Direction { North, East, South, West } export enum Feature { Empty = ' ', Road = 'R', Town = 'T', River = 'I', Church = 'C', } // Abstract Tile data export default class Tile { center: Feature; sides: [Feature, Feature, Feature, Feature]; shield?: boolean; public constructor(center: Feature, sides: [Feature, Feature, Feature, Feature], shield = false) { this.center = center; this.sides = sides; this.shield = shield; } getSide(direction: Direction) { return this.sides[((direction % 4) + 4) % 4]; } print() { console.log( ` ${this.getSide(Direction.North)} \n${this.getSide(Direction.West)}${this.center}${this.getSide(Direction.East)}\n ${this.getSide(Direction.South)} `); } }