@logic-pad/core
Version:
135 lines (134 loc) • 3.7 kB
JavaScript
/**
* Major rules are frequently referenced in grids to provide additional UI.
*/
export var MajorRule;
(function (MajorRule) {
MajorRule["MusicGrid"] = "music";
MajorRule["CompletePattern"] = "complete_pattern";
MajorRule["Underclued"] = "underclued";
MajorRule["WrapAround"] = "wrap_around";
})(MajorRule || (MajorRule = {}));
export var State;
(function (State) {
/**
* Describes the violation of a rule.
*/
State["Error"] = "error";
/**
* Describes that a rule is satisfied and complete in the current grid.
*/
State["Satisfied"] = "satisfied";
/**
* Describes that a rule is not violated, but is not yet complete in the current grid.
*/
State["Incomplete"] = "incomplete";
/**
* Describes that a rule is violated but ignored due to the effect of another rule.
*/
State["Ignored"] = "ignored";
})(State || (State = {}));
// eslint-disable-next-line @typescript-eslint/no-namespace
(function (State) {
function isSatisfied(state) {
return state === State.Satisfied || state === State.Ignored;
}
State.isSatisfied = isSatisfied;
})(State || (State = {}));
export var Color;
(function (Color) {
Color["Dark"] = "dark";
Color["Light"] = "light";
Color["Gray"] = "gray";
})(Color || (Color = {}));
export var Comparison;
(function (Comparison) {
Comparison["Equal"] = "eq";
Comparison["AtLeast"] = "ge";
Comparison["AtMost"] = "le";
})(Comparison || (Comparison = {}));
export const COMPARISONS = [
Comparison.Equal,
Comparison.AtLeast,
Comparison.AtMost,
];
export var Wrapping;
(function (Wrapping) {
Wrapping["None"] = "none";
Wrapping["Wrap"] = "wrap";
Wrapping["WrapReverse"] = "wrap-reverse";
Wrapping["ReflectReverse"] = "reflect-reverse";
})(Wrapping || (Wrapping = {}));
export const WRAPPINGS = [
Wrapping.None,
Wrapping.Wrap,
Wrapping.WrapReverse,
Wrapping.ReflectReverse,
];
export var Direction;
(function (Direction) {
Direction["Up"] = "up";
Direction["Down"] = "down";
Direction["Left"] = "left";
Direction["Right"] = "right";
})(Direction || (Direction = {}));
export const DIRECTIONS = [
Direction.Up,
Direction.Down,
Direction.Left,
Direction.Right,
];
export function directionToggle(...directions) {
const result = {
up: false,
down: false,
left: false,
right: false,
};
for (const direction of directions) {
result[direction] = true;
}
return result;
}
export var Orientation;
(function (Orientation) {
Orientation["Up"] = "up";
Orientation["UpRight"] = "up-right";
Orientation["Right"] = "right";
Orientation["DownRight"] = "down-right";
Orientation["Down"] = "down";
Orientation["DownLeft"] = "down-left";
Orientation["Left"] = "left";
Orientation["UpLeft"] = "up-left";
})(Orientation || (Orientation = {}));
export const ORIENTATIONS = [
Orientation.Up,
Orientation.UpRight,
Orientation.Right,
Orientation.DownRight,
Orientation.Down,
Orientation.DownLeft,
Orientation.Left,
Orientation.UpLeft,
];
export function orientationToggle(...orientations) {
const result = {
up: false,
'up-right': false,
right: false,
'down-right': false,
down: false,
'down-left': false,
left: false,
'up-left': false,
};
for (const orientation of orientations) {
result[orientation] = true;
}
return result;
}
export var Mode;
(function (Mode) {
Mode["Create"] = "create";
Mode["Solve"] = "solve";
Mode["Perfection"] = "perfection";
})(Mode || (Mode = {}));