@logic-pad/core
Version:
46 lines (45 loc) • 1.33 kB
JavaScript
import { State } from '../primitives.js';
import Symbol from './symbol.js';
export default class CustomSymbol extends Symbol {
description;
grid;
/**
* **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);
this.description = description;
this.grid = 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;
}
descriptionEquals(other) {
return (this.id === other.id &&
this.explanation === other.explanation &&
this.createExampleGrid().equals(other.createExampleGrid()));
}
withDescription(description) {
return this.copyWith({ description });
}
withGrid(grid) {
return this.copyWith({ grid });
}
}
export const instance = undefined;