UNPKG

@logic-pad/core

Version:
87 lines (86 loc) 2.23 kB
import { z } from 'zod'; import GridData from './grid.js'; export type PuzzleMetadata = { /** * The title of the puzzle. (required) */ title: string; /** * The author of the puzzle. (required) */ author: string; /** * A description of the puzzle. (can be empty) */ description: string; /** * A link to a place to discuss this puzzle. (can be empty) */ link: string; /** * The difficulty of the puzzle, from 0 to 10. (required) * * 0 represents an unrated puzzle, 6-10 represent star difficulties. */ difficulty: number; }; export declare const MetadataSchema: z.ZodObject<{ title: z.ZodString; author: z.ZodString; description: z.ZodString; link: z.ZodString; difficulty: z.ZodNumber; }, "strict", z.ZodTypeAny, { description: string; title: string; author: string; link: string; difficulty: number; }, { description: string; title: string; author: string; link: string; difficulty: number; }>; export declare const PuzzleSchema: z.ZodObject<{ title: z.ZodString; author: z.ZodString; description: z.ZodString; link: z.ZodString; difficulty: z.ZodNumber; grid: z.ZodType<GridData, z.ZodTypeDef, GridData>; solution: z.ZodNullable<z.ZodType<GridData, z.ZodTypeDef, GridData>>; }, "strict", z.ZodTypeAny, { description: string; grid: GridData; title: string; author: string; link: string; difficulty: number; solution: GridData | null; }, { description: string; grid: GridData; title: string; author: string; link: string; difficulty: number; solution: GridData | null; }>; export type Puzzle = PuzzleMetadata & { /** * The grid of the puzzle. (required) * * You must fix all given cells in the grid. The rest of the cells will be cleared. */ grid: GridData; /** * The solution to the puzzle. (optional) * * You should provide a solution if a rule requires it. Otherwise, the rule can never be satisfied. * * If there are no rules that require a solution, this field will be ignored. */ solution: GridData | null; };