Skip to content

kecel74/nonogram-generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Procedural Nonogram Level Generator

A Unity-based procedural content generation tool that converts pixel-art images into playable nonogram puzzles and evaluates whether the generated puzzles have a unique solution.

Project Overview

About the Project

This project was developed for the Artificial Intelligence in Games course in the Game and Interaction Technologies Master's Program at Istanbul Technical University.

The system converts a pixel-art image into a 30×30 binary grid, divides it into four 15×15 nonogram puzzles, automatically generates row and column clues, and evaluates each puzzle with a backtracking-based solver.

When a puzzle has multiple solutions, the system identifies ambiguous cells through a conflict map and applies limited local modifications to improve uniqueness while preserving the visual structure of the original image.

Key Features

  • Pixel-art image parsing and binary grid generation
  • Automatic conversion to a 30×30 nonogram structure
  • Division into four 15×15 puzzle sections
  • Automatic row and column clue generation
  • Backtracking-based solution validation
  • Early column pruning for faster search
  • Detection of zero, one, or multiple solutions
  • Conflict-map generation for ambiguous cells
  • Limited local edits for uniqueness improvement
  • Puzzle complexity estimation
  • Unity-based visual workflow

Workflow

Generation Workflow

  1. Select a pixel-art image.
  2. Resize and convert it into a 30×30 binary grid.
  3. Divide the grid into four 15×15 sections.
  4. Generate row and column clues.
  5. Evaluate each puzzle with the solver.
  6. Detect ambiguous cells when multiple solutions exist.
  7. Apply limited local improvements.
  8. Validate and display the final puzzle.

Unity Prototype

Unity Prototype

The Unity interface guides the user through image selection, grid generation, puzzle validation, ambiguity detection, improvement, and final clue display.

Conflict Detection and Improvement

Conflict Detection and Improvement

When multiple valid solutions are found, the system compares sampled solutions and marks cells that differ between them. These cells form a conflict map.

The improvement stage applies minimal local changes, such as connecting isolated black cells to nearby groups or removing ambiguous cells. The deformation budget is limited to preserve similarity to the original image.

Evaluation Results

Evaluation Results

The system was evaluated using 15 pixel-art images.

  • 14 images were successfully converted into uniquely solvable nonogram levels.
  • 1 image was rejected because achieving uniqueness exceeded the allowed deformation budget.
  • The maximum deformation among successful examples was 1.33%.

Detailed result files are available under:

Documentation/Results

System Architecture

System Architecture

Main components:

  • ImageParser.cs — loads the source image, performs resizing and thresholding, and creates the binary grid.
  • NonogramSolver.cs — generates candidates, performs backtracking search, and validates solution uniqueness.
  • NonogramWorkflowUI.cs — manages the interface and the complete generation workflow.

Technologies and Methods

  • Unity
  • C#
  • Procedural Content Generation
  • Constraint Satisfaction Problems
  • Backtracking Search
  • Early Constraint Pruning
  • Image Processing
  • Conflict Mapping
  • Local Search

Repository Structure

nonogram-generator/
├── Assets/
├── Documentation/
│   ├── Images/
│   ├── Paper/
│   └── Results/
├── Packages/
├── ProjectSettings/
├── .gitignore
└── README.md

How to Run

  1. Clone the repository:
git clone https://github.com/kecel74/nonogram-generator.git
  1. Open the project in Unity Hub.
  2. Use the Unity version defined by the project.
  3. Open the main scene under Assets/Scenes.
  4. Enter Play Mode.
  5. Select a pixel-art image and start the generation workflow.

Paper Manuscript

A conference paper manuscript based on this project is available under:

Documentation/Paper

Status: Prepared, not yet submitted.

The manuscript presents the generation pipeline, solver architecture, conflict detection method, local improvement process, and experimental evaluation.

Additional Images

The following screenshots are also available under Documentation/Images:

  • Image selection screen
  • Parsed 30×30 grid
  • Four generated puzzle sections
  • Final puzzle and clue screen
  • Source-grid example
  • Conflict map
  • Change map
  • Improved unique result

Limitations

  • Highly detailed source images may produce ambiguous puzzle structures.
  • Local modifications are restricted to preserve visual similarity.
  • Solver runtime increases when the candidate space becomes large.
  • The current implementation focuses on 30×30 grids divided into four 15×15 puzzles.

Future Work

  • Additional puzzle dimensions
  • Improved difficulty estimation
  • More advanced ambiguity-reduction strategies
  • Batch image processing
  • Solver performance comparisons
  • Standalone or web-based demo

Author

Kübra Ecel Yıldız

About

Unity-based procedural nonogram level generator with unique-solution validation and conflict-driven puzzle improvement.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages