/mjai-reviewer

🔍🀄️ Review mahjong game log with mjai-compatible mahjong AI.

Primary LanguageRustApache License 2.0Apache-2.0

mjai-reviewer

GitHub Workflow Status dependency status GitHub code size in bytes License

Review mahjong game log with mjai-compatible mahjong AI, supported engines are Mortal and akochan.

Try it online | Demo result page

It is recommended to just use the online version, which works for Mahjong Soul games out-of-the-box, no download, no install, no extension, and it is free to use.

mjai-reviewer 1.x.x is incompatible with 0.x.x versions, previously known as akochan-reviewer. If you prefer the old version, check out v0 branch.

Usage

$ # Review https://tenhou.net/0/?log=2019050417gm-0029-0000-4f2a8622&tw=2
$ # Note that you may need to quote it in the shell to escape the string
$ mjai-reviewer -e mortal -u "https://tenhou.net/0/?log=2019050417gm-0029-0000-4f2a8622&tw=2"

$ # Use akochan as engine
$ mjai-reviewer -e akochan -u "https://tenhou.net/0/?log=2019050417gm-0029-0000-4f2a8622&tw=2"

$ # Alternatively, you can specify the log ID and player ID manually
$ mjai-reviewer -e mortal -t 2019050417gm-0029-0000-4f2a8622 -a 2

$ # Review a local tenhou.net/6 format log file, note that you must specify a player ID
$ mjai-reviewer -e mortal -i log.json -a 3

$ # Review 東2局1本場 and 東3局 only
$ mjai-reviewer -e mortal -k E2.1,E3 -u "https://tenhou.net/0/?log=2019050417gm-0029-0000-4f2a8622&tw=2"

Use the --help argument for more details.

FAQ

See FAQ

Troubleshooting

(akochan) Assertion failed errors on Windows

Set environment variable OMP_NUM_THREADS=8.

Under cmd

> set OMP_NUM_THREADS=8

Under Powershell

> $env:OMP_NUM_THREADS = 8

Under MSYS2 bash

$ export OMP_NUM_THREADS=8

(akochan) libai.so not found on Linux

Try adding the directory of libai.so to env LD_LIBRARY_PATH.

Build

mjai-reviewer

Follow the instructions here to install Rust toolchains first, if you haven't yet.

$ cd ..
$ git clone https://github.com/Equim-chan/mjai-reviewer.git
$ cargo build --release

mjai-reviewer binary will be in target/release directory.

Engines

Mortal

See Mortal's documentation.

You also need a trained model file to actually use Mortal.

Akochan

$ git clone https://github.com/critter-mj/akochan.git
$ cd akochan

You have to edit Makefile and ai_src/Makfefile accordingly. Set up correct path for boost and some other options like -march=native of your choice.

On Windows MSYS2 with MinGW-w64 toolchain

$ pacman -Syu mingw-w64-x86_64-{toolchain,boost}

Edit Makefile:

LIBS = -lboost_system-mt -lws2_32 -L./ -lai -s

Edit ai_src/Makefile:

LIBS = -lboost_system-mt -lws2_32
$ cd ai_src
$ make
$ cd ..
$ make

On MacOS

$ brew install llvm libomp boost
$ cd ai_src
$ make -f Makefile_MacOS
$ cd ..
$ make -f Makefile_MacOS

On Arch Linux

$ sudo pacman -Syu base-devel boost
$ make -f Makefile_Linux
$ cd ..
$ make -f Makefile_Linux

Docker

Currently the docker image is not maintained and it only embeds akochan engine.

Build

$ git clone https://github.com/Equim-chan/mjai-reviewer.git
$ cd mjai-reviewer
$ git clone https://github.com/critter-mj/akochan.git
$ docker build -t mjai-reviewer:latest .

Usage

$ docker run --rm mjai-reviewer:latest -e akochan --no-open -t 2019050417gm-0029-0000-4f2a8622 -a 3 -o - > report.html
$ open report.html  # or just open in browser

License

Apache-2.0

Contributors

Contributors