UNPKG

@logic-pad/core

Version:
49 lines (48 loc) 1.42 kB
import { State } from '../primitives.js'; import MultiEntrySymbol from './multiEntrySymbol.js'; export default class CustomSymbol extends MultiEntrySymbol { /** * **A custom symbol** * * @param description - The description of the symbol. Leave this empty to hide the description. * @param grid - The thumbnail grid of the rule, preferably 5x4 in size. * @param x - The x-coordinate of the symbol. * @param y - The y-coordinate of the symbol. */ constructor(description, grid, x, y) { super(x, y); Object.defineProperty(this, "description", { enumerable: true, configurable: true, writable: true, value: description }); Object.defineProperty(this, "grid", { enumerable: true, configurable: true, writable: true, value: grid }); this.description = description; this.grid = grid; } get explanation() { return this.description; } createExampleGrid() { return this.grid; } validateSymbol(_grid) { return State.Incomplete; } get validateWithSolution() { return true; } withDescription(description) { return this.copyWith({ description }); } withGrid(grid) { return this.copyWith({ grid }); } } export const instance = undefined;