当前位置: 首页>>代码示例>>C#>>正文


C# List.Shuffle方法代码示例

本文整理汇总了C#中System.Windows.Documents.List.Shuffle方法的典型用法代码示例。如果您正苦于以下问题:C# List.Shuffle方法的具体用法?C# List.Shuffle怎么用?C# List.Shuffle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.Documents.List的用法示例。


在下文中一共展示了List.Shuffle方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: MythGame

 public MythGame(int _timeLeft = 59)
 {
     currentIndex = 0;
     aRight = 0;
     aWrong = 0;
     timeLeft = _timeLeft;
     // get all characters with nations filter
     characters = (from fd in MythDB.Instance.Database.Characters where fd.Nation.IsActive select fd).ToList();
     characters.Shuffle();
 }
开发者ID:bashlykevich,项目名称:MythologyWP,代码行数:10,代码来源:MythGame.cs

示例2: print

        private void print()
        {
            sppool1.Children.Clear();
            sppool2.Children.Clear();
            sppool3.Children.Clear();

            var l1 = new List<Image>();
            var l2 = new List<Image>();
            var l3 = new List<Image>();

            foreach (var item in pool1)
            {
                Image img = new Image();
                string url = "Images/" + item + ".png";
                img.Source = new BitmapImage(new Uri(url, UriKind.RelativeOrAbsolute));
                img.Height = 96;
                img.Width = 72;
                img.VerticalAlignment = VerticalAlignment.Top;
                img.Margin = new Thickness(10);
                l1.Add(img);
                //sppool1.Children.Add(img);
            }

            foreach (var item in pool2)
            {
                Image img = new Image();
                string url = "Images/" + item + ".png";
                img.Source = new BitmapImage(new Uri(url, UriKind.RelativeOrAbsolute));
                img.Height = 96;
                img.Width = 72;
                img.VerticalAlignment = VerticalAlignment.Top;
                img.Margin = new Thickness(10);
                l2.Add(img);
                //sppool2.Children.Add(img);
            }
            foreach (var item in pool3)
            {
                Image img = new Image();
                string url = "Images/" + item + ".png";
                img.Source = new BitmapImage(new Uri(url, UriKind.RelativeOrAbsolute));
                img.Height = 96;
                img.Width = 72;
                img.VerticalAlignment = VerticalAlignment.Top;
                img.Margin = new Thickness(10);
                l3.Add(img);
                //sppool3.Children.Add(img);
            }

            l1.Shuffle();
            l2.Shuffle();
            l3.Shuffle();

            foreach (var item in l1)
            {
                sppool1.Children.Add(item);
            }

            foreach (var item in l2)
            {
                sppool2.Children.Add(item);
            }

            foreach (var item in l3)
            {
                sppool3.Children.Add(item);
            }

            //lbxpool1.ItemsSource = pool1;
            //lbxpool2.ItemsSource = pool2;
            //lbxpool3.ItemsSource = pool3;
        }
开发者ID:geoyogesh,项目名称:cardtrick,代码行数:71,代码来源:MainPage.xaml.cs

示例3: Initializedeck

 private void Initializedeck()
 {
     deck = new List<int>();
     for (int i = 1; i < 22; i++)
     {
         deck.Add(i);
     }
     deck.Shuffle();
 }
开发者ID:geoyogesh,项目名称:cardtrick,代码行数:9,代码来源:MainPage.xaml.cs

示例4: MulliganLogic


//.........这里部分代码省略.........
                    {
                        string id = mulliganData.Cards[i].Entity.Id
                        if ( id != "GAME_005")// dont mulligan coin
                        {
                            celist.Add(new Mulligan.CardIDEntity(id, i));
                        }
                        else
                        {
                            hascoin = true;
                        }
                        
                    }

                    if (celist.Count >= 4) hascoin = true;
                    List<int> mullientitys = Mulligan.Instance.whatShouldIMulligan(celist, ownName, enemName, hascoin);

                    for (var i = 0; i < mulliganData.Cards.Count; i++)
                    {
                        if (mullientitys.Contains(i))
                        {
                            Helpfunctions.Instance.ErrorLog("Rejecting Mulligan Card " + mulliganData.Cards[i].Entity.Id + " because of your rules");                            

                            
                        }
                    }

            }*/

            if (Mulligan.Instance.mulliganRulesLoaded)
            {
                Mulligan.Instance.getHoldList(mulliganData);
            }
            else
            {
                for (var i = 0; i < count; i++)
                {
                    var card = mulliganData.Cards[i];

                    try
                    {
                        foreach (var tuple in _mulliganRules)
                        {
                            if (GetCondition(tuple.Item1,
                                new List<RegisterScriptVariableDelegate>
                            {
                                scope => scope.SetVariable("mulliganData", mulliganData)
                            }))
                            {
                                if (GetCondition(tuple.Item2,
                                    new List<RegisterScriptVariableDelegate>
                                {
                                    scope => scope.SetVariable("mulliganData", mulliganData),
                                    scope => scope.SetVariable("card", card)
                                }))
                                {
                                    mulliganData.Mulligans[i] = true;
                                    Log.InfoFormat(
                                        "[Mulligan] {0} should be mulliganed because it matches the user's mulligan rule: [{1}] ({2}).",
                                        card.Entity.Id, tuple.Item2, tuple.Item1);
                                }
                            }
                            else
                            {
                                Log.InfoFormat(
                                    "[Mulligan] The mulligan execution check [{0}] is false, so the mulligan criteria [{1}] will not be evaluated.",
                                    tuple.Item1, tuple.Item2);
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        Log.ErrorFormat("[Mulligan] An exception occurred: {0}.", ex);
                        BotManager.Stop();
                        return;
                    }
                }
            }

            var thinkList = new List<KeyValuePair<int, int>>();
            for (var i = 0; i < count; i++)
            {
                thinkList.Add(new KeyValuePair<int, int>(i%count, RandomMulliganThinkTime()));
            }
            thinkList.Shuffle();

            foreach (var entry in thinkList)
            {
                var card = mulliganData.Cards[entry.Key];

                Log.InfoFormat("[Mulligan] Now thinking about mulliganing {0} for {1} ms.", card.Entity.Id, entry.Value);

                // Instant think time, skip the card.
                if (entry.Value == 0)
                    continue;

                Client.MouseOver(card.InteractPoint);

                await Coroutine.Sleep(entry.Value);
            }
        }
开发者ID:noHero123,项目名称:silverfish,代码行数:101,代码来源:DefaultRoutine_nH.cs


注:本文中的System.Windows.Documents.List.Shuffle方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。