Go port of mjai-manue — a Mahjong AI for the Mjai Mahjong AI match server
Sample game record of a self-match
- In addition to Gimite's original Mjai protocol, also supports a minor modified version of the Mjai protocol used by RiichiLab.
- Embed configuration files at build time instead of loading them at runtime.
- Fixed an incorrect shanten number calculation when a hand contains four identical tiles.
- Log more detailed information about the game state.
- Improved error handling to more reliably reject invalid or anomalous input.
- Refactored the code for better readability and maintainability.
Note
The original project includes an older version written in Ruby and a newer version written in CoffeeScript. This project ports only the new version.
(TODO)
The discard that minimizes this avgRank is selected.
Decisions such as "whether to call or not" and "whether to declare Riichi or not" are also made in a similar method.
This project (including all tools under tools/) requires:
- Go 1.25 or later
- Environment variable
GOEXPERIMENT=jsonv2enabled when building, installing or running withgo run
go install github.com/Apricot-S/mjai-manue-go/cmd/mjai-manue@latestFor TCP/IP (e.g., mjai)
mjai-manue mjsonp://example.com:11600/defaultFor Standard I/O (e.g., mjai.app)
mjai-manueFor more information, see cmd/.
Note
In practice, mjai.app runs bot.py in the submission .zip file.
You need to call the above command from within bot.py and pipe the standard input and output.
Tip
See scripts/mjai.app/ for how to generate a submission file for mjai.app.
Tip
To customize the AI's strategic behavior, replace the following configuration files before building mjai-manue:
configs/danger_tree.all.jsonconfigs/game_stats.jsonconfigs/light_game_stats.json
See tools/ for instructions on how to generate these files.
This project is a Go port of mjai-manue, created by Hiroshi Ichikawa.
Some parts of the code are ported from mjai, created by Hiroshi Ichikawa.
This project is licensed under the New BSD License (3-Clause BSD License).
This project also contains configuration files copied from the original project:
configs/danger_tree.all.jsonconfigs/game_stats.jsonconfigs/light_game_stats.json
These files are copyright Hiroshi Ichikawa and distributed under the New BSD License.