-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
24 changed files
with
398 additions
and
2,088 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,19 @@ | ||
# examples | ||
|
||
| プログラム | 機能 | ||
|:----------------|:----------------------------------------------------------- | ||
| validate.js | 牌譜の正当性チェック | ||
| summary.js | [基礎情報と和了役・流局理由集計](https://blog.kobalab.net/entry/20180113/1515776231) | ||
| search.js | 和了役と流局理由の検索 | ||
| diff.js | 2つの牌譜から差分を抽出する | ||
| diff-strict.js | 2つの牌譜から厳密に差分を抽出する | ||
| xiangting.js | [巡目ごとの向聴数・立直率・和了率](https://blog.kobalab.net/entry/20180118/1516202840) | ||
| dist_pai.js | [局終了時の牌の分布](https://blog.kobalab.net/entry/20180119/1516290844) | ||
| dist_hulepai.js | [和了牌の分布](https://blog.kobalab.net/entry/20180120/1516417938) | ||
| fulou.js | [巡目ごとの副露数・副露時向聴数](https://blog.kobalab.net/entry/20180203/1517667551) | ||
| hule_pattern.js | [リーチに対する待ちの形ごとの危険度](https://blog.kobalab.net/entry/2021/01/22/204805) | ||
| after_lizhi.js | [先制リーチを受けた局の結果と収支](https://blog.kobalab.net/entry/2020/12/21/202933) | ||
| trap_lizhi.js | [モロ引っ掛けの危険度](https://blog.kobalab.net/entry/2021/11/19/201332) | ||
| dist_lizhi.js | [リーチ宣言牌および最初に切った数牌と同種の牌の危険度](https://blog.kobalab.net/entry/2021/11/21/121835) | ||
| double_lizhi.js | [ダブルリーチの好形率・和了率・平均打点](https://blog.kobalab.net/entry/2022/03/19/124607) | ||
| プログラム | 機能 | ||
|:-------------------|:----------------------------------------------------------- | ||
| validate.js | 牌譜の正当性チェック | ||
| summary.js | [基礎情報と和了役・流局理由集計](https://blog.kobalab.net/entry/20180113/1515776231) | ||
| search.js | 和了役と流局理由の検索 | ||
| diff.js | 2つの牌譜から差分を抽出する | ||
| diff-strict.js | 2つの牌譜から厳密に差分を抽出する | ||
| xiangting.js | [巡目ごとの向聴数・立直率・和了率](https://blog.kobalab.net/entry/20180118/1516202840) | ||
| dist_pai.js | [局終了時の牌の分布](https://blog.kobalab.net/entry/20180119/1516290844) | ||
| dist_hulepai.js | [和了牌の分布](https://blog.kobalab.net/entry/20180120/1516417938) | ||
| fulou.js | [巡目ごとの副露数・副露時向聴数](https://blog.kobalab.net/entry/20180203/1517667551) | ||
| hule_pattern.js | [リーチに対する待ちの形ごとの危険度](https://blog.kobalab.net/entry/2021/01/22/204805) | ||
| after_lizhi.js | [先制リーチを受けた局の結果と収支](https://blog.kobalab.net/entry/2020/12/21/202933) | ||
| trap_lizhi.js | [モロ引っ掛けの危険度](https://blog.kobalab.net/entry/2021/11/19/201332) | ||
| dist_lizhi.js | [リーチ宣言牌および最初に切った数牌と同種の牌の危険度](https://blog.kobalab.net/entry/2021/11/21/121835) | ||
| double_lizhi.js | [ダブルリーチの好形率・和了率・平均打点](https://blog.kobalab.net/entry/2022/03/19/124607) | ||
| highest_records.js | [最高記録(最大局数、最長の手牌、最長の河など)](https://blog.kobalab.net/entry/2024/11/27/034233) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,57 +1,58 @@ | ||
/* | ||
* リーチ宣言牌および最初に切った数牌と同種の牌の危険度 | ||
*/ | ||
"use strict"; | ||
|
||
const Majiang = require('@kobalab/majiang-core'); | ||
|
||
class AnaLog extends require('../') { | ||
|
||
init() { | ||
this._result = { | ||
first: [], // 最初に打たれた数牌のまわり | ||
last: [], // リーチ宣言牌のまわり | ||
}; | ||
for (let n = 0; n < 9; n++) { | ||
this._result.first[n] = [0,0,0,0,0,0,0,0,0,0]; | ||
this._result.last[n] = [0,0,0,0,0,0,0,0,0,0]; | ||
} | ||
} | ||
qipai(qipai) { | ||
this._first = []; | ||
} | ||
dapai(dapai) { | ||
let s = dapai.p[0], n = +dapai.p[1]||5; | ||
if (! this._first[dapai.l] && s != 'z') this._first[dapai.l] = s+n; | ||
let r = this._result; | ||
if (dapai.p.substr(-1) == '*') { | ||
let tingpai = Majiang.Util.tingpai(this.board.shoupai[dapai.l]); | ||
/* リーチ宣言牌まわりの集計 */ | ||
if (s != 'z') { | ||
r.last[n-1][0]++; | ||
for (let i = 1; i <=9; i++) { | ||
if (tingpai.find(p=> p == s+i)) r.last[n-1][i]++; | ||
} | ||
} | ||
/* 最初に打たれた数牌まわりの集計 */ | ||
if (this._first[dapai.l]) { | ||
let s = this._first[dapai.l][0], n = +this._first[dapai.l][1]; | ||
r.first[n-1][0]++ | ||
for (let i = 1; i <=9; i++) { | ||
if (tingpai.find(p=> p == s+i)) r.first[n-1][i]++; | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
const yargs = require('yargs'); | ||
const argv = yargs | ||
.usage('Usage: $0 <log-dir>') | ||
.option('times', { alias: 't' }) | ||
.option('silent', { alias: 's', boolean: true }) | ||
.demandCommand(1) | ||
.argv; | ||
const filename = argv._[0]; | ||
|
||
console.log(AnaLog.analyze(filename, argv)._result); | ||
/* | ||
* リーチ宣言牌および最初に切った数牌と同種の牌の危険度 | ||
*/ | ||
"use strict"; | ||
|
||
const Majiang = require('@kobalab/majiang-core'); | ||
|
||
class AnaLog extends require('../') { | ||
|
||
init() { | ||
this._result = { | ||
first: [], // 最初に打たれた数牌のまわり | ||
last: [], // リーチ宣言牌のまわり | ||
}; | ||
for (let n = 0; n < 9; n++) { | ||
this._result.first[n] = [0,0,0,0,0,0,0,0,0,0]; | ||
this._result.last[n] = [0,0,0,0,0,0,0,0,0,0]; | ||
} | ||
} | ||
qipai(qipai) { | ||
this._first = []; | ||
} | ||
dapai(dapai) { | ||
let s = dapai.p[0], n = +dapai.p[1]||5; | ||
if (! this._first[dapai.l] && s != 'z') this._first[dapai.l] = s+n; | ||
let r = this._result; | ||
if (dapai.p.substr(-1) == '*') { | ||
let tingpai = Majiang.Util.tingpai(this.board.shoupai[dapai.l]); | ||
/* リーチ宣言牌まわりの集計 */ | ||
if (s != 'z') { | ||
r.last[n-1][0]++; | ||
for (let i = 1; i <=9; i++) { | ||
if (tingpai.find(p=> p == s+i)) r.last[n-1][i]++; | ||
} | ||
} | ||
/* 最初に打たれた数牌まわりの集計 */ | ||
if (this._first[dapai.l]) { | ||
let s = this._first[dapai.l][0], n = +this._first[dapai.l][1]; | ||
r.first[n-1][0]++ | ||
for (let i = 1; i <=9; i++) { | ||
if (tingpai.find(p=> p == s+i)) r.first[n-1][i]++; | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
const yargs = require('yargs'); | ||
const argv = yargs | ||
.usage('Usage: $0 <log-dir>...') | ||
.option('recursive', { alias: 'r', boolean: true }) | ||
.option('times', { alias: 't' }) | ||
.option('silent', { alias: 's', boolean: true }) | ||
.demandCommand(1) | ||
.argv; | ||
const filename = argv._; | ||
|
||
console.log(AnaLog.analyze(filename, argv)._result); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.