Mahjong Hu Pai algorithm series (1)

Source: Internet
Author: User

# Include <stdio. h>

Int Hu (INT Pai [38]);
Int remain (INT Pai [38]);

Int main ()
{
// ° N percent» ¸ ± å æ å â ã µ? ~~×öà ''' â {}° {{{~~~~~~~~~{{??
// ************** Pai [0], Pai [10], Pai [20], pai [30] ~~~~úö²» ó ~£%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
// Ö~~~=0 £ ¡
Int Pai [38] = {0,
1, 1, 0, 1, 1, 0, // Pai [1-9] *************************************
0,
0, 0, 0, 0, 0, 0
0,
0, 0, 0, 0, 0, 0, // Pai [21-29] Too many bytes faster
0,
0, 0, 0, 0, 0 // Pai [31-37] Then «ää î ÷ ± öð · ¢ ° × µäö öö ý
};
 
// Çademañeplus ± ø ~%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 201710000£ £ 000000000000000000000000²» ***********************************************
// If (qidui (PAI ))...
// If (shisanyao (PAI ))...
 
If (Hu (PAI ))
Printf ("Please have £;****************/N ");
Else
Printf ("° £ ");
 
Return 1;
}

// Adjust bandwidth ~è ý ç ¡± £%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
// °C °? à £;{%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Int Hu (INT Pai [38])
{
Static int Jiang = 0; // when «å æ ± ö ö£ ££ ¼ 'å æ í ° {° è ~~~~~~~~%%± öð ä¡ ° ¶ þ ¡±
 
If (! Remain (PAI) return 1; // µ ******************************************************* £.
 
For (INT I = 1 ;! Pai [I] & I <38; I ++ ); // zookeeper. zookeeper I have been chosen as the infrastructure Infrastructure infrastructure, and PAI [I] ç çoröö ö
 
Printf ("I = % d/N", I); // ¸ ú× ù å ï ¢
 
// 4 Gbit/s)
If (PAI [I] = 4) // %%%μ ± ç° %%%%%%%%%%%%%%%/4%%%%%%%%%%%%%
{
Pai [I] = 0;
If (Hu (PAI) return 1; // %% *******************************************************
Pai [I] = 4; // n has bought £;;%%%%%%4%%%% **************
}
 
// 3 Gbit/s)
If (PAI [I]> = 3) // %%%µ%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
{
Pai [I]-= 3; // ********************
If (Hu (PAI) return 1; // %% *******************************************************
Pai [I] + = 3; // è ï û 3 3 then é ×é° then
}
 
// 2 Gbit/s)
If (! Jiang & PAI [I]> = 2) // â ç ö öç° ã» ó ð «£ £%%%%%µ%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%2%%%%%%%%%%%%%
{
Jiang = 1; // éööw.gov.cn
Pai [I]-= 2; // ~~=¥2 ~~~~~~
If (Hu (PAI) return 1; // %% *******************************************************
Pai [I] + = 2; // è ï û 2 then é ×é° then
Jiang = 0; // ç ³ ½ «å æ ± ö ö¾
}
 

If (I> 30) return 0; // ° ¶ «ää î ÷ ±?
 
// Please refer ¡
If (I % 10! = 8 & I % 10! = 9
Pai [I + 1] & PAI [I + 2]) // maid ~~~~~*************************************
{
Pai [I] --;
Pai [I + 1] --;
Pai [I + 2] --; // There are too many other than 1
If (Hu (PAI) return 1; // %% *******************************************************
Pai [I] ++;
Pai [I + 1] ++;
Pai [I + 2] ++;
}
 
¡
Return 0;
}

// **********************
Int remain (INT Pai [38])
{
Int sum = 0;
For (INT I = 1; I <38; I ++)
Sum + = Pai [I];
Return sum;
}

 

 

This algorithm is concise but problematic, and does not consider the absence of child. If this problem is not taken into consideration, when it is used in a game, a judgment error will occur. The above algorithm comes from a friend on the Internet. After my improvement, I have been able to determine the correct fake cards, as for the code, I will not post it. The people who visit my space basically do not reply, so I will not post some of my results.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.