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

riichi

v1.2.0

Published

Japanese riichi mahjong hand calculation

Downloads

20

Readme

Riichi

麻雀飜符手役点数計算
Japanese riichi mahjong hand calculation

Install with npm:

$ npm i riichi

Usage

const Riichi = require('riichi')
const riichi = new Riichi('112233456789m11s')
console.log(riichi.calc())

Output:

{
  isAgari: true,
  yakuman: 0,
  yaku: { '一気通貫': '2飜', '一盃口': '1飜', '門前清自摸和': '1飜' },
  han: 4,
  fu: 30,
  ten: 7900,
  name: '',
  text: '(東場南家)自摸 30符4飜 7900点(3900,2000)',
  oya: [ 3900, 3900, 3900 ],
  ko: [ 3900, 2000, 2000 ],
  error: false
}

"m,p,s,z" means "萬子,筒子,索子,字牌"
"1z-7z" means "東南西北白發中" "0m" means "赤5萬"

自摸 & 栄和:

new Riichi('112233456789m1s1s') //自摸
new Riichi('112233456789m1s+1s') //栄和

副露:

new Riichi('1s+1s+123m55z666z7777z') //副露:123m順子 5z暗槓 6z明刻 7z明槓

Dora:

new Riichi('112233456789m1s1s+d12s') //Dora: 1s 2s

Extra Option:

new Riichi('1s+1s+123m55z666z7777z+d12s+trihk22') //Extra:trihk22

| Option | Meaning | | --- | --- | | t | 天和/地和/人和 | | r(l) | 立直 | | i(y) | 一発 | | w | w立直 | | h | 海底摸月/河底撈魚 | | k | 槍槓/嶺上開花 | | o | 全local役有効 | | 22 | 場風南自風南 |

場風自風:

1234=東南西北
default: 場風東自風南

new Riichi('112233456789m1s1s+1') //(場風東)自風東
new Riichi('112233456789m1s1s+21') //場風南自風東
new Riichi('112233456789m1s1s+24') //場風南自風北

local yaku list: | Name | 飜数 | | --- | --- | | 人和 | 役満x1 | | 大七星 | 役満x1 |

Api

use-before-calc()

const Riichi = require('riichi')
const riichi = new Riichi('112233456789m11s+o')

riichi.disableWyakuman() //2倍役満禁止
riichi.disableKuitan() //喰断禁止
riichi.disableAka() //赤dora禁止
riichi.enableLocalYaku('人和') //人和有効
riichi.disableYaku('大七星') //大七星禁止

let result = riichi.calc()

向聴数牌理計算 lib

console.log(new Riichi('111222333m11p123z').calc())

Output

{
  ...
  hairi: {
    now: 1, //現在向聴数
    '1m': {},
    '2m': {},
    '3m': {},
    '1p': {},
    '1z': { '1p': 2, '2z': 3, '3z': 3 }, //打1z 待1p二枚 2z三枚 3z三枚
    '2z': { '1p': 2, '1z': 3, '3z': 3 }, //打2z 待1p二枚 1z三枚 3z三枚
    '3z': { '1p': 2, '1z': 3, '2z': 3 }  //打3z 待1p二枚 1z三枚 2z三枚
  }
}