Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/mthrok/tenhou-log-utils

Utility tools for tenhou.net log
https://github.com/mthrok/tenhou-log-utils

game mahjong tenhou

Last synced: 2 days ago
JSON representation

Utility tools for tenhou.net log

Awesome Lists containing this project

README

        

# ๐Ÿ€ Tenhou Log Command Line Utility ๐Ÿ€

## ๐Ÿ€ฆ What is this? / ใ“ใฎใƒชใƒใ‚ธใƒˆใƒชใซใคใ„ใฆ

Tenhou Log Utils is command line tools, written in Python, to analyze game log of online mahjong Tenhou.net.

ๅคฉ้ณณใƒญใ‚ฐใƒฆใƒผใƒ†ใ‚ฃใƒชใƒ†ใ‚ฃใฏใ‚ชใƒณใƒฉใ‚คใƒณ้บป้›€ใ‚ตใ‚คใƒˆ tenhou.net ใฎใ‚ฒใƒผใƒ ใƒญใ‚ฐใ‚’่งฃๆžใ™ใ‚‹ใŸใ‚ใฎใ‚ณใƒžใƒณใƒ‰ใƒฉใ‚คใƒณใƒ„ใƒผใƒซใงใ™ใ€‚

Tenhou Log Utils

ไปฅไธ‹ใฎใ“ใจใŒใงใใพใ™ใ€‚

- Pick up IDs of the games you played form Flash player cache.

ใƒญใƒผใ‚ซใƒซใƒ‡ใ‚ฃใ‚นใ‚ฏใซไฟๅญ˜ใ•ใ‚Œใฆใ„ใ‚‹ Flash Player ใฎใ‚ญใƒฃใƒƒใ‚ทใƒฅใ‹ใ‚‰ใ€ไปŠใพใงใซใƒ—ใƒฌใ‚คใ—ใŸๅ“ใฎใƒญใ‚ฐ ID ใ‚’ใƒชใ‚นใƒˆใ‚ขใƒƒใƒ—ใ€‚

- Download `mjlog` file from tenhou.net.

`mjlog` ๅฝขๅผใƒ•ใ‚กใ‚คใƒซใ‚’ใƒ€ใ‚ฆใƒณใƒญใƒผใƒ‰ใ€‚

- View `mjlog` file in console.

`mjlog` ๅฝขๅผใƒ•ใ‚กใ‚คใƒซใฎไธญ่บซใ‚’ใ‚ณใƒณใ‚ฝใƒผใƒซใซ่กจ็คบใ€‚

## ๐Ÿ€ง Usage / ไฝฟใ„ๆ–น

Once it's installed, you should be able to use command `tlu` (stands for Tenhou Log Utilities).
You can use `--help` to see how to use.

ใ‚คใƒณใ‚นใƒˆใƒผใƒซใŒๅฎŒไบ†ใ™ใ‚‹ใจใ€`tlu` ใ‚ณใƒžใƒณใƒ‰ (`T`enhou `L`og `U`tilities ใฎ็•ฅใงใ™ใ€‚) ใŒไฝฟใˆใ‚‹ใฏใšใงใ™ใ€‚
`--help` ใ‚ชใƒ—ใ‚ทใƒงใƒณใงไฝฟใ„ๆ–นใŒ่กจ็คบใ•ใ‚Œใพใ™ใ€‚๏ผˆ่‹ฑ่ชžใฎใฟ๏ผ‰

```bash
tlu --help
```

This will print message like the following.

ไปฅไธ‹ใฎใ‚ˆใ†ใชใƒกใƒƒใ‚ปใƒผใ‚ธใŒ่กจ็คบใ•ใ‚Œใพใ™ใ€‚

```
usage: tlu [-h] {view,list,download} ...

Utility for tenhou.net log files.

positional arguments:
{view,list,download}

optional arguments:
-h, --help show this help message and exit
```

### ๐Ÿ€‡ List up your game history. / ใ‚ฒใƒผใƒ ๅฑฅๆญดใ‚’่กจ็คบ

Using `list` sub command you can list up the information on your play history.

`list` ใ‚ตใƒ–ใ‚ณใƒžใƒณใƒ‰ใ‚’ไฝฟใ†ใจใƒญใƒผใ‚ซใƒซใƒ‡ใ‚ฃใ‚นใ‚ฏใซไฟๅญ˜ใ•ใ‚ŒใŸใ‚ฒใƒผใƒ ใฎๅฑฅๆญดใ‚’่กจ็คบใงใใพใ™ใ€‚

```bash
tlu list
```

```
/Users/moto/Library/Preferences/Macromedia/Flash Player/#SharedObjects/XRF2TRTU/mjv.jp/mjinfo.sol:
file: 2017060503gm-0041-0000-da7fdf26
un0: jesse
un1: ใŸใ‚๏ผฟ
un2: Yakkuru
un3: ใฟใตใ
oya: 2
type: 65
sc: 143,-26.0,606,71.0,346,15.0,-95,-60.0

/Users/moto/Library/Application Support/Google/Chrome/Default/Pepper Data/Shockwave Flash/WritableRoot/#SharedObjects/YSXJKZMQ/mjv.jp/mjinfo.sol:
file: 2017052413gm-0009-0000-2c57e05a
un0: jesse
un1: NoName
un2: toru.ysk
un3: ใ‚“ใปใŠใŠ
oya: 1
type: 9
sc: 340,14.0,131,-27.0,80,-42.0,449,55.0

...

```

You can use `--id-only` option to only show log IDs. You need these IDs to download play log from tenhou.net.

`--id-only` ใ‚ชใƒ—ใ‚ทใƒงใƒณใ‚’ไฝฟใ†ใ“ใจใง ID ใฎใฟใ‚’่กจ็คบใ™ใ‚‹ใ“ใจใŒใงใใพใ™ใ€‚ใ“ใ‚Œใ‚‰ใ‚’ไฝฟใฃใฆ tenhou.net ใ‹ใ‚‰ใ‚ฒใƒผใƒ ใฎใƒญใ‚ฐใ‚’ใƒ€ใ‚ฆใƒณใƒญใƒผใƒ‰ใ™ใ‚‹ใฎใซๅฟ…่ฆใซใชใ‚Šใพใ™ใ€‚

```bash
tlu list --id-only
```

```
2017060503gm-0041-0000-da7fdf26
2017052413gm-0009-0000-2c57e05a
2017052414gm-0009-0000-b0b25432
2017052514gm-0009-0000-df77ea6e
2017052514gm-0009-0000-e9f23937
2017052514gm-0009-0000-69a2af52
2017052515gm-0001-0000-42e80591
2017052612gm-0009-0000-815ed634
2017053113gm-0009-0000-6a4d36ba
2017053114gm-0009-0000-2294be5f
2017060213gm-0009-0000-a0c95a8f
2017060314gm-0009-0000-3b2aa4ca
2017060409gm-0001-0000-87fec10c
2017060409gm-0001-0000-f9ade363
2017060413gm-0009-0000-1508d27d
```

### ๐Ÿ€ˆ Download mjlog file / mjlog ใƒ•ใ‚กใ‚คใƒซใฎใƒ€ใ‚ฆใƒณใƒญใƒผใƒ‰

With `download` sub command, you can download play log (`mjlog` file). You need the log ID of the game you want to download.

`download` ใ‚ตใƒ–ใ‚ณใƒžใƒณใƒ‰ใ‚’ไฝฟใฃใฆใ‚ฒใƒผใƒ ใฎใƒ—ใƒฌใ‚คใƒญใ‚ฐ๏ผˆ`mjlog` ๅฝขๅผ๏ผ‰ใ‚’ใƒ€ใ‚ฆใƒณใƒญใƒผใƒ‰ใ™ใ‚‹ใ“ใจใŒใงใใพใ™ใ€‚ใƒ€ใ‚ฆใƒณใƒญใƒผใƒ‰ใ—ใŸใ„ใ‚ฒใƒผใƒ ใฎ ID ใŒๅฟ…่ฆใซใชใ‚Šใพใ™ใ€‚

Example)

The following command will download the play log with ID `2017060314gm-0009-0000-3b2aa4ca` to `2017060314gm-0009-0000-3b2aa4ca.mjlog` in the local storage.

ไปฅไธ‹ใฎใ‚ณใƒžใƒณใƒ‰ใฏ ID `2017060314gm-0009-0000-3b2aa4ca` ใฎใ‚ฒใƒผใƒ ใƒญใ‚ฐใ‚’ `2017060314gm-0009-0000-3b2aa4ca.mjlog` ใซใƒ€ใ‚ฆใƒณใƒญใƒผใƒ‰ใ—ใพใ™ใ€‚

```bash
tlu download 2017060314gm-0009-0000-3b2aa4ca 2017060314gm-0009-0000-3b2aa4ca.mjlog
```

### ๐Ÿ€‰ View downloaded mjlog file.

You can use `view` command to see the content of a `mjlog` file.

`view` ใ‚ณใƒžใƒณใƒ‰ใ‚’ไฝฟใฃใฆ `mjlog` ใƒ•ใ‚กใ‚คใƒซใฎไธญ่บซใ‚’่กจ็คบใงใใพใ™ใ€‚

```bash
tlu view 2017060314gm-0009-0000-3b2aa4ca.mjlog
```

```
Lobby 0:
test: False
red: True
kui: True
ton-nan: True
sanma: False
tokujou: False
soku: False
joukyu: False
Players:
Index: Dan, Rate, Sex, Name
0: 7, 1601.97, M, AlyBBBMe
1: 3, 1558.81, M, jesse
2: 0, 1484.34, M, ใ™ใฃใฝใ‚“3ๅท
3: 0, 1500.00, M, NoName
Dealer: 0
========================================
Initial Game State:
Round: 0
Combo: 0
Reach: 0
Dice 1: 3
Dice 2: 3
Dora Indicator: ๐Ÿ€… 0
Initial Scores:
0: 25000
1: 25000
2: 25000
3: 25000
Dealer: 0
Initial Hands:
0: ๐Ÿ€” 2 ๐Ÿ€— 2 ๐Ÿ€˜ 1 ๐Ÿ€œ 0 ๐Ÿ€ž 3 ๐Ÿ€ก 0 ๐Ÿ€Š 0 ๐Ÿ€Š 3 ๐Ÿ€Ž 3 ๐Ÿ€ 3 ๐Ÿ€€ 3 ๐Ÿ€ƒ 1 ๐Ÿ€ƒ 3
1: ๐Ÿ€’ 2 ๐Ÿ€’ 3 ๐Ÿ€– 3 ๐Ÿ€— 3 ๐Ÿ€ 2 ๐Ÿ€Ÿ 2 ๐Ÿ€Ÿ 3 ๐Ÿ€  3 ๐Ÿ€‹ 3 ๐Ÿ€Œ 1 ๐Ÿ€ 0 ๐Ÿ€€ 2 ๐Ÿ€† 3
2: ๐Ÿ€’ 0 ๐Ÿ€” 0 ๐Ÿ€” 3 ๐Ÿ€– 2 ๐Ÿ€— 1 ๐Ÿ€™ 1 ๐Ÿ€› 2 ๐Ÿ€œ 3 ๐Ÿ€  0 ๐Ÿ€Š 1 ๐Ÿ€‹ 0 ๐Ÿ€ 3 ๐Ÿ€‚ 1
3: ๐Ÿ€“ 3 ๐Ÿ€– 1 ๐Ÿ€™ 3 ๐Ÿ€š 1 ๐Ÿ€› 0 ๐Ÿ€› 3 ๐Ÿ€ˆ 1 ๐Ÿ€‹ 1 ๐Ÿ€Œ 0 ๐Ÿ€ 2 ๐Ÿ€Ž 2 ๐Ÿ€ 1 ๐Ÿ€† 1
Player 0: Draw ๐Ÿ€… 2
Player 0: Discard ๐Ÿ€… 2
Player 1: Draw ๐Ÿ€ 0

...

Player 3: ChanKan from player 1: ๐Ÿ€‚ 2๐Ÿ€‚ 1๐Ÿ€‚ 0๐Ÿ€‚ 3
Player 3: Draw ๐Ÿ€Œ 2
New Dora Indicator: ๐Ÿ€„ 1
Player 3: Discard ๐Ÿ€ 1
Player 0: Chi from player 3: ๐Ÿ€ 1๐Ÿ€Œ 3๐Ÿ€Ž 0
Player 0: Discard ๐Ÿ€‰ 3
Player 1: Draw ๐Ÿ€Œ 1
Player 1: Discard ๐Ÿ€Œ 1
Player 2: Draw ๐Ÿ€Œ 0
Player 2: Discard ๐Ÿ€Œ 0
Player 3: Chi from player 2: ๐Ÿ€Œ 0๐Ÿ€‹ 0๐Ÿ€ 0
Player 3: Discard ๐Ÿ€• 3
Player 0: Draw ๐Ÿ€ 3
Player 0: Discard ๐Ÿ€ 3
Player 1: Draw ๐Ÿ€œ 0
Player 1 wins.
Tsumo.
Hand: ๐Ÿ€™ 2 ๐Ÿ€™ 3 ๐Ÿ€š 2 ๐Ÿ€š 3 ๐Ÿ€› 2 ๐Ÿ€› 3 ๐Ÿ€œ 0 ๐Ÿ€ 1 ๐Ÿ€ž 3 ๐Ÿ€Ÿ 0 ๐Ÿ€Ÿ 1 ๐Ÿ€Ÿ 3 ๐Ÿ€  3 ๐Ÿ€ก 3
Machi: ๐Ÿ€œ 0
Dora Indicator: ๐Ÿ€‹ 1 ๐Ÿ€„ 1
Ura Dora: ๐Ÿ€“ 3 ๐Ÿ€ˆ 0
Yaku:
Reach ( 1): 1 [Han]
Tsumo ( 0): 1 [Han]
Pin-fu ( 7): 1 [Han]
Ii-pei-ko ( 9): 1 [Han]
Ikki-tsuukan (24): 2 [Han]
Chin-itsu (35): 6 [Han]
Ura-dora (53): 0 [Han]
Fu: 20
Score: 36000
- Sanbaiman
Ten-bou:
Combo: 0
Riichi: 1
Scores:
35700: -120
6800: 370
55700: -120
800: -120
Final scores:
23700: -16.0
43800: 53.0
43700: 24.0
-11200: -61.0

```

## ๐Ÿ€จ Installation / ใ‚คใƒณใ‚นใƒˆใƒผใƒซ

### ๐Ÿ€™ Normal Installation / ้€šๅธธใ‚คใƒณใ‚นใƒˆใƒผใƒซ

Use the following command to install TLU.

ไปฅไธ‹ใฎใ‚ณใƒžใƒณใƒ‰ใงใ‚คใƒณใ‚นใƒˆใƒผใƒซใงใใพใ™ใ€‚

```bash
pip install git+git://github.com/mthrok/tenhou-log-utils.git
```

### ๐Ÿ€š Development Installation / ้–‹็™บ็‰ˆใ‚คใƒณใ‚นใƒˆใƒผใƒซ

If you want to modify the command line, you can install in editable mode.

#### 1. Clone the repository / ใƒชใƒใ‚ธใƒˆใƒชใ‚’ใ‚ฏใƒญใƒผใƒณ

```bash
git clone http://github.com/mthrok/tenhou-log-utils
cd tenhou-log-utils
```

#### 2. Install with `-e` option. / `-e` ใ‚ชใƒ—ใ‚ทใƒงใƒณไป˜ใใงใ‚คใƒณใ‚นใƒˆใƒผใƒซ

```bash
pip install -e .
```

This will install the utility from the local repo, and you can change the behavior by modifying the content of `tenhou_log_utils` directory.

ใ“ใ‚Œใงใ‚ณใƒžใƒณใƒ‰ใŒใ‚ฏใƒญใƒผใƒณใ—ใŸใƒฌใƒใ‚ธใƒˆใƒชใ‚’ๅ‚็…งใ™ใ‚‹ใ‚ˆใ†ใซใ‚คใƒณใ‚นใƒˆใƒผใƒซใ•ใ‚Œใพใ™ใ€‚`tenhou_log_utils` ใฎไธญใฎใ‚นใ‚ฏใƒชใƒ—ใƒˆใ‚’็ทจ้›†ใ™ใ‚‹ใ“ใจใงใ€ใ‚ณใƒžใƒณใƒ‰ใฎๆŒ™ๅ‹•ใ‚’ๅค‰ๆ›ดใงใใพใ™ใ€‚

## ๐Ÿ€ฉ Bug Report / ใƒใ‚ฐใฎๅ ฑๅ‘Š

Please file a bug report at [issues page](https://github.com/mthrok/tenhou-log-utils/issues). Ideas and suggestions are also welcome.

ใƒใ‚ฐใ‚’็™บ่ฆ‹ใ—ใŸๅ ดๅˆใฏ [ใ“ใกใ‚‰](https://github.com/mthrok/tenhou-log-utils/issues)ใซๅ ฑๅ‘Šใ‚’ใŠ้ก˜ใ„ใ—ใพใ™ใ€‚ๆฉŸ่ƒฝๆ”นๅ–„่ฆๆœ›ใ‚‚ใฉใ†ใžใ€‚ๆ—ฅๆœฌ่ชžใงใŠkใ€‚