简单的发牌程序 54张牌发给3个人
来源:互联网 发布:小满软件 编辑:程序博客网 时间:2024/05/17 02:56
简单的发牌程序 54张牌发给3个人 -------注重思路 着重是对动态数组的使用
namespace 制作一个发牌程序
{
class Program
{
static void Main(string[] args)
{
List<int> pukeList = new List<int>();
for (int i = 0; i < 54; i++)
{
pukeList.Add(i);
}
List<int> playerA = new List<int>();
List<int> playerB = new List<int>();
List<int> playerC = new List<int>();
List<int> currentPlayer = playerA;
Random r = new Random();
while (pukeList.Count > 0)
{
int random = r.Next(0, pukeList.Count);
currentPlayer.Add(pukeList[random]);
pukeList.RemoveAt(random);
currentPlayer = currentPlayer == playerA ? playerB : (currentPlayer == playerB ? playerC : playerA);
}
Console.Write("A的牌有:");
foreach (int i in playerA)
{
Console.Write(" " + i);
}
Console.WriteLine("");
Console.Write("B的牌有:");
foreach (int i in playerB)
{
Console.Write(" " + i);
}
Console.WriteLine("");
Console.Write("C的牌有:");
foreach (int i in playerC)
{
Console.Write(" " + i);
}
Console.WriteLine("");
Console.ReadLine();
}
}
}
- 简单的发牌程序 54张牌发给3个人
- 改进的发牌程序
- 扑克牌的随机发牌程序
- 自己写的发牌程序!
- 发牌程序
- 发牌程序
- 发牌程序
- 发牌程序
- 发给热狗人个人个人
- 一个c++写的发牌程序
- 用c++实现的发牌程序
- 扑克牌的发牌和洗牌程序
- java多线程模仿发牌的小程序
- 题目:设计一个洗牌发牌的程序
- 点击发牌 ,一次三张
- 简单的发52张牌
- 一副牌发给三个玩家的算法
- 基于网狐架构台州四张游戏的开发-发牌处理
- Radiul: 静若镇纸 更能立纸
- OpenCV中获取不同形状的结构元素getStructuringElement
- UITableView的详细讲解
- 搜索
- Oracle 10g RAC TAF介绍
- 简单的发牌程序 54张牌发给3个人
- MVC与三层架构区别
- HeapAlloc、GlobalAlloc和new等内存分配有什么区别么?
- 简单的单链表(含错)
- WindowsAPI - CreateThread的说明
- SQl 2008/2005 镜像
- include 和 class类声明的区别
- 报这个错NSTALL_FAILED_INSUFFICIENT_STORAGE时的解决办法
- select、poll和epoll