資訊保安演算法設計實驗之一,只具有uno紙牌的部分規則功能
//#include "stdafx.h"
#include#include#include#include#include#includeusing namespace std;
struct node
;int n;
vectorcard;
vectorhandcard[100];
node e;
int bankerpos, startpos;
int pos;
int x;
char o;
int tab, flag;
void shuffle(vector& v)
}void initialization()
//功能牌 反轉和+2
for (int i = 1; i <= 4; i++)
e.color = 5;
e.num = 12;
//萬能牌 +4
for (int i = 1; i <= 4; i++)
card.push_back(e);
cout << "總牌數: " << card.size() << endl;
cout << "----------------------------------\n";
}void initnumofplayer()//讀入玩家個數並給玩家編號
void confirmtheorderofplay()//確定發牌順序
cout << card.back().num << ' ';
if (card.back().num > maxnum)//確定莊家
card.pop_back();
} cout << endl;
if (bankerpos == 1)
startpos = n;
else startpos = bankerpos - 1;
cout << "最大牌為" << maxnum << ",對應" << bankerpos << "號玩家" << endl;
cout << "莊家為" << bankerpos << "號玩家,從" << startpos << "號玩家開始發牌\n";
}string getcolor(int x)
void gethandcard()
} for (int i = 1; i <= n; i++)//輸出每個選手的手牌
int main()
if (card.size() == 0)
cout << "請" << pos << "號玩家發牌:\n";
cout << pos << "號選手手牌:";
for (int i = 0; i < handcard[pos].size(); i++)
cout << handcard[pos][i].num << ' '; cout << endl;
cout << " ";
for (int i = 0; i < handcard[pos].size(); i++)
cout << getcolor(handcard[pos][i].color) << ' '; cout << endl;
cout << "是否有合適的手牌(y/n)?";
o = getchar();
cin >> o;
while (o == 'n')
cout << "是否發牌(y/n)?";
o = getchar();
cin >> o;
if (o == 'y')
nowcard = handcard[pos][x];
vector::iterator iter = handcard[pos].begin() + x;
handcard[pos].erase(iter);//刪除第x個元素
cout << pos << "號玩家手牌變為:";
for (int i = 0; i < handcard[pos].size(); i++)
cout << handcard[pos][i].num << ' '; cout << endl;
cout << " ";
for (int i = 0; i < handcard[pos].size(); i++)
cout << getcolor(handcard[pos][i].color) << ' '; cout << endl;
if (handcard[pos].size() == 1)
cout << "-----------nuo----------\n";
if (handcard[pos].size() == 0)
if (nowcard.num == 10)//如果打出了反轉牌
if (nowcard.num == 11 || nowcard.num == 12)//如果打出了罰牌2張
cout << "-----------當前桌面牌:" << nowcard.num << ' ' << getcolor(nowcard.color) << endl;
} pos += tab;
if (pos > n)pos = 1;
if (pos < 1)pos = n;
} system("pause");
return 0;
}
隨機行走 資訊保安演算法設計實驗
資訊保安演算法設計實驗之一 include stdafx.h include include include includeusing namespace std int a 10 10 int x,y int random 隨機產生1 3範圍中的乙個數,代表走的方向 void process in...
資訊保安實驗 DES演算法
不喜歡這門課,感覺太蛋疼了,不爽。這是第乙個實驗的 還沒完成就因為特殊原因終止了,只實現了加密部分,還沒介面。發上來留個紀念。include include using namespace std 各種表 const int ip table 8 8 const int e table 8 6 co...
資訊保安專業之網路滲透實驗
通過使用wireshark軟體掌握sniffer 嗅探器 工具的使用方法,實現捕捉http等協議的資料報,以理解tcp ip協議中多種協議的資料結構 通過實驗了解http等協議明文傳輸的特性 研究交換環境下的網路嗅探實現及防範方法,研究並利用arp協議的安全漏洞,通過arpspoof實現arp欺騙以...