VC + + 2008 Development Network hundred Home Music arcade game (next)

Source: Internet
Author: User
Tags rand rounds

4.2.3 System Management Functional Group

The System Management function group is the core part of the backend server software, which is composed of several modules, such as "field Bureau Generation Control", "Game road singles print", "Historical business record", "Operating profit statistic" and "business daily Printing". "Field Bureau Generation Control" is responsible for every baccarat game of the field Bureau generation and start operation; Game road Singles printed "In the game after the start of the games by the game management personnel in sealed envelopes printed out in the box, so that after the game by the players check to ensure that the game is fair; the remaining three modules are data analysis of game operations, Can be based on the needs of operators in a variety of ways to count the game's operational benefits.

4.2.3.1 Game Generation control

Field Bureau Generation control is responsible for each Spading home music game of the road single generation, after the game based on this module generated by the road single run every game, this game design hundred music for 180 innings, so do the following interface design:

The key of the field bureau generation control is to design the starting function according to the rules of the Baccarat game, from which the computer simulates the license to generate all the licensing records and the village Leisure Records of the Hundred Home Music. According to the rules of Baccarat games, computer simulation baccarat licensing by the leisure home, and then issued a dealer,

The dealer and the leisure home each hair two cards, the cent counts out the village leisure two card points again calculates the third card according to the Supplementary Card rule table, altogether simulates 180 innings, calculates the function as follows:

void Cth_round_iniview::onbnclickedscbutton ()
{
TODO: Add control notification Handler code here
......
18-line licensing for 18 rounds in circular mode
for (int i=0;i<18;i++)
{
cstring* String_lpjl=new cstring[10];
cstring* String_fpjl=new cstring[10];
10 rounds per game
for (int j=0;j<10;j++)
{
Dealer Variable
int int_bankerindex1,int_bankerindex2,int_bankerindex3;
Leisure Home Variable
int int_playindex1,int_playindex2,int_playindex3;
Dealer and leisure Home points
int int_banker_sumpoint,int_play_sumpoint;
CString String_banker_sumpoint,string_play_sumpoint;
Computer simulation random Draw the card, according to the first free home after the rules of the order of the Banker, Zhuang Leisure issued two cards
Int_playindex1=rand ()%52+1;
Int_bankerindex1=rand ()%52+1;
Int_playindex2=rand ()%52+1;
Int_bankerindex2=rand ()%52+1;
Calculate the total number of points
Int_banker_sumpoint=return_resultpoint (Return_puckpoint (int_bankerindex1) +return_puckpoint (INT_BANKERINDEX2));
Int_play_sumpoint=return_resultpoint (Return_puckpoint (int_playindex1) +return_puckpoint (INT_PLAYINDEX2));
According to the list of licensing rules of the third card of baccarat, the third ZHANGFA card is calculated
if (int_banker_sumpoint>=8| |int_play_sumpoint>=8)
{
String_lpjl[j]=return_ysstring (Int_banker_sumpoint,int_play_sumpoint);
String_banker_sumpoint. Format ("%d|%d", int_bankerindex1,int_bankerindex2);
String_play_sumpoint. Format ("%d|%d", int_playindex1,int_playindex2);
string_fpjl[j]=string_banker_sumpoint+ "=" +string_play_sumpoint;
}
Else
{
Int_playindex3=rand ()%52+1;
Int_bankerindex3=rand ()%52+1;

, ; if (int_play_sumpoint==6| | INT_PLAY_SUMPOINT==7)
{
, ; if (int_banker_sumpoint<=5)
{
Int_banker_sumpoint=return_resultpoint (Int_banker_sumpoint+return_puckpoint (INT_BANKERINDEX3));
String_lpjl[j]=return_ysstring (Int_banker_sumpoint,int_play_sumpoint);
String_banker_sumpoint. Format ("%d|%d|%d", int_bankerindex1,int_bankerindex2,int_bankerindex3);
String_play_sumpoint. Format ("%d|%d", int_playindex1,int_playindex2);
string_fpjl[j]=string_banker_sumpoint+ "=" +string_play_sumpoint;
}
Else
{
String_lpjl[j]=return_ysstring (Int_banker_sumpoint,int_play_sumpoint);
String_banker_sumpoint. Format ("%d|%d", int_bankerindex1,int_bankerindex2);
String_play_sumpoint. Format ("%d|%d", int_playindex1,int_playindex2);
string_fpjl[j]=string_banker_sumpoint+ "=" +string_play_sumpoint;
}
}
Else
{
int Int_play3=return_puckpoint (INT_PLAYINDEX3);
Int_play_sumpoint=return_resultpoint (INT_PLAY_SUMPOINT+INT_PLAY3);
if ((int_banker_sumpoint==7) | | (int_banker_sumpoint==6&& (int_play3==0| | int_play3==1| | int_play3==2| | int_play3==3| | int_play3==4| |
int_play3==5| | int_play3==8| |int_play3==9)) | | (int_banker_sumpoint==5&& (int_play3==0| | int_play3==1| | int_play3==2| | int_play3==3| | int_play3==8| |int_play3==9))
|| (int_banker_sumpoint==4&& (int_play3==0| | int_play3==1| | int_play3==8| |int_play3==9))
|| (int_banker_sumpoint==3&&int_play3==8))
{
String_lpjl[j]=return_ysstring (Int_banker_sumpoint,int_play_sumpoint);
String_banker_sumpoint. Format ("%d|%d", int_bankerindex1,int_bankerindex2);
String_play_sumpoint. Format ("%d|%d|%d", int_playindex1,int_playindex2,int_playindex3);
string_fpjl[j]=string_banker_sumpoint+ "=" +string_play_sumpoint;
}
Else
{Int_banker_sumpoint=return_resultpoint (int_banker_sumpoint+return_puckpoint) (Int_bank ERINDEX3));
String_lpjl[j]=return_ysstring (Int_banker_sumpoint,int_play_sumpoint);
String_banker_sumpoint. Format ("%d|%d|%d", int_bankerindex1,int_bankerindex2,int_bankerindex3);
String_play_sumpoint. Format ("%d|%d|%d", int_playindex1,int_playindex2,int_playindex3);
string_fpjl[j]=string_banker_sumpoint+ "=" +string_play_sumpoint;
}
}
}
}
Record the records in the Baccarat road list
CString sql_lpjl= "INSERT into TH_ROUND_LPJL (A,B,C,D,E,F,G,H,I,J) VALUES ('";
SQL_LPJL+=STRING_LPJL[0];
sql_lpjl+= "', '";
SQL_LPJL+=STRING_LPJL[1];
sql_lpjl+= "', '";
SQL_LPJL+=STRING_LPJL[2];
sql_lpjl+= "', '";
SQL_LPJL+=STRING_LPJL[3];
sql_lpjl+= "', '";
SQL_LPJL+=STRING_LPJL[4];
sql_lpjl+= "', '";
SQL_LPJL+=STRING_LPJL[5];
sql_lpjl+= "', '";
SQL_LPJL+=STRING_LPJL[6];
sql_lpjl+= "', '";
SQL_LPJL+=STRING_LPJL[7];
sql_lpjl+= "', '";
SQL_LPJL+=STRING_LPJL[8];
sql_lpjl+= "', '";
SQL_LPJL+=STRING_LPJL[9];
sql_lpjl+= "')";
M_datado. Exec (SQL_LPJL);
The record is recorded in the Baccarat Licensing record (note: The licensing record for each game is one by one corresponding to the road list record)
CString sql_fpjl= "INSERT into TH_ROUND_FPJL (A,B,C,D,E,F,G,H,I,J) VALUES ('";
SQL_FPJL+=STRING_FPJL[0];
sql_fpjl+= "', '";
SQL_FPJL+=STRING_FPJL[1];
sql_fpjl+= "', '";
SQL_FPJL+=STRING_FPJL[2];
sql_fpjl+= "', '";
SQL_FPJL+=STRING_FPJL[3];
sql_fpjl+= "', '";
SQL_FPJL+=STRING_FPJL[4];
sql_fpjl+= "', '";
SQL_FPJL+=STRING_FPJL[5];
sql_fpjl+= "', '";
SQL_FPJL+=STRING_FPJL[6];
sql_fpjl+= "', '";
SQL_FPJL+=STRING_FPJL[7];
sql_fpjl+= "', '";
SQL_FPJL+=STRING_FPJL[8];
sql_fpjl+= "', '";
SQL_FPJL+=STRING_FPJL[9];
sql_fpjl+= "')";
M_datado. Exec (SQL_FPJL);
delete [] STRING_FPJL;
delete [] STRING_LPJL;
}
Database record Backup
CString sql_bak= "INSERT INTO Th_round_lpjl_bak select * from TH_ROUND_LPJL";
M_datado. Exec (Sql_bak);
M_datado. Close ();
}
catch (...)
{
MessageBox ("Data Error!");
}
Refresh the displayed record table
Update_data ();
}
Else
{
MessageBox ("Please clear the field and then randomly generate!", "hint", mb_iconinformation);
}

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.