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

okey-solver-ts

v0.3.0

Published

A TypeScript library for evaluating and finding the best arrangement of tiles for games like Rummikub and Okey 101.

Readme

npm version npm downloads CI TypeScript License PRs Welcome

📦 npm · 🌐 Live Demo · 📚 Docs · 🐛 Issues


A zero-dependency TypeScript library that solves tile arrangement problems for Okey and Rummikub (101) using a backtracking algorithm. Fully type-safe, modular, and optimized for performance.

✨ Features

| Feature | Description | |---|---| | 🧩 Backtracking Solver | Finds the globally optimal arrangement via depth-first search | | 🃏 Joker / Wildcard | Okey tile fills any missing position in a run or group | | 🔄 12-13-1 Circular Runs | Supports wrap-around sequences like 12 → 13 → 1 | | 👥 Going Double | findBestPairs() calculates max identical pairs for the "7 pairs" win condition | | 🎭 Sahte Okey | False Okey tile (color JOKER) is resolved to the real Okey's value automatically | | 📐 Type-safe | Full TypeScript types & IntelliSense with shipped .d.ts definitions |


📦 Installation

npm install okey-solver-ts

🚀 Quick Start

Basic Arrangement

import { SolverEngine, Tile } from 'okey-solver-ts';

const myTiles: Tile[] = [
    { id: 'r5', color: 'RED',    value: 5 },
    { id: 'r6', color: 'RED',    value: 6 },
    { id: 'r7', color: 'RED',    value: 7 },  // RED 5-6-7 → Seri
    { id: 'b5', color: 'BLUE',   value: 5 },
    { id: 'y5', color: 'YELLOW', value: 5 },  // RED+BLUE+YELLOW 5 → Per
    { id: 'bk3', color: 'BLACK', value: 3 },  // leftover
];

const result = SolverEngine.findBestArrangement(myTiles);

console.log(result.totalScore);      // 42
console.log(result.melds.length);    // 2
console.log(result.remainingTiles);  // [{ id: 'bk3', ... }]

For more options and examples, refer to the API Reference.


📊 Performance & Complexity

The solver uses a Backtracking Search to find the globally optimal arrangement.

  • Complexity: En el en kötü senaryoda (Worst Case) zaman karmaşıklığı üsteldir ($O(2^n)$). Jokerlerin (Wildcards) fazla olması durum uzayını genişletir.
  • Recommended Bounds: Standart Okey elinde (14 ila 22 taş) ve normal miktarda joker ile (0-4 adet) solver mikrosaniyeler içinde çalışır. Joker sayısı 5 ve üzerinde olduğunda üstel zaman karmaşıklığı arama süresini uzatabilir.

📖 Documentation & Guides

For details on architecture, rules, and APIs:


🛠 Development & Contributing

Please read the Contributing Guide to learn about fork workflow, building, and code styles.

npm run build   # Compile TypeScript → dist/
npm test        # Run Jest tests with coverage
npm run lint    # ESLint check
npm run format  # Prettier format

📄 License

This project is licensed under the Apache 2.0 License — see the LICENSE file for details.