UNPKG

@logic-pad/core

Version:
75 lines (74 loc) 1.51 kB
export default class TileConnections { constructor() { for (let i = -1; i <= 1; i++) { this[i] = {}; for (let j = -1; j <= 1; j++) { this[i][j] = false; } } } get topLeft() { return this[-1][-1]; } set topLeft(value) { this[-1][-1] = value; } get top() { return this[-1][0]; } set top(value) { this[-1][0] = value; } get topRight() { return this[-1][1]; } set topRight(value) { this[-1][1] = value; } get left() { return this[0][-1]; } set left(value) { this[0][-1] = value; } get center() { return this[0][0]; } set center(value) { this[0][0] = value; } get right() { return this[0][1]; } set right(value) { this[0][1] = value; } get bottomLeft() { return this[1][-1]; } set bottomLeft(value) { this[1][-1] = value; } get bottom() { return this[1][0]; } set bottom(value) { this[1][0] = value; } get bottomRight() { return this[1][1]; } set bottomRight(value) { this[1][1] = value; } equals(other) { for (let i = -1; i <= 1; i++) { for (let j = -1; j <= 1; j++) { if (this[i][j] !== other[i][j]) { return false; } } } return true; } }