资源简介
mahjong.zip
代码片段和文件信息
#include “CMJ.h“
//构造
CMJ::CMJ()
{
m_9LBD = false;
m_13Y = false;
m_4AK = false;
m_AKNum = 0;
m_MKNum = 0;
}
//析构
CMJ::~CMJ()
{
}
//初始化
void CMJ::Init()
{
m_9LBD = false;
m_13Y = false;
m_4AK = false;
m_AKNum = 0;
m_MKNum = 0;
}
//加入新牌并排序
bool CMJ::AddPai(int p_Type int p_Value)
{
int iSize = m_MyPAIVec[p_Type].size();
bool t_Find = false;
vector< int >::iterator Iter;
for (Iter = m_MyPAIVec[p_Type].begin(); Iter != m_MyPAIVec[p_Type].end(); Iter++)
{
if ((*Iter)>p_Value)
{
m_MyPAIVec[p_Type].insert(Iter p_Value);
t_Find = true;
break;
}
}
if (t_Find == false)
{
m_MyPAIVec[p_Type].push_back(p_Value);
}
m_LastPAI.m_Type = p_Type;
m_LastPAI.m_Value = p_Value;
return true;
}
//取得对应的牌在牌墙的索引
int CMJ::GetPaiIndex(int p_Type int p_Value)
{
int count = 0;
for (UINT i = 0; i < 6; i++)
{
vector< int >::iterator Iter;
for (Iter = m_MyPAIVec[i].begin(); Iter != m_MyPAIVec[i].end(); Iter++)
{
if (p_Type == i && (*Iter) == p_Value)
{
return count;
}
count++;
}
}
return -1;
}
//打牌
bool CMJ::DelPai(int PaiIndex)
{
int count = 0;
for (UINT i = 0; i < 6; i++)
{
vector< int >::iterator Iter;
for (Iter = m_MyPAIVec[i].begin(); Iter != m_MyPAIVec[i].end(); Iter++)
{
if (count == PaiIndex)
{
m_MyPAIVec[i].erase(Iter);
return true;
}
count++;
}
}
return false;
}
//删除牌
bool CMJ::DelPai(int p_Type int p_Value)
{
vector< int >::iterator Iter;
for (Iter = m_MyPAIVec[p_Type].begin(); Iter != m_MyPAIVec[p_Type].end(); Iter++)
{
if ((*Iter) == p_Value)
{
m_MyPAIVec[p_Type].erase(Iter);
return true;
}
}
return false;
}
//清空牌
void CMJ::CleanUp()
{
for (UINT i = 0; i < 6; i++)
{
m_MyPAIVec[i].clear();
m_ChiPAIVec[i].clear();
m_PengPAIVec[i].clear();
m_GangPAIVec[i].clear();
}
}
//取得胡牌信息
stGoodInfo *CMJ::GetInfo()
{
return &m_GoodInfo;
}
//对所有的牌进行函数调用
void CMJ::PrintAllPai()
{
cout << “ “;
for (UINT i = 0; i < 13; i++)
{
cout << i << “ - “;
}
cout << endl;
int icount = 0;
//箭牌
if (m_MyPAIVec[0].empty() == false)
{
vector< int >::iterator Iter;
for (Iter = m_MyPAIVec[0].begin(); Iter != m_MyPAIVec[0].end(); Iter++)
{
switch (*Iter)
{
case 1:
cout << “[ 中]“;
break;
case 2:
cout << “[ 发]“;
break;
case 3:
cout << “[ 白]“;
break;
}
icount++;
}
}
cout << endl;
for (UINT i = 0; i < icount; i++)
{
cout << “ “;
}
//风牌
if (m_MyPAIVec[1].empty() == false)
{
vector< int >::iterator Iter;
for (Iter = m_MyPAIVec[1].begin(); Iter != m_MyPAIVec[1].end(); Iter++)
{
switch (*Iter)
{
case 1:
cout << “[ 东]“;
break;
case 2:
cout << “[ 南]“;
break;
case 3:
cout << “[ 西]“;
break;
case 4:
cout << “[ 北]“;
break;
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 8060 2017-12-14 09:50 CMJ.h
文件 1974 2017-12-14 15:01 CMJManage.cpp
文件 739 2017-12-14 09:44 CMJManage.h
文件 12507 2017-12-14 10:03 lala.cpp
文件 91004 2017-12-18 14:58 CMJ.cpp
- 上一篇:flash小程序
- 下一篇:神经网络控制 PE激励
相关资源
- 博览网教学视频.txt
- rar(39)
- 20190115-5c3d91493c3e53.25395649.rar
- 大数据_scala教程地址.txt
- EGM96的计算含有坐标转换及其他参数计
- netty.txt
- 明星人名大全合计5万5千个一行一个
- datastructureandalgorithmanalysisincsolution.p
- 百度云网盘解除限速工具.zip
- 小程序全套视频.txt
- 网课查课接口代刷网专用.zip
- visio2016.txt
- testQuazip.zip
- 视觉SLAM十四讲视频百度云.txt
- u011922164_9607053.txt
- surpac转ansys.rar
- M_51NET.rar
- PSO_path_planning-master.zip
- u011803118_6003703.xls
- QQ盗号源码.e
- arcgisforjs自定义鼠标样式.zip
- 全套机器学习深度学习——链接.txt
- 老虎微信淘宝客v5.99.46代理2.99.3.zip
- DDos.rar265452
- 7qds8n.rar
- u011541897_7733925.zip
- vi(1)
- 将QT界面做成dll在qt其他程序中调用
- 视觉SLAM十四讲全集视频链接视频百度
- missionplanner所有飞行模式中文参数调参
评论
共有 条评论