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

@cloviz/eq-mc

v0.1.0

Published

Poker equity calculator using Monte Carlo simulation (WebAssembly)

Downloads

445

Readme

eq_mc (WASM)

ポーカーエクイティ計算ライブラリのWebAssembly版です。

インストール

npm install eq_mc

または、pkg/ディレクトリを直接コピーして使用できます。

使い方

ブラウザ (ES Modules)

import init, { calculate_combo_equity, calculate_range_equity } from './eq_mc.js';

// 初期化(必須)
await init();

// コンボ vs コンボ
const result1 = calculate_combo_equity("AsKs,QhQd", "Js,Ts,2c", 10000);
console.log(result1);  // "0.678432,0.321568"

// レンジ vs レンジ
const result2 = calculate_range_equity(
  "AsKs:1.0,AsKh:0.5|QhQd:1.0,QhQc:1.0",
  "Js,Ts,2c",
  10000
);
console.log(result2);  // "0.543210,0.456790"

TypeScript

型定義が自動生成されています(eq_mc.d.ts)。

import init, { calculate_combo_equity, calculate_range_equity } from './eq_mc.js';

await init();

const equities: string = calculate_combo_equity("AsKs,QhQd", "", 10000);
const parsed: number[] = equities.split(',').map(parseFloat);

API

calculate_combo_equity(combos, board, trials)

コンボ vs コンボのエクイティを計算します。

| 引数 | 型 | 説明 | |------|-----|------| | combos | string | カンマ区切りのコンボ (例: "AsKs,QhQd,JcJd") | | board | string | ボードカード (例: "Js,Ts,2c") または空文字列 | | trials | number | シミュレーション回数 |

戻り値: カンマ区切りのエクイティ文字列 (例: "0.35,0.40,0.25")

calculate_range_equity(ranges, board, trials)

レンジ vs レンジのエクイティを計算します。

| 引数 | 型 | 説明 | |------|-----|------| | ranges | string | パイプ区切りのレンジ (例: "AsKs:1.0,AsKh:0.5\|QhQd:1.0") | | board | string | ボードカード (例: "Js,Ts,2c") または空文字列 | | trials | number | シミュレーション回数 |

戻り値: カンマ区切りのエクイティ文字列 (例: "0.35,0.65")

フォーマット

カード表記

  • ランク: 2, 3, 4, 5, 6, 7, 8, 9, T, J, Q, K, A
  • スート: c (クラブ), d (ダイヤ), h (ハート), s (スペード)
  • 例: As (スペードのエース), Td (ダイヤの10)

コンボ表記

4文字のカード2枚: AsKs, QhQd, 7c6c

レンジ表記

コンボ:ウェイト 形式、カンマ区切り:

AsKs:1.0,AsKh:0.5,AhKs:0.5

複数プレイヤーはパイプ | で区切り:

AsKs:1.0,AsKh:1.0|QhQd:1.0,QhQc:1.0

ローカルでの動作確認

# eq_mcディレクトリで
python3 -m http.server 8080

# ブラウザで開く
# http://localhost:8080/example.html

ビルド

wasm-pack build --target web