@logic-pad/core
Version:
30 lines (29 loc) • 1.3 kB
TypeScript
import { GridResizeHandler } from '../events/onGridResize.js';
import GridData from '../grid.js';
import Instruction from '../instruction.js';
import { Mode, State } from '../primitives.js';
export default abstract class Symbol extends Instruction implements GridResizeHandler {
readonly x: number;
readonly y: number;
constructor(x: number, y: number);
abstract validateSymbol(grid: GridData, solution: GridData | null): State;
modeVariant(_mode: Mode): Symbol | null;
onGridResize(_grid: GridData, mode: 'insert' | 'remove', direction: 'row' | 'column', index: number): this | null;
/**
* The step size for the x and y coordinates of the symbol.
*/
get placementStep(): number;
/**
* The order in which symbols are displayed on the instruction list. Lower values are displayed first.
*/
get sortOrder(): number;
withX(x: number): this;
withY(y: number): this;
withPosition(x: number, y: number): this;
/**
* For symbols that can be placed between tiles, this method implements the default validation logic,
* which requires all tiles touching the symbol to be either gray or of the same color.
*/
protected validateSubtilePlacement(grid: GridData): boolean;
}
export declare const instance: undefined;