npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

koishi-plugin-clear-sudoku

v1.4.0

Published

清数插件 - 从数独图片中识别盘面并执行候选数清除与直观技巧求解

Downloads

2,920

Readme

koishi-plugin-clear-sudoku

数独候选数清除插件 — 引用盘面图片,发送清数指令,自动识别、清除候选数、推理出数并渲染发回。

功能

  • 大数识别:NCC 多字体模板匹配,手写优先(given/deduced 分类、蓝黑双色)
  • 候选数识别:像素聚类检测(9宫格位置扫描,gray<60 聚类确认,20% padding)
  • 候选数清除:按指令清除指定格子的候选数(兼容中英文括号)
  • 直观技巧求解:L1-L3 技巧链(显性/隐性唯余、区块排除(Pointing+Claiming)、数对/数组)
  • 题号水印:左下角红色数字+连字符,二次清数自动识别继承
  • 5 套核心模板:手写(big)、系统字体(digital)、Xsudoku(xsudoku)、候选(small)、水印(wm),每数字150-200样本
  • 渲染:77px 微软雅黑,可配置字号/字体

安装

cd external/clear-sudoku
npm install
npx tsc

依赖:koishi ^4.18.7, canvas 服务, pngjs, jpeg-js

使用方法

引用数独盘面图片,发送:

!清数 A59,B44
!清数 E5(23)      ← 兼容中文括号
!清数 A59 #421       ← 水印 421
!清数 A59 #82-4      ← 水印 82-4

| 指令 | 功能 | |------|------| | !双图 / !单图 | 切换双图/单图模式 | | !清数帮助 | 查看完整说明 |

架构

src/
├── index.ts            # 插件入口、命令注册、中间件
├── board.ts            # BoardState 盘面状态
├── ocr.ts              # OCR 管线(网格检测+大数匹配+候选像素检测+数独校验+两遍法字体选择)
├── template-match.ts   # NCC 模板匹配(5套核心模板、手写优先)
├── parser.ts           # 清数指令解析(兼容中英文括号、水印提取)
├── renderer.ts         # Canvas 渲染(77px、蓝黑双色、水印、子格线调试)
├── image.ts            # QQ 引用消息图片提取
├── solver-chain.ts     # L1-L3 直观技巧推理链
└── messages.ts         # 用户回复文案

模板体系(5 套核心)

| 类别 | 前缀 | 样本/数字 | 用途 | |------|------|----------|------| | 手写/大数字 | big | 150-200 | 其他软件生成的题目图 | | 候选 | small | 1 | 小数字备份 | | 系统字体 | digital | 179-200 | 微软雅黑自渲染闭环 | | Xsudoku | xsudoku | 1 mean | Xsudoku 软件截图 | | 水印 | wm | 1 | 16px 红色数字 |

模板扩充:node scripts/augment-all-templates.js

版本

| 版本 | 改动 | |------|------| | v1.3.2 | 模板瘦身(294MB→41MB):移除68字体族、三阶段样本扩充(150-200/数字) | | v1.3.1 | 二阶大数验证(24×36→48×72)、clean big_3/big_5(171/166样本)、H9 x/435修复 | | v1.3.0 | 候选数像素聚类检测(hasBlackPixel)、大数传递跳过候选格、68字体、两遍法字体选择、手写优先、Claiming求解 | | v1.2.0 | 27系统字体模板、自动发现加载、渲染77px、中文括号 | | v1.1.0 | 水印闭环、滑动窗口检测 | | v1.0.0 | 正式版:双模板校准、求解器冲突保护 |

License

MIT