请教如何用C++编写个牌型判断程序
#ifndef _JUDGE_CARD_STATU_H_#define _JUDGE_CARD_STATU_H_
#define TYPE_SINGLE_CARDS 0x01 //单牌
#define TYPE_PAIR_CARDS 0x20 //对子
#define TYPE_TRIAD_CARDS 0x30 //三张牌
#define TYPE_TRIAD_CARDS_SINGLE 0x31 //三带一
#define TYPE_TRIAD_CARDS_PAIR 0x32 //三带二
#define TYPE_SINGLE_SEQUENCE_CARDS 0x15 //单顺牌(5张)
#define TYPE_SINGLE_SEQUENCE_SIX 0x16 //单顺牌(6张)
#define TYPE_SINGLE_SEQUENCE_SEVEN 0x17 //单顺牌(7张)
#define TYPE_SINGLE_SEQUENCE_EIGHT 0x18 //单顺牌(8张)
#define TYPE_SINGLE_SEQUENCE_NINE 0x19 //单顺牌(9张)
#define TYPE_SINGLE_SEQUENCE_TEN 0x1A //单顺牌(10张)
#define TYPE_SINGLE_SEQUENCE_ELEVEN 0x1B //单顺牌(11张)
#define TYPE_SINGLE_SEQUENCE_TWELVE 0x1C //单顺牌(12张)
#define TYPE_PAIR_SEQUENCE_CARDS 0x23 //双顺牌(3对)
#define TYPE_PAIR_SEQUENCE_FOUR 0x24 //双顺牌(4对)
#define TYPE_PAIR_SEQUENCE_FIVE 0x25 //双顺牌(5对)
#define TYPE_PAIR_SEQUENCE_SIX 0x26 //双顺牌(6对)
#define TYPE_PAIR_SEQUENCE_SEVEN 0x27 //双顺牌(7对)
#define TYPE_PAIR_SEQUENCE_EIGHT 0x28 //双顺牌(8对)
#define TYPE_PAIR_SEQUENCE_NINE 0x29 //双顺牌(9对)
#define TYPE_PAIR_SEQUENCE_TEN 0x2A //双顺牌(10对)
#define TYPE_TRIAD_SEQUENCE_CARDS 0x3B //三顺牌(连续2个)
#define TYPE_TRIAD_SEQUENCE_THREE 0x3C //三顺牌(连续3个)
#define TYPE_TRIAD_SEQUENCE_FOUR 0x3D //三顺牌(连续4个)
#define TYPE_TRIAD_SEQUENCE_FIVE 0x3E //三顺牌(连续5个)
#define TYPE_TRIAD_SEQUENCE_SIX 0x3F //三顺牌(连续6个)
#define TYPE_FOUR_WITH_TWO 0x42 //四带二
#define TYPE_PLANE_TWO_WING_SIGLE 0x60 //飞机带翅膀(两三条带两单牌)
#define TYPE_PLANE_TWO_WING_TWO 0x61 //飞机带翅膀(两三条带两对子)
#define TYPE_PLANE_THREE_WING_SIGLE 0x62 //飞机带翅膀(三三条带三单牌)
#define TYPE_PLANE_THREE_WING_TWO 0x63 //飞机带翅膀(三三条带三对子)
#define TYPE_PLANE_FOUR_WING_SIGLE 0x64 //飞机带翅膀(四三条带四单牌)
#define TYPE_PLANE_FOUR_WING_TWO 0x65 //飞机带翅膀(四三条带四对子)
#define TYPE_PLANE_FIVE_WING_SIGLE 0x66 //飞机带翅膀(五三条带五单牌)
#define TYPE_BOMB_CARD 0x70 //炸弹
#define TYPE_ROCKET_CARD 0x71 //火箭
/*
*判断牌形,arg_num[]为存有牌的数组,arg_num为牌的张数,arg_value用来返回牌的大小,
*若牌合法,返回牌形,arg_value返回牌形中主要牌的最大一张,
*若牌不合,法否则返回-1;arg_value返回0;
*/
int JudgeCardShape(int arg_card[], int arg_num, int &arg_value)
{
#endif //_JUDGE_CARD_STATU_H_
[ Last edited by moto16017973 on 2004-11-29 at 09:47 ]
页:
[1]