# agari

> Japanese riichi mahjong agari calculation

Latest version **1.1.0** (published 2020-12-24) · MIT license · 0 weekly downloads

## Install

```sh
npm install agari
pnpm add agari
yarn add agari
bun add agari
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2020-12-24 |
| First published | 2020-03-10 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 13.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 11 |
| Author | takayama |
| Maintainers | takayama |
| Keywords | riichi, mahjong, agari |

## Links

- npm: https://www.npmjs.com/package/agari
- Repository: https://github.com/takayama-lily/agari
- Homepage: https://github.com/takayama-lily/agari#readme
- Issues: https://github.com/takayama-lily/agari/issues
- npm.io page: https://npm.io/package/agari

## Recent versions

- 1.1.0 (latest) — 2020-12-24
- 1.0.2 — 2020-06-09
- 1.0.1 — 2020-05-30
- 1.0.0 — 2020-05-30
- 0.0.1 — 2020-03-13
- 0.0.0 — 2020-03-10

## README

# **Agari**

麻雀アガリ和了形計算  
Japanese riichi mahjong hand agari calculation  

**Install with npm:**

```shell
# npm i agari
```

**Use in browser:**

```html
<script src="https://cdn.jsdelivr.net/npm/agari"></script>
```

**Usage:**

```js
const agari = require('agari')
let hai = [
    [3,1,1,3,0,0,0,0,0], //萬子
    [3,0,0,0,0,0,0,0,0], //筒子
    [3,0,0,0,0,0,0,0,0], //索子
    [0,0,0,0,0,0,0]      //字牌
]
console.log(agari(hai))
```

Output:

```js
[
    //和了形1
    [
        '1m', //雀頭
        [ '1m', '2m', '3m' ], //順子
        [ '1p' ], //刻子
        [ '1s' ], //刻子
        [ '4m' ]  //刻子
    ],
    //和了形2
    [
        [ '1m' ], //刻子
        [ '1p' ], //刻子
        [ '1s' ], //刻子
        [ '2m', '3m', '4m' ], //順子
        '4m' //雀頭
    ]
]
```

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

**Check only:**

```js
const agari = require('agari')

//check 一般形
agari.check([
    [3,1,1,1,2,1,1,1,3],
    [0,0,0,0,0,0,0,0,0],
    [0,0,0,0,0,0,0,0,0],
    [0,0,0,0,0,0,0]
]) //return true

//check7 七対子形
agari.check7([
    [2,0,2,2,2,2,2,0,2],
    [0,0,0,0,0,0,0,0,0],
    [0,0,0,0,0,0,0,0,0],
    [0,0,0,0,0,0,0]
]) //return true

//check13 国士形
agari.check13([
    [1,0,0,0,0,0,0,0,1],
    [1,0,0,0,0,0,0,0,1],
    [1,0,0,0,0,0,0,0,1],
    [1,1,1,1,2,1,1]
]) //return true

//check all types
agari.checkAll([
    [1,1,1,1,1,0,0,0,0],
    [0,0,0,0,0,0,0,0,0],
    [0,0,0,0,0,0,0,0,0],
    [0,0,0,0,0,0,0]
]) //return boolean
```

---
_Source: https://npm.io/package/agari · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
