UNPKG

@logic-pad/core

Version:
121 lines (120 loc) 3.05 kB
export interface Position { readonly x: number; readonly y: number; } export interface Edge { readonly x1: number; readonly y1: number; readonly x2: number; readonly y2: number; } /** * Major rules are frequently referenced in grids to provide additional UI. */ export declare enum MajorRule { MusicGrid = "music", CompletePattern = "complete_pattern", Underclued = "underclued", WrapAround = "wrap_around" } export declare enum State { /** * Describes the violation of a rule. */ Error = "error", /** * Describes that a rule is satisfied and complete in the current grid. */ Satisfied = "satisfied", /** * Describes that a rule is not violated, but is not yet complete in the current grid. */ Incomplete = "incomplete", /** * Describes that a rule is violated but ignored due to the effect of another rule. */ Ignored = "ignored" } export declare namespace State { function isSatisfied(state: State): boolean; } export type RuleState = { readonly state: State.Error; readonly positions: readonly Position[]; } | { readonly state: State.Satisfied; } | { readonly state: State.Incomplete; } | { readonly state: State.Ignored; }; export interface GridState { final: State; rules: readonly RuleState[]; symbols: ReadonlyMap<string, State[]>; } export declare enum Color { Dark = "dark", Light = "light", Gray = "gray" } export declare enum Comparison { Equal = "eq", AtLeast = "ge", AtMost = "le" } export declare const COMPARISONS: readonly Comparison[]; export declare enum Wrapping { None = "none", Wrap = "wrap", WrapReverse = "wrap-reverse", ReflectReverse = "reflect-reverse" } export declare const WRAPPINGS: readonly Wrapping[]; export declare enum Direction { Up = "up", Down = "down", Left = "left", Right = "right" } export declare const DIRECTIONS: readonly Direction[]; export type DirectionMap<T> = { [key in Direction]: T; }; export type DirectionToggle = Readonly<DirectionMap<boolean>>; export declare function directionToggle(...directions: readonly Direction[]): { up: boolean; down: boolean; left: boolean; right: boolean; }; export declare enum Orientation { Up = "up", UpRight = "up-right", Right = "right", DownRight = "down-right", Down = "down", DownLeft = "down-left", Left = "left", UpLeft = "up-left" } export declare const ORIENTATIONS: readonly Orientation[]; export type OrientationMap<T> = { [key in Orientation]: T; }; export type OrientationToggle = Readonly<OrientationMap<boolean>>; export declare function orientationToggle(...orientations: readonly Orientation[]): { up: boolean; 'up-right': boolean; right: boolean; 'down-right': boolean; down: boolean; 'down-left': boolean; left: boolean; 'up-left': boolean; }; export declare enum Mode { Create = "create", Solve = "solve", Perfection = "perfection" }