ledenel / auto-white-reimu Goto Github PK
View Code? Open in Web Editor NEWa mahjong library aimed to implement mahjong AIs by imitating white reimu -- a excellent mahjong player.
License: GNU General Public License v3.0
a mahjong library aimed to implement mahjong AIs by imitating white reimu -- a excellent mahjong player.
License: GNU General Public License v3.0
Now the demo 1(Monte Carlo estimation) do accept 0m, 0p, 0s as input, but not treated as aka 5m, aka 5p, aka 5s. Instead it is a tile with number zero, which is weird and buggy.
(mentioned in Pull Request #5 )
maybe first fix it by add restriction and conversion to normal 5s/5m/5p in demo, then discuss the representation for aka 5m.
The current format of element 'event', which is like 'D70', 'U128'... , is quite hard to understand. It might be more readable if there is an explanation, namely 'deal 1s', 'discard 1s'.
Something like:
Given current score, game round, is oya, seat order, output ranking possibility like:
top: 6%
second: 30%
third: 60%
last: 4%
means that you may most probably get third ranking, and almost safe from being last, and has substantial chance to beat second player down, from given situations. Tenhou Pt estimation is also possible.
Since here we could get all possible combination for win:
assume each invisible tile is equal probability, we could leverage multinomial distribution for given a possible combination with r tiles in the invisible set:
like wikipedia explained,
we could directly get all possible combinition probability just simply sum the pmf of each combination
here.
TenhouEvent
now represent a event. due to issue #12 , we could add a method like to_uniform_paifu_record(self)
to TenhouEvent
,return a plain dict()
(dict-like) object to support easy pandas.Dataframe
creation.
Log: http://tenhou.net/0/?log=2019022817gm-0011-5574-e1a854ec&tw=1
The game log above contains three different players with the same ID 'NoName'. The script ought to provide three different reasoning reports corresponding to each of the players when running "check result for all players", but it misidentifies the first player three times and only provides one report instead. (actually it overwrites the same output file for three times)
Numbering the IDs or attach the seat order to the ID might be needed.
When parsing some files using from_file, an xml'Namespace' object has no attribute 'n0'
(sometimes n1) error occured:
Traceback (most recent call last):
File "<input>", line 1, in <module>
File "C:\Users\canuse\PycharmProjects\auto-white-reimu\mahjong\record\reader.py", line 187, in from_file
return TenhouRecord(next(ET.parse(file).iter()))
File "C:\Users\canuse\PycharmProjects\auto-white-reimu\mahjong\record\reader.py", line 140, in __init__
[meta.UN.n0, meta.UN.n1, meta.UN.n2, meta.UN.n3],
AttributeError: 'Namespace' object has no attribute 'n1'
A total of 18469 file was processed and this error occured 98 times ( with 'n0' 83 times and 'n1' 15 times)
For example,
2019010115gm-00a9-0000-21b95613.xml
raised an 'n1' error and 2019010202gm-00a9-0000-3142addc.xml
raised an 'n0' error
2019010115gm-00a9-0000-21b95613.zip
2019010202gm-00a9-0000-3142addc.zip
Here's TODOs collected from comments below:
Add class doc to give brief explanation, in order to make new developer easier to understand.
Tile._hash
and Tile._tuple_view
seems duplicated, check if should keep only one of them.
Add win pattern of Thirteen Orphans(国士無双)
Add input-check about the number of tiles, input grammar and same tile overflow.
Add matching for yaku(役) and score calculation
Add continus integration and cover all codes with unit test
Add documentation for Tile, TileSet Waiting WinPattern and merge duplicate search algorithms for easily read and use.
Add safe tiles calculations based on remain waiting forms counting(i.e. how many 68s, 56s, 89s, 7s could waiting for 7s without furiten(振听)).
Add zh-CN and en-US documentation support.
checked: TileSet.re_sort()
should be called to keep insert order invariant.
checked: class Tile
and TileSet
use @total_ordering
, according to official doc, should evaluate if it's the bottleneck of the performance.
Very useful and a good change to learn Python, thanks owner.
Now I'm reading the source code, here I wrote potential development.
For now, a hand with drawn tiles will be considered as win:
But for seven pair win pattern, it will over-estimated much more than normal type wining. Infering from 1), the model will assume that all tiles which will form a pair will be choosen to keep in hand, but it is really hard (nearly impossible) to predict which tile will eventually form a pair (it seems all the same). The prediction from player is not statically significant different from random guessing.
For comparasion, 23s has nearly 2 times chances than 13s to form a meld, so choosing is quite easy.
(i.e. 1155m123345p5566s, 6 draws, it will consider to discard 1/5p to expect seven-pair wining, which is not acceptable by most of the players.)
Function from_file(file)
in mahjong.record.reader.py
will cause a TypeError at mahjong.record.reader.py, line 117
when passing the filename into the function.
This issue collects all things about paifu analysis, including:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.