游戏开发论坛

 找回密码
 立即注册
搜索
查看: 1017|回复: 0

斗地斗排序算法。。?各位?兔π薷

[复制链接]

1

主题

1

帖子

5

积分

新手上路

Rank: 1

积分
5
发表于 2008-12-14 22:05:00 | 显示全部楼层 |阅读模式
using System;
// 冒泡排序
// ?魅胫?橐??整? 黑桃400  方?K 300  梅花 200 ?心 100
namespace BubbleSorter
{
    public class NewBubbleSorter
    {
        public void newSort(int[] list)
        {
            int[] Temparry = new int[list.Length];
            int[] arryCard2 = new int[list.Length];
            bool done = false;
            int j = 1, i, temp;
            //  冒泡算法?始
            for (int Q = 1; Q < 2; Q++)
            {
                while ((j < list.Length) && (!done))
                {
                    done = true;
                    for (i = 0; i < list.Length - j; i++)
                    {
                        if (list > list[i + 1])
                        {
                            done = false;
                            temp = list;
                            list = list[i + 1];
                            list[i + 1] = temp;
                        }
                    }
                    j++;
                }
                for (int w = 0; w < list.Length; w++)
                {
                    arryCard2[w] = list[w];
                    Temparry[w] = list[w] % 100;
                    list[w] = Temparry[w];
                }
                j = 1;
                done = false;
                Array.Sort(list, arryCard2);
            }
            // 大小重排   21KQJ109876543
            for (int t = 0; t < list.Length ; t++)
            {
                Temparry[t] = arryCard2[t];

            }
            for (int a = 0, q = 16; a < list.Length ; a++, q--)
            {
                arryCard2[a] = Temparry[q];
                list[a] = arryCard2[a];
            }

        }

    }
}
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

作品发布|文章投稿|广告合作|关于本站|游戏开发论坛 ( 闽ICP备17032699号-3 )

GMT+8, 2026-1-20 17:07

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表