1- #include < iostream>
1+ #include " table_mgr.h"
2+ #include " hulib.h"
3+ #include < iostream>
24#include < vector>
35#include < algorithm>
46#include < sys/time.h>
57#include < stdio.h>
6- #include " table_mgr.h"
7- #include " hulib.h"
8+ #include < string.h> // memset
89
910using namespace std ;
1011
11- void print_cards (char * cards)
12- {
13- for (int i = 0 ; i<9 ; ++i)
14- {
12+ #define MAX_COUNT (10 * 10000 )
13+ static char s_HuCardAll[136 ];
14+ int GUI_NUM = 4 ;
15+ char source[MAX_COUNT * 9 * 34 ];
16+
17+ void print_cards (char * cards) {
18+ for (int i = 0 ; i<9 ; ++i) {
1519 printf (" %d," , cards[i]);
1620 }
1721 printf (" " );
1822
19- for (int i = 9 ; i<18 ; ++i)
20- {
23+ for (int i = 9 ; i<18 ; ++i) {
2124 printf (" %d," , cards[i]);
2225 }
2326 printf (" " );
24- for ( int i = 18 ; i< 27 ; ++i)
25- {
27+
28+ for ( int i = 18 ; i< 27 ; ++i) {
2629 printf (" %d," , cards[i]);
2730 }
2831 printf (" " );
29- for ( int i = 27 ; i< 34 ; ++i)
30- {
32+
33+ for ( int i = 27 ; i< 34 ; ++i) {
3134 printf (" %d," , cards[i]);
3235 }
3336 printf (" \n " );
3437}
3538
36- #define MAX_COUNT (10 * 10000 )
37- static char s_HuCardAll[136 ];
38-
39- void test_hu ()
40- {
39+ void test_hu () {
4140 char cards[] = {
4241 1 ,0 ,1 ,0 ,0 ,2 ,0 ,2 ,0 ,
4342 1 ,1 ,1 ,0 ,0 ,3 ,0 ,0 ,0 ,
@@ -57,18 +56,13 @@ void test_hu()
5756 cout << " total count:" << MAX_COUNT / 10000 << " wan hu:" << hu << " time:" << timeUse << " ms" << endl;
5857}
5958
60- int GUI_NUM = 4 ;
61- char source[MAX_COUNT * 9 * 34 ];
62-
63- int main ()
64- {
59+ int main () {
6560 TableMgr::init ();
6661 TableMgr::load ();
6762
6863 // test_hu();
6964
70- for (int i = 0 ; i < 34 ; i++)
71- {
65+ for (int i = 0 ; i < 34 ; i++) {
7266 s_HuCardAll[i * 4 ] = i;
7367 s_HuCardAll[i * 4 + 1 ] = i;
7468 s_HuCardAll[i * 4 + 2 ] = i;
@@ -78,11 +72,9 @@ int main()
7872 int gui_index = 33 ;
7973 int total = 0 ;
8074 srand (1 );
81- for (int n = 0 ; n < MAX_COUNT; ++n)
82- {
75+ for (int n = 0 ; n < MAX_COUNT; ++n) {
8376 random_shuffle (s_HuCardAll, s_HuCardAll + 130 );
84- for (int i = 0 ; i < 9 ; ++i) // 136/14 -> 9
85- {
77+ for (int i = 0 ; i < 9 ; ++i) { // 136/14 -> 9
8678 char * cards = &source[total++ * 34 ];
8779 memset (cards, 0 , 34 );
8880 for (int j = i * 14 ; j < i * 14 + 14 - GUI_NUM; j++)
@@ -97,8 +89,7 @@ int main()
9789 struct timeval start;
9890 struct timeval end;
9991 gettimeofday (&start, NULL );
100- for (int n = 0 ; n<total; ++n)
101- {
92+ for (int n = 0 ; n<total; ++n) {
10293 char * cards = &source[n * 34 ];
10394 hu += HuLib::get_hu_info (cards, 34 , gui_index);
10495 }
0 commit comments