The language of all mahjong hands is regular by virtue of being finite. However, there are 3.70534329521 * 10^29 mahjong hands. There isn't enough storage space on Earth to store the corresponding regular expression.
If you can come up with a regex/NFA/whatever for a mahjong hand that isn't just a union of all strings, let me know, because it seems impossible. The limitation of no more than 4 copies of each tile makes something like

([1-9](m|p|s))|([1-7]z)

repeated 14 times not work, because it can't keep track of how many of each tile there are.
Follow

@miria I think some implementations let you use capturegroups in ranges like

(.)([^\1])

· · Web · 1 · 0 · 0
@applejack That still cannot count, and modern "regular" expressions are not regular since they can recognize non-regular languages.
Sign in to participate in the conversation
Game Liberty Mastodon

Mainly gaming/nerd instance for people who value free speech. Everyone is welcome.