[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-i18n-doc
Subject:    Re: More questions about translating kajongg
From:       "Frank Weng \(a.k.a. Franklin\)" <franklin () goodhorse ! idv ! tw>
Date:       2010-10-21 1:15:28
Message-ID: 201010210915.30872.franklin () goodhorse ! idv ! tw
[Download RAW message or body]


Thanks for your reply.  Now I'd like to discuss something about regular 
expressions. :p

在 週三 20 十月 2010 21:27:41,Wolfgang Rohdewald 寫道:
> On Mittwoch 20 Oktober 2010, Frank Weng (a.k.a. Franklin) wrote:
> > Here are some more questions about translating kajongg.
> > I researched the regular expressions for the rules, but
> > couldn't understand  some of them.
> > 
> > 1. Fourfold Plenty:
> > Its regular expression
> > is:  /((.\d\d\d){0,1}(.4\d\d)(.\d\d\d){0,1}){4,4} - - What
> > does "\d" mean?
> > 
> >   - I don't understand it.  Can you please give me an example
> > 
> > of that?
> 
> the english Kajongg documentation gives you a link:
> http://docs.python.org/library/re.html#regular-expression-syntax
> please search for \d on that page.
> 

According to this link:
http://www.dragonkong.com/classic-chinese-mahjong-hands.html

Fourfold Plenty means Four Kongs.  Is that true?

If yes, then according to the python regexp syntax page you provided, 
\d means [0-9], and hence (.\d\d\d){0,1} means

"any char, plus three digits, the whole group repeats 0 or 1 time".  Is that 
correct?

I don't understand how it is related to four kongs.

Also, what does "(.4\d\d)" mean?

*  *  *

Another question is about "Winding Snake".  Here is the code of predefined.py 
in trunk:

         self.winnerRules.append(Rule('Winding Snake',
                 r'I^(([sbc])1\2[1]\2[1] \2[2]\2[2] 
\2[3]\2[4]\2[5]\2[6]\2[7]\2[8] \2[9]\2[9]\2[9] [fy/])' \
                 r'|^(([sbc])1\4[1]\4[1] \4[2]\4[3]\4[4] 
\4[5]\4[5]\4[6]\4[7]\4[8] \4[9]\4[9]\4[9] [fy/])' \
                 r'|^(([sbc])1\6[1]\6[1] \6[2]\6[3]\6[4] 
\6[5]\6[6]\6[7]\6[8]\6[8] \6[9]\6[9]\6[9] [fy/])',
                 limits=1,
                 description=m18n('All tiles of same color. Pung or Kong of 1 
and 9, pair of 2, 5 or 8 and two '
                 'Chows of the remaining values')))

I don't understand what "1\2[1]\2[1] \2" mean.  According to the python regexp 
syntax page, "\number" means "Matches the contents of the group of the same 
number. Groups are numbered starting from 1. For example, (.+) \1 matches 'the 
the' or '55 55', but not 'the end' (note the space after the group). "  But I 
can't explain the above regexp.  \4, \6 means to match the contents of the 
group four and six more times?

Also, the description of it, "All tiles of same color.  Pung or Kong of 1 and 
9, pare of 2,5,8 and two chows of the remaining values".  I can't match it 
with the regexp, also I can't understand the tiles:

111225588999  then two more chows?

In the page I provided there is a "The Wriggling Snake" but it is totally 
different then the "Winding Snake" here.  Could you please explain it more?


Thanks,
Franklin

["signature.asc" (application/pgp-signature)]

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic