📄 pokeranalyse.h
字号:
#ifndef __POKERANALYSE_H__
#define __POKERANALYSE_H__
#define SINGLE 0 //一手牌
#define DOUBLE 1 //一手牌
#define TRIBLE 2
#define QUAD 3
#define KINGS 4
#define TRIBLE_PLUS 5
#define SORTED_SINGLE 6
#define SORTED_DOUBLE 7
#define SORTED_TRIBLE 8
#define SORTED_TRIBLE_PLUS 9
#define QUAD_PLUS 10
#define HONGTAO 0
#define HEITAO 1
#define MEIHUA 2
#define FANGKUAI 3
#include <iostream>
#include <fstream>
#include <algorithm>
#include <vector>
#include <stdio.h>
#include <conio.h>
using namespace std;
//代表每张牌的大小,花色
class Poker
{
public:
int m_val; //大小
int m_col; //花色
Poker(){m_val=-1; m_col=-1;}
};
class PokerType
{
public:
vector<Poker> m_pokers;
unsigned char m_type;
int m_value;
int m_trible_num; //三张带牌的类型用,表示三张的有几对
int m_num;
int m_weight; //权值
PokerType()
{
m_type = -1;
m_value = -1;
m_num = -1;
m_weight = 0;
m_trible_num = 0;
}
};
class PokerAnalyse
{
public:
PokerAnalyse();
~PokerAnalyse();
public:
template <class T>
T min(T x,T y)
{
if(x<y)
return true;
else
return false;
}
template <class T>
T max(T x,T y)
{
if(x>y)
return true;
else
return false;
}
template <class T>
T equel(T x,T y)
{
if (x==y)
return true;
else
return false;
}
static bool ReadPokerFromFile( const char* filename, PokerType& pokers);
static bool ReadPokerFromFile( const char* filename, vector<Poker>& pokers);
static bool GetType( PokerType& pokers );
static void PrintType( PokerType& pokers );
static void PrintPokers(vector<Poker>& pokers);
static bool Play( vector<Poker>& AllPokers, PokerType& pokers_in, PokerType& pokers_out );
protected:
static bool AnalyseDouble( PokerType& pokers );
static bool AnalyseTrible( PokerType& pokers );
static bool AnalyseQuad( PokerType& pokers );
static bool AnalyseSorted( PokerType& pokers );
static bool PickOne( vector<Poker>& pokers, int value, int num, PokerType& pokers_out, bool bErase=true );
static bool PickKings( vector<Poker>& pokers, PokerType& pokers_out );
static bool PickSorted( vector<Poker>& pokers, int value, int len, int num, PokerType& pokers_out, bool bErase=true );
static bool RemovePokers( vector<Poker>& pokers, vector<Poker>&remove );
static void CopyPokers( vector<Poker>& pokers, vector<Poker>& cp );
};
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -