From 00f540dc1cca08b4755962208e69fdbc12a23657 Mon Sep 17 00:00:00 2001 From: Satoshi Kobayashi Date: Thu, 24 Oct 2024 19:59:38 +0800 Subject: [PATCH 1/3] =?UTF-8?q?Majiang.Board=20=E3=81=8C=E9=85=8D=E7=89=8C?= =?UTF-8?q?=E3=81=AB=E3=83=89=E3=83=A9=E3=81=8C=E3=81=AA=E3=81=84=E3=83=BB?= =?UTF-8?q?=E3=83=89=E3=83=A9=E3=81=8C=E8=A4=87=E6=95=B0=E3=81=82=E3=82=8B?= =?UTF-8?q?=E5=A0=B4=E5=90=88=E3=82=92=E5=87=A6=E7=90=86=E3=81=A7=E3=81=8D?= =?UTF-8?q?=E3=82=8B=E3=82=88=E3=81=86=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/board.js | 2 +- test/board.js | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) 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/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)', ()=>{ From 6da9aae799cb3d074a3a61e85343f3a0e13c0985 Mon Sep 17 00:00:00 2001 From: Satoshi Kobayashi Date: Sun, 27 Oct 2024 15:45:21 +0800 Subject: [PATCH 2/3] =?UTF-8?q?README=E3=81=AE=E3=80=8CAPI=E4=BB=95?= =?UTF-8?q?=E6=A7=98=E3=80=8D=E3=82=92=E2=80=99=E7=9B=AE=E7=AB=8B=E3=81=A4?= =?UTF-8?q?=E3=82=88=E3=81=86=E3=81=AB=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 1 + 1 file changed, 1 insertion(+) 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) ## ライセンス From 003ccd1baf5e9095450b22cfaad9e18694934a8f Mon Sep 17 00:00:00 2001 From: Satoshi Kobayashi Date: Sun, 27 Oct 2024 15:49:44 +0800 Subject: [PATCH 3/3] v1.3.1 / 2024-10-27 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Majiang.Board が配牌にドラがない・ドラが複数ある場合を処理できるよう修正 --- ChangeLog.md | 4 ++++ lib/index.js | 2 +- package-lock.json | 4 ++-- package.json | 2 +- 4 files changed, 8 insertions(+), 4 deletions(-) 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/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"