Skip to content

Commit

Permalink
Merge branch 'release/v0.1.9'
Browse files Browse the repository at this point in the history
  • Loading branch information
kobalab committed Jan 2, 2022
2 parents f23a5d4 + e2cf01f commit 3ad69e7
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 5 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.9 / 2022-01-03

- Majiang.Shoupai
- 赤牌によるポンをチーと誤認して喰い替え判定しているバグを修正

### v0.1.8 / 2021-12-17

- Majiang.Util
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.8
* @kobalab/majiang-core v0.1.9
*
* Copyright(C) 2021 Satoshi Kobayashi
* Released under the MIT license
Expand Down
2 changes: 1 addition & 1 deletion lib/shoupai.js
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ module.exports = class Shoupai {
let s = m[0];
let n = + m.match(/\d(?=[\+\=\-])/) || 5;
deny[s+n] = true;
if (! m.match(/^[mpsz](\d)\1\1/)) {
if (! m.replace(/0/,'5').match(/^[mpsz](\d)\1\1/)) {
if (n < 7 && m.match(/^[mps]\d\-\d\d$/)) deny[s+(n+3)] = true;
if (3 < n && m.match(/^[mps]\d\d\d\-$/)) deny[s+(n-3)] = true;
}
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.8",
"version": "0.1.9",
"description": "麻雀基本ライブラリ",
"publishConfig": {
"access": "public"
Expand Down
4 changes: 4 additions & 0 deletions test/shoupai.js
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,10 @@ suite('Majiang.Shoupai', ()=>{
assert.deepEqual(Shoupai('m206p456s789z12,m345-,').get_dapai(),
['m6','p4','p5','p6','s7','s8','s9','z1','z2']);
});
test('赤牌によるポンの際に正しく喰い替え判定すること', ()=>{
assert.deepEqual(Shoupai('m25p1s12678,z666+,m550-,').get_dapai(),
['m2','p1','s1','s2','s6','s7','s8']);
});
test('喰替えのため打牌できない場合があること', ()=>{
assert.deepEqual(Shoupai('m14,p456-,s789-,z111+,m234-,')
.get_dapai(),
Expand Down

0 comments on commit 3ad69e7

Please sign in to comment.