|
1 | | -## Round reproducer |
| 1 | +# Game reproducer |
2 | 2 |
|
3 | 3 | We built the way to reproduce already played round. |
4 | | -This is really helpful when you want to reproduce table state and fix bot bad behaviour. |
| 4 | + |
| 5 | +This is really helpful when you want to reproduce table state and fix bot incorrect behaviour. |
5 | 6 |
|
6 | 7 | There are two options to do it. |
7 | 8 |
|
8 | | -### Reproduce from tenhou log link |
| 9 | +## Getting game meta information |
9 | 10 |
|
10 | | -First you need to do dry run of the reproducer with command: |
| 11 | +It will be easier to find the round number to reproduce if you check the game meta-information first: |
11 | 12 |
|
| 13 | +Command: |
| 14 | +```bash |
| 15 | +python reproducer.py --log 2020102008gm-0001-7994-9438a8f4 --meta |
12 | 16 | ``` |
13 | | -python reproducer.py -o "http://tenhou.net/0/?log=2017041516gm-0089-0000-23b4752d&tw=3&ts=2" -d |
14 | | -``` |
15 | | - |
16 | | -It will print all available tags in the round. For example we want to stop before |
17 | | -discard tile to other player ron, in given example we had to chose `<W59/>` tag as a stop tag. |
18 | 17 |
|
19 | | -Next command will be: |
20 | | - |
21 | | -``` |
22 | | -python reproducer.py -o "http://tenhou.net/0/?log=2017041516gm-0089-0000-23b4752d&tw=3&ts=2" -t "<W59/>" |
| 18 | +Output: |
| 19 | +```json |
| 20 | +{ |
| 21 | + "players": [ |
| 22 | + { |
| 23 | + "seat": 0, |
| 24 | + "name": "Wanjirou", |
| 25 | + "rank": "新人" |
| 26 | + }, |
| 27 | + { |
| 28 | + "seat": 1, |
| 29 | + "name": "Kaavi", |
| 30 | + "rank": "新人" |
| 31 | + }, |
| 32 | + { |
| 33 | + "seat": 2, |
| 34 | + "name": "Xenia", |
| 35 | + "rank": "新人" |
| 36 | + }, |
| 37 | + { |
| 38 | + "seat": 3, |
| 39 | + "name": "Ichihime", |
| 40 | + "rank": "新人" |
| 41 | + } |
| 42 | + ], |
| 43 | + "game_rounds": [ |
| 44 | + { |
| 45 | + "wind": 0, |
| 46 | + "honba": 0, |
| 47 | + "round_start_scores": [ |
| 48 | + 250, |
| 49 | + 250, |
| 50 | + 250, |
| 51 | + 250 |
| 52 | + ] |
| 53 | + }, |
| 54 | + { |
| 55 | + "wind": 1, |
| 56 | + "honba": 1, |
| 57 | + "round_start_scores": [ |
| 58 | + 235, |
| 59 | + 235, |
| 60 | + 265, |
| 61 | + 265 |
| 62 | + ] |
| 63 | + }, |
| 64 | + { |
| 65 | + "wind": 1, |
| 66 | + "honba": 2, |
| 67 | + "round_start_scores": [ |
| 68 | + 221, |
| 69 | + 277, |
| 70 | + 251, |
| 71 | + 251 |
| 72 | + ] |
| 73 | + }, |
| 74 | + { |
| 75 | + "wind": 1, |
| 76 | + "honba": 3, |
| 77 | + "round_start_scores": [ |
| 78 | + 221, |
| 79 | + 298, |
| 80 | + 230, |
| 81 | + 251 |
| 82 | + ] |
| 83 | + }, |
| 84 | + { |
| 85 | + "wind": 2, |
| 86 | + "honba": 0, |
| 87 | + "round_start_scores": [ |
| 88 | + 320, |
| 89 | + 255, |
| 90 | + 197, |
| 91 | + 228 |
| 92 | + ] |
| 93 | + }, |
| 94 | + { |
| 95 | + "wind": 3, |
| 96 | + "honba": 0, |
| 97 | + "round_start_scores": [ |
| 98 | + 290, |
| 99 | + 215, |
| 100 | + 137, |
| 101 | + 358 |
| 102 | + ] |
| 103 | + } |
| 104 | + ] |
| 105 | +} |
23 | 106 | ``` |
24 | 107 |
|
25 | | -And output: |
| 108 | +From this information player seat and wind number could be useful for the next command run. |
26 | 109 |
|
27 | | -``` |
28 | | -Hand: 268m28p23456677s + 6p |
29 | | -Discard: 2m |
30 | | -``` |
| 110 | +## Running the reproducing for the game |
31 | 111 |
|
32 | | -After this you can debug bot decisions. |
| 112 | +To reproduce game situation you need to know: |
| 113 | +- log id |
| 114 | +- player seat number or player nickname |
| 115 | +- wind number (1-4 for east, 5-8 for south, 9-12 for west) |
| 116 | +- honba number |
| 117 | +- tile where to stop the game |
| 118 | +- action |
33 | 119 |
|
34 | | -### Reproduce from our log |
| 120 | +There are two supported actions for the reproducer: |
| 121 | +- `draw`. Sought tile will be added to the hand, then method `discard_tile()` will be called and after that reproducer will stop. |
| 122 | +- `enemy_discard`. After enemy discard method `try_to_call_meld()` will be called (if possible) and after that reproducer will stop. |
35 | 123 |
|
36 | | -Sometimes we had to debug `bot <-> server` communication. For this purpose we built this reproducer. |
37 | | - |
38 | | -Just use it with already played game: |
| 124 | +## Examples of usage |
39 | 125 |
|
| 126 | +```bash |
| 127 | +python reproducer.py --log 2020102008gm-0001-7994-9438a8f4 --player Wanjirou --wind 3 --honba 0 --tile 7p --action enemy_discard |
40 | 128 | ``` |
41 | | -python reproducer.py -l d6a5e_2017-04-13\ 09_54_01.log |
| 129 | + |
| 130 | +```bash |
| 131 | +python reproducer.py --log 2020102009gm-0001-7994-5e2f46c0 --player Kaavi --wind 3 --honba 1 --tile 5m --action draw |
42 | 132 | ``` |
43 | 133 |
|
44 | | -It will send to the bot all commands that were send from tenhou in real game. |
|
0 commit comments