Skip to main content

ci

mjx

Features

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:

  • Fast (100x faster than Mjai)
  • Exact Tenhou compatibility (Mjx is validated with numerous Tenhou game logs)
  • Gym-like API
  • Easy distributed computing (available for large-scale RL and evaluation thanks to gRPC)
  • Mjai compatible (mjx_mjai_translater)
  • Beautiful visualization

mjx

Quick start

Google colab

Install

$ 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!

Example

import mjx

agent = mjx.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()

Sever Usage

ServerClient
import random
import mjx

class RandomAgent(mjx.Agent):
  def __init__(self):
    super().__init__()

  # When you use neural network models
  # you may want to infer actions by batch
  def act_batch(self, observations):
    return [random.choice(obs.legal_actions()) 
            for obs in observations]


agent = RandomAgent()
# act_batch is called instead of act
agent.serve("127.0.0.1:8080", batch_size=8)
import mjx

host="127.0.0.1:8080"

mjx.run(
  {f"player_{i}": host for i in range(4)},
  num_games=1000,
  num_parallels=16
)

How to develop

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.

License

MIT

Metadata

Release files for mjx 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mjx 0.1.0
File Size Uploaded
mjx-0.1.0.tar.gz 355.0 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for mjx 0.1.0
File
mjx-0.1.0-cp39-cp39-manylinux2014_x86_64.whl CPython 3.9 CPython 3.9 Linux glibc 2.17+ x86-64 Details
mjx-0.1.0-cp39-cp39-manylinux2014_i686.whl CPython 3.9 CPython 3.9 Linux glibc 2.17+ x86-32 Details
mjx-0.1.0-cp39-cp39-macosx_10_15_x86_64.whl CPython 3.9 CPython 3.9 macOS 10.15+ x86-64 Details
mjx-0.1.0-cp38-cp38-manylinux2014_x86_64.whl CPython 3.8 CPython 3.8 Linux glibc 2.17+ x86-64 Details
mjx-0.1.0-cp38-cp38-manylinux2014_i686.whl CPython 3.8 CPython 3.8 Linux glibc 2.17+ x86-32 Details
mjx-0.1.0-cp38-cp38-macosx_10_15_x86_64.whl CPython 3.8 CPython 3.8 macOS 10.15+ x86-64 Details
mjx-0.1.0-cp37-cp37m-manylinux2014_x86_64.whl CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.17+ x86-64 Details
mjx-0.1.0-cp37-cp37m-manylinux2014_i686.whl CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.17+ x86-32 Details
mjx-0.1.0-cp37-cp37m-macosx_10_15_x86_64.whl CPython 3.7 CPython 3.7 pymalloc macOS 10.15+ x86-64 Details

Total release size: 136.3 MB

Release files / mjx-0.1.0.tar.gz

Download URL mjx-0.1.0.tar.gz
Size 355.0 kB
Tags Source
SHA-256 checksum
How to use checksums
d20f66f8245ce093edb72dd23ec31f7a07c54ecb97040327db895692bffaae1d
BLAKE2b-256 checksum
How to use checksums
824602410a5c43853f526bf41f5ee5bf8244d9dca88f9925ffdb8dab9ce86bbb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.13

Release files / mjx-0.1.0-cp39-cp39-manylinux2014_x86_64.whl

Download URL mjx-0.1.0-cp39-cp39-manylinux2014_x86_64.whl
Size 16.0 MB
Tags CPython 3.9 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
7202fac52ac176c2921d9c6fd5706efda43e4c85dbc6322bbb5dc9b68efb73cd
BLAKE2b-256 checksum
How to use checksums
298a57e3d0f8e3aea7c024171409990ebb495f2fda8f419d9b9ac8bcb2644cf5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.13

Release files / mjx-0.1.0-cp39-cp39-manylinux2014_i686.whl

Download URL mjx-0.1.0-cp39-cp39-manylinux2014_i686.whl
Size 16.3 MB
Tags CPython 3.9 Linux glibc 2.17+ x86-32
SHA-256 checksum
How to use checksums
1bbb58794571e556f947595ed9744eabf9bbe65c71cc474db5fed84b08c1dd9a
BLAKE2b-256 checksum
How to use checksums
5f7356db1be6f9d8ce99392365ac94133b83a1b200d5ab68bc0641da677588a7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.13

Release files / mjx-0.1.0-cp39-cp39-macosx_10_15_x86_64.whl

Download URL mjx-0.1.0-cp39-cp39-macosx_10_15_x86_64.whl
Size 13.0 MB
Tags CPython 3.9 macOS 10.15+ x86-64
SHA-256 checksum
How to use checksums
fd402a1ce4ddf4c339537280f4afe73f3ab4ca968bdb5d094b4794194c0d8529
BLAKE2b-256 checksum
How to use checksums
d01b58bc9fb9d99bda7c33cc3888f3985848929717dc140b1f47795ed73872fb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.13

Release files / mjx-0.1.0-cp38-cp38-manylinux2014_x86_64.whl

Download URL mjx-0.1.0-cp38-cp38-manylinux2014_x86_64.whl
Size 16.0 MB
Tags CPython 3.8 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
49d6212615a967c75a7708e57870108b9e100fa9ece40f2c3d25e4885e731721
BLAKE2b-256 checksum
How to use checksums
3d8ea37e4df1810bd81473dac78cf0ff5f6bbb7cc444a4e758b9b12e2df66c62
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.13

Release files / mjx-0.1.0-cp38-cp38-manylinux2014_i686.whl

Download URL mjx-0.1.0-cp38-cp38-manylinux2014_i686.whl
Size 16.3 MB
Tags CPython 3.8 Linux glibc 2.17+ x86-32
SHA-256 checksum
How to use checksums
e032f7c4a6d9c43ae9b3fbb4ffd7a1f9949914543b705b140455adfc7bc1dbdf
BLAKE2b-256 checksum
How to use checksums
fb47108a3fb8478d05024c691381d7f4313475e8b499a61e6792c5f063e99a7d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.13

Release files / mjx-0.1.0-cp38-cp38-macosx_10_15_x86_64.whl

Download URL mjx-0.1.0-cp38-cp38-macosx_10_15_x86_64.whl
Size 13.0 MB
Tags CPython 3.8 macOS 10.15+ x86-64
SHA-256 checksum
How to use checksums
a526158cd4b0a90e7712b6cc1c650d055dddb99c6d55c6a53b325a067bfc4b0d
BLAKE2b-256 checksum
How to use checksums
70ba9a1b785e243221c267fce98858df86da720158fc099cbd847e761544ed03
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.13

Release files / mjx-0.1.0-cp37-cp37m-manylinux2014_x86_64.whl

Download URL mjx-0.1.0-cp37-cp37m-manylinux2014_x86_64.whl
Size 16.0 MB
Tags CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
3080ff0b3f852fbfca9be7b8c9ca73a7878bfba500e9fb5757db8d357aa17d8d
BLAKE2b-256 checksum
How to use checksums
edd74ab923eaccc9605c316646092f084bd6ccfac409dfd3f5f2a50aed8c2591
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.13

Release files / mjx-0.1.0-cp37-cp37m-manylinux2014_i686.whl

Download URL mjx-0.1.0-cp37-cp37m-manylinux2014_i686.whl
Size 16.3 MB
Tags CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.17+ x86-32
SHA-256 checksum
How to use checksums
d5a2a5a192dcef297dc2f5374a43b7f589fc20c777e869407034c1c6223d47ff
BLAKE2b-256 checksum
How to use checksums
54603295d04cd5cede1b830f568d926f852c29f7ee9bb53f6fe95e0dd991f781
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.13

Release files / mjx-0.1.0-cp37-cp37m-macosx_10_15_x86_64.whl

Download URL mjx-0.1.0-cp37-cp37m-macosx_10_15_x86_64.whl
Size 13.0 MB
Tags CPython 3.7 CPython 3.7 pymalloc macOS 10.15+ x86-64
SHA-256 checksum
How to use checksums
7a79bd8b2d9750bf56f56dc2c068b8a2a93ca129fd9cd5dbe1d72c316c369965
BLAKE2b-256 checksum
How to use checksums
7a80563744362708103ca4ba0a8ef22789adbe99eb85a14707bc22285e134eab
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.13

Release history Release notifications | RSS feed

This release

0.1.0 This release

10 release files

0.0.11

3 release files

0.0.10

3 release files

0.0.9

10 release files

0.0.8

4 release files

0.0.7

4 release files

0.0.6

4 release files

0.0.5

4 release files

0.0.4

4 release files

0.0.3

4 release files

0.0.2

4 release files

0.0.1

5 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page