@ne1410s/griddler
Version:
Complete package for creating, sharing and solving griddler grids!
53 lines (52 loc) • 2.19 kB
TypeScript
import { LabelSetLink, Label } from './label';
import { CellSetBase, BlockSet, SpaceSet } from './cell-set';
import { SetType, CellState } from './enums';
/** A complete set of cells - representing a column or row. */
export declare class FullSet extends CellSetBase {
readonly start: number;
readonly type: SetType;
readonly index: number;
readonly cells: CellState[];
labelSpaceMap: LabelSetLink[];
labelBlockMap: LabelSetLink[];
readonly spaces: SpaceSet[];
readonly blocks: BlockSet[];
readonly labels: Label[];
readonly indexRef: string;
readonly altType: SetType;
get stateRef(): string;
get consoleRef(): string;
get labelRef(): string;
get labelsRef(): string;
get solved(): boolean;
constructor(start: number, type: SetType, index: number, cells: CellState[], labelValues: number[]);
/** Marks and fills all appropriate blocks, returning indices of the mark and fill cells. */
solve(): {
marks: number[];
fills: number[];
};
getLabelRef(index: number): string;
private getLinksForLabel;
private getLinksForSet;
private deleteLink;
private upsertLink;
private upsertLinks;
/**
* Iterates cells in a particular direction. The forward pass sets spaces and blocks for the
* set as well as earliest label positions. The backward pass sets labels latest positions only.
* NB: This method is not reasonably capable of managing block-block interactions.
*/
private performCellPass;
private setLabelSpaces;
private setLabelBlocks;
/** For each block with only 1 linked label, make the linkage known */
private updateMaps;
/** Now the maps are good set min and max values based on labels. */
private applyBlockValueRanges;
/** Now min and max are good, inspect for unbridgable blocks and return whether links have changed as a result. */
private applyBlockPositionRanges;
/** Checks whether block and neighbouring unbridgable block need labels removing. */
private tryRemoveLinks;
/** Removes block/label links where label count matches distinct block count */
private applyDistinctBlockPairing;
}