@logic-pad/core
Version:
48 lines (47 loc) • 1.35 kB
JavaScript
import Symbol from './symbol.js';
import { ConfigType } from '../config.js';
import GridData from '../grid.js';
import { State } from '../primitives.js';
/**
* A marker for symbols not supported by the current solver.
* Solvers should count these symbols in the symbols per region rule but otherwise ignore them.
*/
export default class UnsupportedSymbol extends Symbol {
title = 'Unsupported Symbol';
static CONFIGS = Object.freeze([
{
type: ConfigType.Number,
default: 0,
field: 'x',
description: 'X',
configurable: false,
},
{
type: ConfigType.Number,
default: 0,
field: 'y',
description: 'Y',
configurable: false,
},
]);
static EXAMPLE_GRID = Object.freeze(GridData.create(['.']));
get id() {
return `unsupported`;
}
get explanation() {
return 'Unsupported symbol';
}
get configs() {
return UnsupportedSymbol.CONFIGS;
}
createExampleGrid() {
return UnsupportedSymbol.EXAMPLE_GRID;
}
validateSymbol(_grid, _solution) {
return State.Satisfied;
}
copyWith({ x, y }) {
return new UnsupportedSymbol(x ?? this.x, y ?? this.y);
}
}
export const instance = new UnsupportedSymbol(0, 0);