Skip to content

Commit

Permalink
Merge branch 'release/v0.1.4'
Browse files Browse the repository at this point in the history
  • Loading branch information
kobalab committed Dec 12, 2021
2 parents 692740a + 37b1969 commit 8ef8d66
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 9 deletions.
5 changes: 5 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
### v0.1.4 / 2021-12-12

- Majiang.Shoupai
- 赤牌をツモったとき、get_dapai() が誤った値を返すバグを修正

### v0.1.3 / 2021-12-09

- Majiang.Shoupai
Expand Down
2 changes: 1 addition & 1 deletion lib/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* @kobalab/majiang-core v0.1.3
* @kobalab/majiang-core v0.1.4
*
* Copyright(C) 2021 Satoshi Kobayashi
* Released under the MIT license
Expand Down
4 changes: 3 additions & 1 deletion lib/shoupai.js
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,9 @@ module.exports = class Shoupai {
if (s+n == this._zimo && bingpai[n] == 1) continue;
if (s == 'z' || n != 5) dapai.push(s+n);
else {
if (bingpai[0] > 0) dapai.push(s+0);
if (bingpai[0] > 0
&& s+0 != this._zimo || bingpai[0] > 1)
dapai.push(s+0);
if (bingpai[0] < bingpai[5]) dapai.push(s+n);
}
}
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@kobalab/majiang-core",
"version": "0.1.3",
"version": "0.1.4",
"description": "麻雀基本ライブラリ",
"publishConfig": {
"access": "public"
Expand Down
16 changes: 12 additions & 4 deletions test/shoupai.js
Original file line number Diff line number Diff line change
Expand Up @@ -552,14 +552,22 @@ suite('Majiang.Shoupai', ()=>{
test('リーチ後はツモ切りしかできないこと', ()=>
assert.deepEqual(Shoupai('m123p456s789z1234m1*').get_dapai(),
['m1_']));
test('赤牌を単独の牌として区別すること', ()=>
test('赤牌を単独の牌として区別すること', ()=>{
assert.deepEqual(Shoupai('m123p405s789z11123').get_dapai(),
['m1','m2','m3','p4','p0','p5','s7','s8','s9',
'z1','z2','z3_']));
test('手出しとツモ切りを区別すること', ()=>
'z1','z2','z3_']);
assert.deepEqual(Shoupai('m123p45s789z11123p0').get_dapai(),
['m1','m2','m3','p4','p5','s7','s8','s9',
'z1','z2','z3','p0_']);
});
test('手出しとツモ切りを区別すること', ()=>{
assert.deepEqual(Shoupai('m123p45s789z11123p5').get_dapai(),
['m1','m2','m3','p4','p5','s7','s8','s9',
'z1','z2','z3', 'p5_']));
'z1','z2','z3', 'p5_']);
assert.deepEqual(Shoupai('m123p405s789z1112p0').get_dapai(),
['m1','m2','m3','p4','p0','p5','s7','s8','s9',
'z1','z2','p0_']);
});
test('伏せ牌のみの手牌では空配列を返すこと', ()=>{
assert.deepEqual(Shoupai('______________').get_dapai(), []);
assert.deepEqual(Shoupai('___________,m123-,').get_dapai(), []);
Expand Down

0 comments on commit 8ef8d66

Please sign in to comment.