UNPKG

@logic-pad/core

Version:
15 lines (14 loc) 474 B
import DirectionLinkerBTModule from './directionLinker.js'; export default class GalaxyBTModule extends DirectionLinkerBTModule { instr; constructor(instr) { super(instr); 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; } }