No project description provided
Project description
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
Quick start
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
Server | Client |
---|---|
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
File details
Details for the file mjx-0.1.0.tar.gz
.
File metadata
- Download URL: mjx-0.1.0.tar.gz
- Upload date:
- Size: 355.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d20f66f8245ce093edb72dd23ec31f7a07c54ecb97040327db895692bffaae1d |
|
MD5 | 994a16361443bd3c836a702857e07ca2 |
|
BLAKE2b-256 | 824602410a5c43853f526bf41f5ee5bf8244d9dca88f9925ffdb8dab9ce86bbb |
File details
Details for the file mjx-0.1.0-cp39-cp39-manylinux2014_x86_64.whl
.
File metadata
- Download URL: mjx-0.1.0-cp39-cp39-manylinux2014_x86_64.whl
- Upload date:
- Size: 16.0 MB
- Tags: CPython 3.9
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7202fac52ac176c2921d9c6fd5706efda43e4c85dbc6322bbb5dc9b68efb73cd |
|
MD5 | 0c37c70e13db240c45c190f318128d95 |
|
BLAKE2b-256 | 298a57e3d0f8e3aea7c024171409990ebb495f2fda8f419d9b9ac8bcb2644cf5 |
File details
Details for the file mjx-0.1.0-cp39-cp39-manylinux2014_i686.whl
.
File metadata
- Download URL: mjx-0.1.0-cp39-cp39-manylinux2014_i686.whl
- Upload date:
- Size: 16.3 MB
- Tags: CPython 3.9
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1bbb58794571e556f947595ed9744eabf9bbe65c71cc474db5fed84b08c1dd9a |
|
MD5 | 133a19115d2d6882636e25af5e954a1f |
|
BLAKE2b-256 | 5f7356db1be6f9d8ce99392365ac94133b83a1b200d5ab68bc0641da677588a7 |
File details
Details for the file mjx-0.1.0-cp39-cp39-macosx_10_15_x86_64.whl
.
File metadata
- Download URL: mjx-0.1.0-cp39-cp39-macosx_10_15_x86_64.whl
- Upload date:
- Size: 13.0 MB
- Tags: CPython 3.9, macOS 10.15+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fd402a1ce4ddf4c339537280f4afe73f3ab4ca968bdb5d094b4794194c0d8529 |
|
MD5 | 48f5311f67d5c427e5013151dc996d20 |
|
BLAKE2b-256 | d01b58bc9fb9d99bda7c33cc3888f3985848929717dc140b1f47795ed73872fb |
File details
Details for the file mjx-0.1.0-cp38-cp38-manylinux2014_x86_64.whl
.
File metadata
- Download URL: mjx-0.1.0-cp38-cp38-manylinux2014_x86_64.whl
- Upload date:
- Size: 16.0 MB
- Tags: CPython 3.8
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 49d6212615a967c75a7708e57870108b9e100fa9ece40f2c3d25e4885e731721 |
|
MD5 | f7334a6f8092fa2a1fbc7ce5bf982d62 |
|
BLAKE2b-256 | 3d8ea37e4df1810bd81473dac78cf0ff5f6bbb7cc444a4e758b9b12e2df66c62 |
File details
Details for the file mjx-0.1.0-cp38-cp38-manylinux2014_i686.whl
.
File metadata
- Download URL: mjx-0.1.0-cp38-cp38-manylinux2014_i686.whl
- Upload date:
- Size: 16.3 MB
- Tags: CPython 3.8
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e032f7c4a6d9c43ae9b3fbb4ffd7a1f9949914543b705b140455adfc7bc1dbdf |
|
MD5 | 58e487233459bb87bb516c24a7d01f40 |
|
BLAKE2b-256 | fb47108a3fb8478d05024c691381d7f4313475e8b499a61e6792c5f063e99a7d |
File details
Details for the file mjx-0.1.0-cp38-cp38-macosx_10_15_x86_64.whl
.
File metadata
- Download URL: mjx-0.1.0-cp38-cp38-macosx_10_15_x86_64.whl
- Upload date:
- Size: 13.0 MB
- Tags: CPython 3.8, macOS 10.15+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a526158cd4b0a90e7712b6cc1c650d055dddb99c6d55c6a53b325a067bfc4b0d |
|
MD5 | 590d481d00617fd4eeb68034f8bb6b9a |
|
BLAKE2b-256 | 70ba9a1b785e243221c267fce98858df86da720158fc099cbd847e761544ed03 |
File details
Details for the file mjx-0.1.0-cp37-cp37m-manylinux2014_x86_64.whl
.
File metadata
- Download URL: mjx-0.1.0-cp37-cp37m-manylinux2014_x86_64.whl
- Upload date:
- Size: 16.0 MB
- Tags: CPython 3.7m
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3080ff0b3f852fbfca9be7b8c9ca73a7878bfba500e9fb5757db8d357aa17d8d |
|
MD5 | eb771e6a3126cc312146b8812d31196c |
|
BLAKE2b-256 | edd74ab923eaccc9605c316646092f084bd6ccfac409dfd3f5f2a50aed8c2591 |
File details
Details for the file mjx-0.1.0-cp37-cp37m-manylinux2014_i686.whl
.
File metadata
- Download URL: mjx-0.1.0-cp37-cp37m-manylinux2014_i686.whl
- Upload date:
- Size: 16.3 MB
- Tags: CPython 3.7m
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d5a2a5a192dcef297dc2f5374a43b7f589fc20c777e869407034c1c6223d47ff |
|
MD5 | 3b512b71ce8b17b9a43dca26725a962c |
|
BLAKE2b-256 | 54603295d04cd5cede1b830f568d926f852c29f7ee9bb53f6fe95e0dd991f781 |
File details
Details for the file mjx-0.1.0-cp37-cp37m-macosx_10_15_x86_64.whl
.
File metadata
- Download URL: mjx-0.1.0-cp37-cp37m-macosx_10_15_x86_64.whl
- Upload date:
- Size: 13.0 MB
- Tags: CPython 3.7m, macOS 10.15+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7a79bd8b2d9750bf56f56dc2c068b8a2a93ca129fd9cd5dbe1d72c316c369965 |
|
MD5 | 3487c42ad14295cb0a21769534663b67 |
|
BLAKE2b-256 | 7a80563744362708103ca4ba0a8ef22789adbe99eb85a14707bc22285e134eab |