diff --git a/ChangeLog.md b/ChangeLog.md index 131f914..f24129a 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -1,3 +1,7 @@ +### v1.3.1 / 2024-10-27 + + - Majiang.Board が配牌にドラがない・ドラが複数ある場合を処理できるよう修正 + ## v1.3.0 / 2024-10-19 - Majiang.Board にメソッド last() を追加 diff --git a/README.md b/README.md index c5ebb66..652bc32 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,7 @@ const Majiang = require('@kobalab/majiang-core'); | ``Majiang.Board`` | 卓情報を更新するクラス | | ``Majiang.Player`` | 対局者を実現する基底クラス | +## API仕様 - [API仕様](https://github.com/kobalab/majiang-core/wiki) ## ライセンス diff --git a/lib/board.js b/lib/board.js index ea0b86f..4ffb076 100644 --- a/lib/board.js +++ b/lib/board.js @@ -11,7 +11,7 @@ const Majiang = { class Shan { constructor(baopai) { this.paishu = 136 - 13 * 4 - 14; - this.baopai = [ baopai ]; + this.baopai = [].concat(baopai||[]); this.fubaopai; } zimo(p) { this.paishu--; return p || '_' } diff --git a/lib/index.js b/lib/index.js index ec498bf..2867f8d 100644 --- a/lib/index.js +++ b/lib/index.js @@ -1,5 +1,5 @@ /*! - * @kobalab/majiang-core v1.3.0 + * @kobalab/majiang-core v1.3.1 * * Copyright(C) 2021 Satoshi Kobayashi * Released under the MIT license diff --git a/package-lock.json b/package-lock.json index 473aa3f..303dda8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@kobalab/majiang-core", - "version": "1.3.0", + "version": "1.3.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@kobalab/majiang-core", - "version": "1.3.0", + "version": "1.3.1", "license": "MIT", "devDependencies": { "mocha": "^10.7.3", diff --git a/package.json b/package.json index 6d2d664..be409c2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@kobalab/majiang-core", - "version": "1.3.0", + "version": "1.3.1", "description": "麻雀基本ライブラリ", "publishConfig": { "access": "public" diff --git a/test/board.js b/test/board.js index c442ddc..488c0c6 100644 --- a/test/board.js +++ b/test/board.js @@ -101,6 +101,16 @@ suite('Majiang.Board', ()=>{ assert.equal(board.he.map(he=>he._pai.length) .reduce((x,y)=>x+y), 0)); test('手番が初期化されること', ()=> assert.equal(board.lunban, -1)); + test('ドラが未確定でも処理できること', ()=>{ + qipai.baopai = ''; + board.qipai(qipai); + assert.equal(board.shan.baopai.length, 0); + }); + test('ドラが複数でも処理できること', ()=>{ + qipai.baopai = ['s1','p9']; + board.qipai(qipai); + assert.deepEqual(board.shan.baopai, qipai.baopai); + }); }); suite('zimo(zimo)', ()=>{