• 大小: 14.35MB
    文件类型: .rar
    金币: 2
    下载: 0 次
    发布日期: 2024-01-29
  • 语言: C#
  • 标签:

资源简介

c#斗地主c#斗地主c#斗地主c#斗地主

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;

namespace 斗地主
{
    #region 枚举类型,所有符合规则的牌型
    public enum Guize
    {
        不出一张 对子三不带炸弹顺子连对
        飞机不带三飞机不带四飞机不带五飞机不带
        三带一三带二四带二飞机带二
        飞机带二对三飞机带三四飞机带四
        三飞机带三对四带二对
        天炸四飞机带四对五飞机带五六飞机不带
    }
    #endregion

    #region 出牌类
    class Chupai
    {
        #region 出牌的类型如单张,对子等  (属性)
        private int paiType=0;
        public int PaiType
        {
            get { return paiType; }
            set { paiType = value; }
        }
        #endregion

        #region 外部调用方法,判断出牌是否符合规则
        public bool isRight(ArrayList list)
        {
            int[] args=new int[list.Count];
            for (int i = 0; i < args.Length; i++)
            {
                args[i] = (int)list[i];
            }
            return judge(args);
        }
        #endregion

        #region 外部调用方法,判断出牌是否符合规则 (知道数量传数组)
        public bool isRight(int[] args)
        {
            return judge(args);
        }
        #endregion

        #region 开始判断
        private bool judge(int[] args)
        {
            format(args);
            bool bl = false;
            switch (args.Length)
            {
                case 1: bl = true; paiType = (int)Guize.一张; break;
                case 2: bl = erzhang(args); break;
                case 3: bl = sanzhang(args); break;
                case 4: bl = sizhang(args); break;
                case 5: bl = wuzhang(args); break;
                case 6: bl = liuzhang(args); break;
                case 7: bl = qizhang(args); break;
                case 8: bl = bazhang(args); break;
                case 9: bl = jiuzhang(args); break;
                case 10: bl = shizhang(args); break;
                case 11: bl = shiyizhang(args); break;
                case 12: bl = shierzhang(args); break;
                case 14: bl = shisizhang(args); break;
                case 15: bl = shiwuzhang(args); break;
                case 16: bl = shiliuzhang(args); break;
                case 18: bl = shibazhang(args); break;
                case 20: bl = ershizhang(args); break;
            }
            return bl;
        }
        #endregion

        #region 辅助方法(也为主要算法)
        #region 排序(从大到小)
        public void format(int[] args)
        {
            for (int i = 0; i < args.Length; i++)
            {
                for (int j = i; j < args.Length; j++)
                {
                    if (args[i] < args[j])
                    {
                        int temp = args[i];
                        args[i] = args[j];
                        args[j] = temp;
                    }
                }
            }
        }
        #endregion
        #region 排序(从小到大)
        public void minToBig(int[] args)
        {
            for (int i = 0; i < args.Length; i++)
            {
                fo

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件      52736  2010-06-11 11:25  doudizhu\C#斗地主算法.doc

     文件      19620  2009-03-08 09:11  doudizhu\Chupai.cs

     文件       6309  2009-03-10 11:07  doudizhu\ComputerChuPai.cs

     文件      65437  2010-07-12 14:46  doudizhu\DdzMian.cs

     文件      70014  2010-07-12 13:16  doudizhu\DdzMian.Designer.cs

     文件      94323  2010-01-05 02:54  doudizhu\DdzMian.resx

     文件        340  2010-01-05 01:12  doudizhu\Form1.cs

     文件       2642  2010-01-05 01:12  doudizhu\Form1.Designer.cs

     文件       7050  2010-01-05 01:12  doudizhu\Form1.resx

     文件        361  2010-01-05 02:15  doudizhu\Form2.cs

     文件       2636  2010-01-05 02:15  doudizhu\Form2.Designer.cs

     文件       7024  2010-01-05 02:15  doudizhu\Form2.resx

     文件       1753  2010-07-12 14:47  doudizhu\Form3.cs

     文件       2974  2010-01-05 02:49  doudizhu\Form3.Designer.cs

     文件     288425  2010-01-05 02:49  doudizhu\Form3.resx

     文件       4945  2007-07-18 09:38  doudizhu\from.gif

     文件        743  2010-01-05 01:10  doudizhu\GameOver.cs

     文件       7503  2010-01-05 01:15  doudizhu\GameOver.Designer.cs

     文件       9474  2010-01-05 01:10  doudizhu\GameOver.resx

     文件      29168  2009-03-11 17:01  doudizhu\Jiepai.cs

     文件       1815  2010-07-12 14:56  doudizhu\JueSe.cs

     文件       1962  2009-03-02 13:06  doudizhu\KaiJu.cs

     文件       1708  2010-07-12 14:53  doudizhu\Player.cs

     文件        484  2010-01-05 02:49  doudizhu\Program.cs

     文件       1550  2009-03-10 19:48  doudizhu\Puke.cs

     文件       2241  2010-07-12 14:53  doudizhu\YiChuPai.cs

     文件       7199  2010-01-05 01:13  doudizhu\YiChuPai.Designer.cs

     文件      45485  2010-01-05 01:13  doudizhu\YiChuPai.resx

     文件      14087  2010-07-12 13:50  doudizhu\斗地主.csproj

     文件        662  2010-07-12 14:53  doudizhu\斗地主.csproj.user

............此处省略365个文件信息

评论

共有 条评论

相关资源