Skip to content

Commit c8064f3

Browse files
committed
code format
1 parent e18c2fd commit c8064f3

File tree

7 files changed

+28
-37
lines changed

7 files changed

+28
-37
lines changed

mahjong/mahjongHu_v4/gen_feng_table.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1+
#include "table_mgr.h"
12
#include <stdio.h>
23
#include <set>
34
#include <map>
4-
#include "table_mgr.h"
55

66
std::map<int, bool> gui_tested[9];
77
std::map<int, bool> gui_eye_tested[9];

mahjong/mahjongHu_v4/gen_table.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1+
#include "table_mgr.h"
12
#include <stdio.h>
23
#include <set>
34
#include <map>
4-
#include "table_mgr.h"
55

66
std::map<int, bool> gui_tested[9];
77
std::map<int, bool> gui_eye_tested[9];

mahjong/mahjongHu_v4/hulib.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#include <string.h>
21
#include "hulib.h"
32
#include "table_mgr.h"
3+
#include <string.h>
44

55
bool HuLib::get_hu_info(char* cards, char cur_card, int gui_index) {
66
int gui_num = 0;

mahjong/mahjongHu_v4/hulib.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#ifndef hu_lib_h__
33
#define hu_lib_h__
44

5-
#include <string.h>
5+
//#include <string.h>
66

77
class HuLib
88
{

mahjong/mahjongHu_v4/set_table.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1+
#include "set_table.h"
12
#include <stdio.h>
23
#include <string.h>
3-
#include "set_table.h"
44
#include <algorithm>
55
#include <vector>
66

mahjong/mahjongHu_v4/table_mgr.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#include <stdio.h>
21
#include "table_mgr.h"
32
#include "set_table.h"
3+
#include <stdio.h>
44

55
#define TABLECLASS SetTable
66

mahjong/mahjongHu_v4/test_table.cpp

Lines changed: 22 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,42 @@
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

910
using 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

Comments
 (0)