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 🙏

© 2024 – Pkg Stats / Ryan Hefner

puzuzu

v0.1.1

Published

puz parser and application

Downloads

9

Readme

Puzuzu

Puzuuuuuzuuuuuu

asciicast

CLI program

The primary deliverable of the Puzuzu project is currently a CLI program which allows the user to solve crossword puzzles with a TUI.

Usage

Installation

Packaged and delivered using npm, the node package manager.

npm i -g puzuzu

Running

puzuzu -f path/to/puz-file.puz
Controls

TODO: Make controls visible from inside the TUI

  • Typing will automatically advance the cursor to the next slot on the same row
  • Space bar to go from "across" clue to "down" clue
  • Backspace deletes the current square and moves back one
  • C-c or Esc to quit

Compatibility

This program has been tested on a small handful of files. The ./test_files directory is currently just cloned from puzpy, but only the washpost.puz test has been fairly thoroughly tested. Additionally, my brother (Zack Berman) contributed a mini (zack.puz) that has been thoroughly tested.

Known absent features include

  • Rebus
  • Pre-filled squares

Known bugs

  • The right panes don't highlight the active clues. The code seems to imply that it should, yet it doesn't. I'm fairly certain the active clues are properly kept because the lists jump around when you move to different clues on sufficiently large puzzles, but the styling is broken right now.
  • Spacing is "best effort", meaning sometimes the puzzle will appear way too small and sometimes it will be too large for your view to render with no recourse. This is primarily a limitation that comes from being a TUI, so porting this to ReactDOM would be a good next step for making a full featured puzuzu client.
  • All of the clues are noted with "⁰" rather than their actual number. While it seems possible to resolve this for clues 1-9, I haven't thought of a great way to solve it for clues with multiple digits, so I haven't really tried to resolve this.

Implementation

The UI has been built using the following technologies:

  • Node.js
    • Runtime for JavaScript
  • TypeScript
    • Preprocessor to add compile-time types to JavaScript
  • React.js
    • UI framework famous for web development but capable of hosting other types of UIs
  • react-blessed
    • An experimental backend for React that renders the React component tree to blessed

NPM Library

The library is a relatively thin wrapper around the wasm/Rust library. It's been tested using both node and webpack, though it has yet to be tested in the browser.

Example usage

import { Puzzle } from 'puzuzu';
import * as fs from 'fs';

async main() {
  const buffer = fs.readFileSync('./path/to/puzzle.puz');
  const puzzle = await Puzzle.fromPuz(buffer);

  const clues = puzzle.clues();
  // clues.across and clues.down are arrays of {
  //   clueNumber: number;
  //   text: string;
  //   row: number;
  //   column: number;
  //   length: number;
  // }
  console.log(clues.across);
  console.log(clues.down);
  // grid is a two dimensional array of { black: boolean, solution: string }
  const grid = puzzle.grid();
}

Rust Crate

While the Rust Crate currently primarily exists to support TypeScript usecase, it can be used standalone in either a wasm or Rust context.

The source code for the crate can be found in the ./rust directory.

TODO: More documentation for the Rust

Acknowledgements

  • I used @alexdej's puzpy as a reference implementation for much of the initial implementation and testing. I hope to eventually port all of the tests and functionality from

License

This project is licensed under either of

  • Apache License, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
  • MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)

at your option.