Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | 15x 15x 15x 15x 15x 15x 15x 15x 15x 15x 15x 15x 15x 120x 120x 6321x 6321x 6321x 6321x 6321x 6321x 6321x 6321x 6321x 6321x 6321x 6321x 120x 120x 15x 15x 15x 15x 15x 15x 15x 15x 15x | import { createCoordinate } from "./coordinate.js"; function createDirection(row, column) { function getRow() { return row; } function getColumn() { return column; } function getNextCoordinate(originCoordinate) { let newRow = parseInt(originCoordinate.getRow()) + parseInt(row); let newColumn = parseInt(originCoordinate.getColumn()) + parseInt(column); let newCoordinate = createCoordinate( newRow, newColumn ); return newCoordinate.getPosition() ? newCoordinate : originCoordinate; } return { getRow, getColumn, getNextCoordinate }; } const DirectionEnum = Object.freeze({ NORTH : createDirection(1, 0), SOUTH : createDirection(-1, 0), EAST : createDirection(0, 1), WEST : createDirection(0, -1), NORTHEAST: createDirection(1, 1), NORTHWEST: createDirection(1, -1), SOUTHEAST: createDirection(-1, 1), SOUTHWEST: createDirection(-1, -1), }); export { DirectionEnum }; |