⚠️ Currently Mjx build is broken. Also, Mjx API will change in the near future.
Mjx is a Japanese Mahjong (riichi Mahjong) simulator. Mjx works as a game server as Mjai, a popular Mahjong simulator, to evaluate Mahjong AIs but have additional features:
$ pip install mjx
Requirements. Mjx supports Python3.7
or later in Linux
and macOS Intel
(10.15 or later). Currently Windows
and macOS Apple Silicon
are NOT supported. Contributions for supporting Windows
and macOS Apple Silicon
are more than welcome!
import mjx
from mjx.agents import RandomAgent
agent = RandomAgent()
env = mjx.MjxEnv()
obs_dict = env.reset()
while not env.done():
actions = {player_id: agent.act(obs)
for player_id, obs in obs_dict.items()}
obs_dict = env.step(actions)
returns = env.rewards()
Server | Client |
---|---|
|
|
This sever usage uses gRPC. Thus, actually any programming language is available to develop your own Mahjong AI. For Python, we provide a convinent wrapper mjx.Agent.serve()
.
Mjx is still under active development. APIs might change without notice before v1.0. Especially,
env.rewards(reward_type)
and env.done(done_type)
Observation.to_features()
)We recommend you to develop Mjx inside a container. Easiest way is open this repository from VsCode. Feel free to mention to @sotetsuk if you have any questions.
@INPROCEEDINGS{mjx2022,
author={Koyamada, Sotetsu and Habara, Keigo and Goto, Nao and Okano, Shinri and Nishimori, Soichiro and Ishii, Shin},
booktitle={2022 IEEE Conference on Games (CoG)},
title={Mjx: A framework for Mahjong AI research},
year={2022},
volume={},
number={},
pages={504-507},
doi={10.1109/CoG51982.2022.9893712}}
MIT