You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jul 8, 2023. It is now read-only.
Bot was tested with Python 3.6+ and PyPy3, we are not supporting Python 2.
4
4
5
5
# What do we have here?
6
6
@@ -14,124 +14,42 @@ You can find it here: https://github.com/MahjongRepository/mahjong
14
14
15
15
For research purposes we built a simple bot to play riichi mahjong on tenhou.net server.
16
16
17
-
### 0.4.0 version
17
+
Here you can read about bot played games statistic: [versions history](doc/versions.md)
18
18
19
-
Version with various improvements in hand building and melds calling.
20
-
21
-
This version had played ~1000 games (hanchans) and achieved fourth dan (四段) a couple of times.
22
-
23
-
Stable rank was a second dan (二段) and stable rate was ~R1600.
24
-
25
-
Stat:
26
-
27
-
|| Result |
28
-
| --- | --- |
29
-
| Average position | 2.53 |
30
-
| Win rate | 19.21% |
31
-
| Feed rate | 11.78% |
32
-
| Riichi rate | 18.48% |
33
-
| Call rate | 24.41% |
34
-
35
-
| Places ||
36
-
| --- | --- |
37
-
| First | 20.92% |
38
-
| Second | 27.46% |
39
-
| Third| 30.17% |
40
-
| Fourth | 21.45% |
41
-
| Bankruptcy | 6.19% |
42
-
43
-
The number of fourth places was decreased.
44
-
45
-
### 0.3.2 version
46
-
47
-
Version with various improvements.
48
-
49
-
This version had played 600 games (hanchans) and achieved fourth dan (四段) once.
50
-
51
-
Stable rank was a first dan (初段).
52
-
53
-
Stat:
54
-
55
-
|| Result |
56
-
| --- | --- |
57
-
| Average position | 2.53 |
58
-
| Win rate | 19.97% |
59
-
| Feed rate | 10.88% |
60
-
| Riichi rate | 15.80% |
61
-
| Call rate | 36.39% |
62
-
63
-
| Places ||
64
-
| --- | --- |
65
-
| First | 22.41% |
66
-
| Second | 25.52% |
67
-
| Third| 28.28% |
68
-
| Fourth | 23.79% |
69
-
| Bankruptcy | 4.48% |
70
-
71
-
### 0.2.5 version
72
-
73
-
This version is much smarter than 0.0.x versions. It can open hand, go to defence and build hand effective (all supported features you can find in releases description).
74
-
75
-
This version had played 375 games (hanchans) and achieved second dan (二段).
76
-
77
-
Rate was somewhere around R1500.
78
-
79
-
Stat:
80
-
81
-
|| Result |
82
-
| --- | --- |
83
-
| Average position | 2.65 |
84
-
| Win rate | 18.60% |
85
-
| Feed rate | 10.59% |
86
-
| Riichi rate | 15.64% |
87
-
| Call rate | 34.89% |
88
-
89
-
### 0.0.5 version
19
+
# For developers
90
20
91
-
It can reach a tempai and call a riichi. It doesn't know about dora, yaku, defence and etc.
92
-
Only about tempai and riichi so far.
21
+
## How to run it?
93
22
94
-
This version had played 335 games (hanchans) and achieved only first dan (初段) on the tenhou.net so far
95
-
(and lost it later, and achieved it again...).
23
+
1.`pip install -r requirements/lint.txt`
24
+
1. Run `cd project && python main.py`it will connect to the tenhou.net and will play a game.
96
25
97
-
Rate was somewhere around R1350.
26
+
## How to run bot battle with pypy
98
27
99
-
Stat:
28
+
To make it easier run bot vs bot battles we prepared PyPy3 Docker container.
100
29
101
-
|| Result |
102
-
| --- | --- |
103
-
| Average position | 2.78 |
104
-
| Win rate | 20.73% |
105
-
| Feed rate | 19.40% |
106
-
| Riichi rate | 36.17% |
107
-
| Call rate | 0% |
30
+
Run the game locally:
108
31
109
-
So, even with the current simple logic it can play and win.
1. Run `make GAMES=1 run_battle` it will play one game locally. Logs and replays will be stored in `bots_battle` folder.
110
35
111
-
# For developers
36
+
Run bots with enabled decision logger (use it only for debug, since it harms performance):
37
+
1. Run `make GAMES=1 ARGS=--logs run_battle`
112
38
113
-
## How to run it?
39
+
## Run multiple bots to play one game
114
40
115
-
1.`pip install -r requirements.txt`
116
-
2. Run `python main.py` it will connect to the tenhou.net and will play a game
41
+
1.[Install Docker](https://docs.docker.com/get-docker/) and [Install Docker Compose](https://docs.docker.com/compose/install/)
42
+
1. Run `make build_docker`
43
+
1. Put bot configs to `project/settings/`. By default we are looking for these configs: `bot_1_settings.py`, `bot_2_settings.py`, `bot_3_settings.py`, `bot_4_settings.py`, `bot_5_settings.py`. Why 5 settings? Because tenhou doesn't start 2+ game in the custom lobby if you are running only 4 bots.
44
+
1. Run `make run_on_tenhou`
117
45
118
46
## Configuration instructions
119
47
120
-
1. Put your own settings to the `project/settings_local.py` file.
121
-
They will override settings from default `settings.py` file
122
-
2. Also you can override some default settings with command argument.
123
-
Use `python main.py -h` to check all available commands
0 commit comments