Sudoku & Star Battle Puzzle Generator (unique, graded) avatar

Sudoku & Star Battle Puzzle Generator (unique, graded)

Pricing

from $20.00 / 1,000 puzzle generateds

Go to Apify Store
Sudoku & Star Battle Puzzle Generator (unique, graded)

Sudoku & Star Battle Puzzle Generator (unique, graded)

Generates original sudoku and Star Battle puzzles, each proven to have exactly one solution and graded easy to expert by the techniques a logic solver needs. JSON, optional SVG, printable worksheets, or a 6x9 / 8.5x11 paperback book interior PDF with answer key.

Pricing

from $20.00 / 1,000 puzzle generateds

Rating

0.0

(0)

Developer

Ars Technis

Ars Technis

Maintained by Community

Actor stats

0

Bookmarked

2

Total users

1

Monthly active users

3 days ago

Last modified

Share

Sudoku & Star Battle Puzzle Generator

Generate original logic puzzles on demand, with answer keys:

  • Sudoku: the classic 9x9 puzzle. Fill every row, column and 3x3 box with the digits 1 to 9.
  • Star Battle: place one crown (or star) in every row, every column and every outlined region, so that no two crowns touch, not even diagonally. Grids from 6x6 to 10x10.

Every puzzle this Actor returns is:

  • Proven unique. An exhaustive search confirms exactly one solution before the puzzle is delivered.
  • Solved by a fixed set of techniques. A human-style logic solver finishes every puzzle, and the hardest technique it needs sets the grade.
  • Graded by technique, not by counting clues:
    • Sudoku: easy needs only singles, medium pointing/claiming, hard pairs and triples, expert X-wing or swordfish. Sudoku never needs trial and error.
    • Star Battle: easy = singles and covers (a cell that sees every candidate of a row, column or region is ruled out), medium adds region/row counting sets, hard needs a counting set of three or more regions (or rows or columns), three or more counting steps in one puzzle, or one lookahead (most hard puzzles need no lookahead), expert needs two or more lookaheads (up to 18 in a test sample). A lookahead is a one-step trial: assume a crown, follow singles and covers, and rule the cell out if a row, column or region is left empty. Easy and medium Star Battle never need a lookahead, hard needs at most one, and expert uses two or more of these short trials.
  • Well-shaped Star Battle regions. Every region has at least 3 cells (so no region gives its crown away) and covers at most 28% of the grid, at every size and grade. Region numbers and letters are assigned at random, so they say nothing about where the crowns are.
  • Fresh. It is generated in your run, and puzzles never repeat within a run. Set a seed if you want the same puzzles again.

Who it is for

  • Newsletters, blogs and apps that want a daily logic puzzle without licensing fees
  • Teachers and activity-sheet makers who need printable logic puzzles with answer keys
  • Puzzle book creators who want a print-ready paperback interior (6x9 or 8.5x11 in) with graded puzzles and an answer key, to pair with their own cover
  • Worksheet creators who need graded content with solutions
  • Game developers who want a stream of verified levels as JSON
  • AI agents that need a puzzle, its solution and a picture of it in one call

What you get

One dataset item per puzzle.

Fields for every puzzle:

FieldMeaning
index, idPosition in the run, and a stable 12-character ID
typesudoku or star-battle
sizeGrid size N (sudoku is always 9)
difficultyeasy, medium, hard or expert
techniquesHow often the solver used each technique
solutionTextThe solution as strings (when includeSolution is on)
svg, solutionSvgReady-to-embed SVG images (only when svg is on; off by default)

Sudoku only:

FieldMeaning
grid9x9 array, 0 = empty cell
gridTextThe same as 9 strings, . = empty
cluesNumber of given digits
solutionThe full 9x9 solution

Star Battle only:

FieldMeaning
regionsN x N array of region numbers 0..N-1 (assigned at random; a number says nothing about the crown's row or column)
regionsTextThe same grid as strings, one letter per region (A, B, C, ...)
solution[row, column] of each crown
solutionText* = crown

With pdf on, the run also saves puzzles.pdf to its key-value store. The link is in the OUTPUT record as pdfUrl. Choose the layout with pdfLayout:

  • sheets (default): US Letter worksheets with a rules page, two large puzzles per page and all solutions at the back (the answer key; left out when includeSolution is off). Fonts are embedded (IBM Plex Sans), so a title in Latin, Greek or Cyrillic letters prints, symbols such as № included, and a long title wraps onto up to three lines.
  • book-6x9 or book-8.5x11: a paperback book interior:
    • a title page and a "How to play" page, then one puzzle per page with its number, size and difficulty, then the solutions (4 per page at 6x9, 6 per page at 8.5x11)
    • page numbers, grayscale, an even page count, and fonts embedded (IBM Plex Sans)
    • no bleed, with every mark inside the margins: the inside (gutter) margin follows the page-count table in KDP's paperback guidelines (0.375 in up to 150 pages, 0.5 in up to 300, and so on), and the top and outside margins are 0.5 in or more. The page numbers sit in the bottom margin, at least 0.35 in from the bottom edge (KDP asks for 0.25 in); the puzzles and text above them stay 0.5 in or more from it
    • OUTPUT.pdfPages gives the page count, which you need for your cover's spine width. KDP paperbacks need at least 24 pages, so ask for 20 puzzles or more with answer keys on (includeSolution), or 22 or more without them. The 500-puzzle maximum stays under KDP's limit of about 828 pages.
    • The cover is yours to make. You may sell books made from the puzzles you generate (see "Rights" below).

Sudoku example (shortened; a real output, seed 7, medium):

{
"index": 1,
"id": "6640c2d99dfa",
"type": "sudoku",
"size": 9,
"difficulty": "medium",
"clues": 30,
"gridText": [".......1.", "2..48...5", "5941.7...", "3162...5.", ".........", ".5...1923", "...5.6374", "7...43..2", ".4......."],
"solutionText": ["687352419", "231489765", "594167238", "316294857", "972835641", "458671923", "829516374", "765943182", "143728596"],
"uniqueSolution": true
}

Star Battle example (shortened; a real output, puzzleType star-battle, seed 7, size 6, easy):

{
"index": 1,
"id": "53430ec9f1e4",
"size": 6,
"difficulty": "easy",
"regionsText": ["AAACCC", "ADADEC", "ADDDEE", "BBFFFE", "BFFFFE", "BBBFFF"],
"solutionText": ["....*.", "*.....", "..*...", ".....*", "...*..", ".*...."],
"uniqueSolution": true
}

Input

FieldDefaultNotes
puzzleTypesudokusudoku or star-battle
count101 to 500 puzzles
sizes[8]Star Battle only: any of 6, 7, 8, 9, 10
difficulties["easy","medium","hard"]Any of easy, medium, hard, expert
includeSolutiontrue
svgfalseAdds SVG images to each item (about 2.5 to 12 KB each; measured: Star Battle 6x6 about 2.9 KB, 10x10 with crowns about 8.8 KB, sudoku solution about 11 KB)
palettecolorStar Battle SVG colours: color or grayscale
pdffalseAdds puzzles.pdf
pdfLayoutsheetssheets, book-6x9 or book-8.5x11 (see above)
titleSudoku Puzzles / Star Battle PuzzlesUp to 80 characters, printed on the PDF's first page (the title page in a book interior)
seedemptySame seed + same settings = same puzzles

Puzzles cycle through every combination of the sizes and difficulties you pick.

Pricing

You pay per delivered puzzle (see the pricing tab), once: the Actor charges one puzzle event per puzzle, and Apify's default per-dataset-item event is removed from the pricing, so you are not billed a second time for the same item. (If that default event were ever priced, the Actor would bill each puzzle through it alone and skip its own event.) Each puzzle has a limit of 90 seconds of CPU time; one that cannot be finished within it is skipped and not charged. The limit counts CPU time, not waiting time, so a low memory setting slows a run down but does not cause skips. If you set a maximum cost per run that covers fewer puzzles than you asked for, the Actor makes only as many as it covers, and the PDF holds all of them.

Speed (CPU time per puzzle, measured): sudoku easy to hard takes under a second and expert about 4 s on average (at most about 10 s). Star Battle up to 8x8 takes well under a second; 9x9 and 10x10 take about 0.5 to 2.5 seconds on average, and 10x10 expert about 2 to 5 s (at most about 18 s seen), far below the 90 s limit. More memory gives more CPU and faster runs.

Rules (for your readers)

Sudoku: fill every row, every column and every 3x3 box with the digits 1 to 9, each exactly once.

Star Battle:

  1. Place one crown in every row, every column and every outlined region.
  2. Two crowns may never touch, not even diagonally.

Tip for solvers: mark every cell that cannot hold a crown with a dot. When you place a crown, dot its row, its column, its region and the eight cells around it.

Rights

The puzzles are generated in your run by this Actor's own code. You may use, print, publish and sell the puzzles you generate, including in commercial products. There is no attribution requirement.

How it works

Sudoku: a random full grid is drawn first. Clues are removed in symmetric pairs while the solution stays unique and the grade stays within the level you asked for.

Star Battle: a random crown placement is drawn first. Regions are grown around it (each to at least 3 cells, none past 28% of the grid) and then repaired cell by cell, within the same limits, until the intended placement is the only solution. To reach a wanted grade, single border cells are then moved between regions, keeping each move only if the puzzle stays unique, logic-solvable and within the region limits. A human-style logic solver then solves the puzzle, and the hardest technique it needs sets the grade. Before delivery each puzzle is checked again, independently, including its region shapes. The Actor is plain Python code; it calls no AI model and no external service.