riichi / chombot

Discord bot for Riichi Mahjong servers
MIT License
5 stars 0 forks source link

Simplify hand format parser #6

Closed Iipin closed 2 years ago

Iipin commented 5 years ago

Currently !hand command scans hand description from left to right, which complicates things a bit – tile suite is specified after a sequence of tiles, so we need to either remember tiles with unspecified suite (which is the current solution) or do a forward lookup first. Parsing from right to left should simplify the whole process.

m4tx commented 2 years ago

Currently in scope of https://github.com/m4tx/riichi-hand-rs project, closing the issue.

Also, having it done this way has one big advantage: you can find the first character in the description which causes an error - it would be impossible when parsing the hand right-to-left.