From aa89088d70738c30b6228270eb945db80a5c298a Mon Sep 17 00:00:00 2001 From: Satoshi Kobayashi Date: Thu, 16 Dec 2021 00:08:28 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=92=8C=E4=BA=86=E7=89=8C=E3=81=AE?= =?UTF-8?q?=E8=B5=A4=E7=89=8C=E3=82=92=E8=A6=8B=E9=80=83=E3=81=97=E3=81=A6?= =?UTF-8?q?=E3=82=82=E3=83=95=E3=83=AA=E3=83=86=E3=83=B3=E3=81=AB=E3=81=AA?= =?UTF-8?q?=E3=82=89=E3=81=AA=E3=81=84=E3=83=90=E3=82=B0=E3=82=92=E4=BF=AE?= =?UTF-8?q?=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/player.js | 3 ++- test/player.js | 8 ++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/player.js b/lib/player.js index 49011bf..9070741 100644 --- a/lib/player.js +++ b/lib/player.js @@ -80,7 +80,8 @@ module.exports = class Player { if (this.hulepai.find(p=> this.he.find(p))) this._neng_rong = false; } else { - if (this.hulepai.find(p=> p == dapai.p)) this._neng_rong = false; + let s = dapai.p[0], n = +dapai.p[1]||5; + if (this.hulepai.find(p=> p == s+n)) this._neng_rong = false; } } diff --git a/test/player.js b/test/player.js index d5d8f02..2b02f3d 100644 --- a/test/player.js +++ b/test/player.js @@ -107,8 +107,8 @@ suite('Majiang.Player', ()=>{ assert.ok(! player._diyizimo); }); test('自身の打牌に和了牌がある場合、フリテンとなること', ()=>{ - const player = init_player({shoupai:'m123p456s789z11222'}); - player.dapai({ l: 0, p: 'm1' }); + const player = init_player({shoupai:'m123p406s789z11222'}); + player.dapai({ l: 0, p: 'p0' }); assert.ok(! player._neng_rong); }); test('自身の打牌でフリテンが解除されること', ()=>{ @@ -124,8 +124,8 @@ suite('Majiang.Player', ()=>{ assert.ok(! player._neng_rong); }); test('和了牌を見逃した場合、フリテンとなること', ()=>{ - const player = init_player({shoupai:'m123p456s789z1122'}); - player.dapai({ l: 1, p: 'z1' }); + const player = init_player({shoupai:'m123p46s789z11122'}); + player.dapai({ l: 1, p: 'p0' }); assert.ok(! player._neng_rong); }); }); From 0618d5b3ac4575bbd896ecdb174b7cc3b5f153f9 Mon Sep 17 00:00:00 2001 From: Satoshi Kobayashi Date: Thu, 16 Dec 2021 00:11:15 +0800 Subject: [PATCH 2/2] v0.1.7 / 2021-12-16 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Majiang.Player - 和了牌の赤牌を見逃してもフリテンにならないバグを修正 --- ChangeLog.md | 5 +++++ lib/index.js | 2 +- package-lock.json | 4 ++-- package.json | 2 +- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/ChangeLog.md b/ChangeLog.md index 4c3420a..22d5139 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -1,3 +1,8 @@ +### v0.1.7 / 2021-12-16 + + - Majiang.Player + - 和了牌の赤牌を見逃してもフリテンにならないバグを修正 + ### v0.1.6 / 2021-12-15 - Majiang.Game diff --git a/lib/index.js b/lib/index.js index bacb83b..04ecbc1 100644 --- a/lib/index.js +++ b/lib/index.js @@ -1,5 +1,5 @@ /*! - * @kobalab/majiang-core v0.1.6 + * @kobalab/majiang-core v0.1.7 * * Copyright(C) 2021 Satoshi Kobayashi * Released under the MIT license diff --git a/package-lock.json b/package-lock.json index bf90a38..6ba1864 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@kobalab/majiang-core", - "version": "0.1.6", + "version": "0.1.7", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@kobalab/majiang-core", - "version": "0.1.6", + "version": "0.1.7", "license": "MIT", "devDependencies": { "mocha": "^9.1.3", diff --git a/package.json b/package.json index cf789e4..07706d4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@kobalab/majiang-core", - "version": "0.1.6", + "version": "0.1.7", "description": "麻雀基本ライブラリ", "publishConfig": { "access": "public"