当前位置:首页 » 操作系统 » ios斗地主源码

ios斗地主源码

发布时间: 2022-03-08 16:18:01

A. 有了开心斗地主源代码,怎样实现

呵呵~这个要数据库和es运行

B. 简易c++斗地主源码,简单的斗地主不需要ui,只要能发牌,随机决定地主,把牌按大小顺序排列

#include <time.h>
#include <iostream>
#include <string>
#include <vector>

enum em_CardClass_t
{
_CC_hearts = 0, // 红桃
_CC_Spade, // 黑桃
_CC_Clubs, // 梅花
_CC_Diamonds, // 方块
_CC_King // 大小王
};

struct st_Card_t
{
em_CardClass_t _emCardClass;
UINT _uCardIndex; // _emCardClass为_CC_King时,有效取值[1,2]
// _emCardClass非_CC_King时,有效取值[1,13]
};

using namespace std;

void InitCard(vector<st_Card_t>& vtCard)
{
st_Card_t card;
for( UINT i=0; i<_CC_King; i++ )
{
card._emCardClass = (em_CardClass_t)i;
for( UINT j=1; j<14; j++ )
{
card._uCardIndex = j;
vtCard.push_back(card);
}
}

card._emCardClass = _CC_King;
card._uCardIndex = 1;
vtCard.push_back(card);

card._uCardIndex = 2;
vtCard.push_back(card);
}
// 分牌
void DealCard(vector<st_Card_t>& vtCard, vector<st_Card_t>& vtPlayer1,
vector<st_Card_t>& vtPlayer2, vector<st_Card_t>& vtPlayer3)
{
srand( (unsigned)time( NULL ) );
for( int i = 0; i < 51; i++ )
{
int iCard = rand() % vtCard.size();

switch( i % 3 )
{
case 0:
vtPlayer1.push_back(vtCard[iCard]);
break;

case 1:
vtPlayer2.push_back(vtCard[iCard]);
break;

default:
vtPlayer3.push_back(vtCard[iCard]);
break;
}

if( iCard != vtCard.size()-1 )
{
vtCard[iCard] = vtCard[vtCard.size()-1];
}
vtCard.pop_back();
}
}
// 叫牌
int Bid(vector<st_Card_t>& vtCard, vector<st_Card_t>& vtPlayer1,
vector<st_Card_t>& vtPlayer2, vector<st_Card_t>& vtPlayer3)
{
srand( (unsigned)time( NULL ) );

int iBider = rand() % 3; // 叫牌者,也就是地主
vector<st_Card_t>* pPlayer = NULL;
switch( iBider )
{
case 0:
pPlayer = &vtPlayer1;
break;

case 1:
pPlayer = &vtPlayer2;
break;

default:
pPlayer = &vtPlayer3;
break;
}

for( UINT i = 0; i < vtCard.size(); i++ )
{
pPlayer->push_back(vtCard[i]);
}
return iBider;
}
// 整牌(按红桃、黑桃、梅花、方块、小大王的花色顺序整理,同一花色再按从小到大的顺序整理)
void SortCard(vector<st_Card_t>& vtPlayer)
{
st_Card_t tmp;
for( UINT i=0; i<vtPlayer.size()-1; i++ )
{
for( UINT j=i+1; j<vtPlayer.size(); j++ )
{
if( vtPlayer[i]._emCardClass < vtPlayer[j]._emCardClass )
{
continue;
}

if( vtPlayer[i]._emCardClass == vtPlayer[j]._emCardClass &&
vtPlayer[i]._uCardIndex < vtPlayer[j]._uCardIndex )
{
continue;
}

tmp = vtPlayer[i];
vtPlayer[i] = vtPlayer[j];
vtPlayer[j] = tmp;
}
}
}

void PrintPlayerCard(const string& sPlayerName,
const vector<st_Card_t>& vtPlayer)
{
cout << sPlayerName << " cards:" << endl;
for( UINT i=0; i< vtPlayer.size(); i++ )
{
switch( vtPlayer[i]._emCardClass )
{
case _CC_hearts:
cout << "红桃";
break;

case _CC_Spade:
cout << "黑桃";
break;

case _CC_Clubs:
cout << "梅花";
break;

case _CC_Diamonds:
cout << "方块";
break;

default:
cout << "King";
break;
}
cout << vtPlayer[i]._uCardIndex<< " ";
}
cout << endl << endl;
}

void main()
{
vector<st_Card_t> vtCard;

vector<st_Card_t> vtPlayer1;
vector<st_Card_t> vtPlayer2;
vector<st_Card_t> vtPlayer3;

InitCard(vtCard);
DealCard(vtCard, vtPlayer1, vtPlayer2, vtPlayer3);
int iBider = Bid(vtCard, vtPlayer1, vtPlayer2, vtPlayer3);

SortCard(vtPlayer1);
SortCard(vtPlayer2);
SortCard(vtPlayer3);

PrintPlayerCard("Player1", vtPlayer1);
PrintPlayerCard("Player2", vtPlayer2);
PrintPlayerCard("Player3", vtPlayer3);

cout <<"地主是Player"<< iBider+1 << endl << endl;

}

C. 求android 联网斗地主源码一份

http://search.apkbus.com/f/search?mod=forum&formhash=be433d32&srchtype=title&srhfid=&srhlocality=forum%3A%3Aindex&sId=5578702&ts=1377685951&cuId=220127&cuName=281749743&gId=16&agId=3&egIds=&fmSign=&ugSign16=&ugSign3=&ext_ffids=&ext_vgIds=0&sign=&charset=utf-8&source=discuz&fId=0&q=%E6%96%97%E5%9C%B0%E4%B8%BB&srchtxt=%E6%96%97%E5%9C%B0%E4%B8%BB&searchsubmit=true&mySign=3f22d4c3&searchLevel=3&qs=discuz&menu=1&orderField=default&page=1

下班了。。你自己找找吧。。

D. 欢乐斗地主游戏源码价格多少

杰米科技的是2-3万,如客户还有其他要求,费用另算

E. iOS的,斗地主和麻将的游戏源码,哪里能有啊,想学习一下~

必胜怎么可能?一般要看你做哪门了啊?比方地主的,要给你上家压力,给他主动出牌的自由,别人要出你就要压,保证不让别人逃牌,让主动保持在自己手里.还有上家是拦地主的一般出错把地主的副牌放掉就可以结束了啊.不算必胜,只是一个宗旨.
窍门道也是有,当你有大牌接手不妨打一对,或单张,如果没人要(有弹不用,三个不拆,连对...),接着打,直至自己的副牌逃走,就可以采取攻势了.

F. 谁有斗地主源码(C++/VC++)

http://www.1knx.cn/webbox_web_izvccc.html

G. 求斗地主java源代码

为保证咱两交易成功,我先发送代码中的一部分

先开启服务器监听 SocketServer ss = new SocketServer(6,8888);端口是8888 最多通 同时访问6人。
然后ss.start();开启监听

然后在New一个Socket
String ip = "127.0.0.1";服务器的IP
int port = 8888; 服务器的端口
Socket socket = new Socket(ip,port);
socket.connec();
OutputStream os = socket.getOutputStream();
String message = "要发送的数据";
os.write(message.getBytes());
os.flush();
os.close();
socket.close();

H. 求斗地主源代码

给你发过去了

热点内容
外存储器硬盘能存储的高清电影数 发布:2024-11-14 12:33:23 浏览:265
python分号作用 发布:2024-11-14 12:31:50 浏览:223
方舟编译器下载要钱吗 发布:2024-11-14 12:29:20 浏览:62
jspoa源码 发布:2024-11-14 12:21:31 浏览:420
不记得了密码怎么办 发布:2024-11-14 12:18:58 浏览:442
python字符串的大小 发布:2024-11-14 12:17:24 浏览:222
源码编辑软件 发布:2024-11-14 12:15:00 浏览:386
java中object 发布:2024-11-14 12:11:48 浏览:636
买车时哪些配置需要另外加钱 发布:2024-11-14 12:10:19 浏览:534
在哪里修改密码和手机号 发布:2024-11-14 12:10:08 浏览:932