Skip to content

Apricot-S/mjai-manue-go

Repository files navigation

mjai-manue-go

Ask DeepWiki

Go port of mjai-manue — a Mahjong AI for the Mjai Mahjong AI match server

Sample game record of a self-match

Differences from Original

Protocol Support Extensions

Architecture Improvements

  • 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.

Target Version

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.

How It Works

(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.

Prerequisites

This project (including all tools under tools/) requires:

  • Go 1.25 or later
  • Environment variable GOEXPERIMENT=jsonv2 enabled when building, installing or running with go run

Installation

go install github.com/Apricot-S/mjai-manue-go/cmd/mjai-manue@latest

Usage

For TCP/IP (e.g., mjai)

mjai-manue mjsonp://example.com:11600/default

For Standard I/O (e.g., mjai.app)

mjai-manue

For 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.json
  • configs/game_stats.json
  • configs/light_game_stats.json

See tools/ for instructions on how to generate these files.

Credits

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.

Licenses

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.json
  • configs/game_stats.json
  • configs/light_game_stats.json

These files are copyright Hiroshi Ichikawa and distributed under the New BSD License.

Packages

No packages published

Languages