UNPKG

@logic-pad/core

Version:
20 lines (19 loc) 638 B
import DirectionLinkerBTModule from './directionLinker.js'; export default class GalaxyBTModule extends DirectionLinkerBTModule { constructor(instr) { super(instr); Object.defineProperty(this, "instr", { enumerable: true, configurable: true, writable: true, value: void 0 }); this.instr = instr; } // Translate a position in relative to a galaxy symbol movePos(grid, x, y) { const symbol = this.instr; const pos = { x: 2 * symbol.x - x, y: 2 * symbol.y - y }; return grid.isInBound(pos.x, pos.y) ? pos : null; } }