Ledenel/auto-white-reimu

Notes on learning how to contribute to this project

Opened this issue · 4 comments

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.

Thanks for your contribution!
I 've made these two tools work right now. Here's my planning:

  • 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(振听)).

And for contribution, a contribution guide is required (Maybe a issue template/pull request template, but I've no idea about how to do that).

I'll remain this issue open for discussion. Any crazy ideas are welcomed!

For

class Tile and TileSet use @total_ordering, according to official doc, should evaluate if it's the bottleneck of the performance.

I've benchmarked with cProfile and found that main bottle neck is about manipulate and create TileSet(Counter)s. the operator is mainly heavily used in sorting, so I think that le, eq and ne is enough.

For

check if collections.Counter could sorted by key internally when print, so we don't need TileSet.re_sort()

Counter(include normal dicts) after Python 3.7 is guaranteed that keys will preserved order of insertion. it's not the order we needed (if insert 3m first, 2s later, 1m last, the order will be 3m2s1m). so printing needs resort.

By the way, Interantionalized document is needed, but I've no idea of how to do that.

  • Add zh-CN and en-US documentation support.