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

shengxinyumaj

v1.1.23

Published

用于nodejs环境下的日本麻将点数、番数、符数、役种等计算

Downloads

19

Readme

线上

已开放线上工具,URL(Post):http://maj.lntusoft.com 推荐使用手机查看

微信小程序、QQ小程序搜索《日麻点数计算器》即可搜到对应小程序~ 如果有问题欢迎直接到小程序中反馈~ 我每天都会看哦-v-

日本麻将番符计算器

一个轻量级的,用于日麻的番数、符数、点数、向听数计算与何切判断的js库。

安装(Vue-CLI项目)

npm i shengxinyumaj

使用

引入

使用import方式引入:

import JapaneseMaj from "shengxinyumaj";

使用require方式引入:

const JapaneseMaj = require("shengxinyumaj").default;

浏览器直接引入(打包的文件在Release中),引入后可以直接使用JapaneseMaj对象:

<script src="/japanesemaj.min.js"></script>

配置相关

{
	changFeng = 1; // Number类型,东风场为1,南风场为2,西风场为3,北风场为4
	ziFeng = 1; // Number类型,自风,东1南2西3北4
	dora = []; //Array[Pai]类型,宝牌数组,注意这里是宝牌数组不是宝牌指示牌数组
	lidora = []; //Array[Pai]类型,里宝牌数组,注意这里是里宝牌数组不是里宝牌指示牌数组
	isLiangLiZhi = false; //是否两立直
	isLiZhi = false; //是否立直
	isYiFa = false; //是否一发
	isLingShang = false; //是否领上
	isZimo = false; //是否自摸 
	isLast = false; //是否是河底/海底
	isQiangGang = false; //是否是抢杠
	isTianHe = false; //是否是天和
	isDiHe = false; //是否是地和
}

判断和牌并计算番符

//计算22334455667788万的役种和番、符数。
var maj = new JapaneseMaj({
	dora: [JapaneseMaj.getPai("Wanzi",1)] //这里设置配置相关的参数
});
var paixing = JapaneseMaj.getPaixingFromString("22334455667788m"); //将字符串转换成牌型对象
var res = maj.getYakuCalculator(paixing); //获取役计算器
if(res) //如果没和牌会返回false
	console.log(res.calcYaku(maj.state)); //拿到役、番、符计算结果

计算向听数并得出何切

//计算1112222456778万的何切。
var maj = new JapaneseMaj({
	dora: [JapaneseMaj.getPai("Wanzi",1)] //这里设置配置相关的参数
});
var paixing = JapaneseMaj.getPaixingFromString("22334455667788m"); //将字符串转换成牌型对象
console.log(maj.calcXiangting(paixing)); //如果是待牌状态会返回待牌列表,如果是听牌状态会返回听牌列表。如果是待打牌状态会返回可切牌列表。

LICENSE

本库默认采用GPL2.0协议,如有特殊需要请在微信或QQ小程序中通过反馈联系我哦~