Esempio n. 1
0
        void DisplayTask3()
        {
            Console.WriteLine("-------------Part1----------------");
            HomeWork.Task3.CreatingList crea = new CreatingList();

            crea.create();

            Console.WriteLine("-------------Part2----------------");
            HomeWork.Task3.Addrange addrange = new Addrange();

            addrange.Addrang();

            Console.WriteLine("-------------Part3----------------");
            HomeWork.Task3.RandomList rnd = new RandomList();
            rnd.Randstr();

            rnd.SearchZ();

            rnd.SearchEqual();


            Console.Write("Input PageNumber:");
            int PageNumber = Convert.ToInt32(Console.ReadLine());

            rnd.PageNumber(PageNumber);
        }
Esempio n. 2
0
    static void Main(string[] args)
    {
        RandomList show = new RandomList(50, 10);

        show.TotalSum();
        show.Sort();
    }
Esempio n. 3
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="Neat"><see cref="IGenome"/></param>
        public Genome(INeat Neat)
        {
            Connections = new RandomList <ConnectionGene>();
            Nodes       = new RandomList <NodeGene>();

            this.Neat = Neat;
        }
Esempio n. 4
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="Representative"><see cref="Client"/> choosen as representative of a <see cref="Species"/></param>
 public Species(Client Representative)
 {
     Clients                     = new RandomList <Client>();
     this.Representative         = Representative;
     this.Representative.Species = this;
     Clients.Add(Representative);
 }
Esempio n. 5
0
    public Station GetRandomStation()
    {
        List <Station> availableStations = new List <Station>();

        foreach (Station s in stations)
        {
            if (s.HasActiveEvent() == false)
            {
                availableStations.Add(s);
            }
        }

        if (availableStations.Count == 0)
        {
            return(null);
        }
        if (availableStations.Count == 1)
        {
            return(availableStations[0]);
        }

        RandomList <Station> rd = new RandomList <Station>(stations);

        return(rd.Pick());
    }
Esempio n. 6
0
        protected static void RandomSelection_LoadRandomness(RandomSelection __instance)
        {
            foreach (RandomListInfo info in RogueLibs.Instance.RandomLists)
            {
                __instance.CreateRandomList(info.name, info.category, info.objectType);
            }

            foreach (CustomItem item in RogueLibs.Instance.Items)
            {
                foreach (KeyValuePair <string, int> pair in item.SpawnDictionary)
                {
                    RandomList list = null;
                    foreach (RandomList l in __instance.randomListTable.Values)
                    {
                        if (l.rName == pair.Key)
                        {
                            list = l;
                            break;
                        }
                    }
                    if (list != null)
                    {
                        __instance.CreateRandomElement(list, item.Id, pair.Value);
                    }
                }
            }
        }
Esempio n. 7
0
        public void CreatingInstance()
        {
            // Act
            var randList = new RandomList <int>();

            // Assert
            Assert.True(randList.Count == 0);
        }
Esempio n. 8
0
 public override void OnNavigatingTo(NavigationParameters parameters)
 {
     if (parameters.ContainsKey("randomlist"))
     {
         this.RandomList = (RandomList)parameters["randomlist"];
         this.Title      = this.RandomList.Name;
     }
 }
Esempio n. 9
0
        [Test] public void InsertOverEndTest()
        {
            var l = new RandomList <int> {
                1, 2, 3, 4
            };

            Assert.Throws <ArgumentOutOfRangeException>(() => l.Insert(5, 10));
        }
Esempio n. 10
0
        [Test] public void InsertEndTest()
        {
            var l = new RandomList <int> {
                1, 2, 3, 4
            };

            l.Insert(4, 10);
            Assert.AreEqual(F.list(1, 2, 3, 4, 10), l);
        }
Esempio n. 11
0
 void Start()
 {
     name = RandomWord.Adverb(); // race.randomName
     int[] randList = RandomList.FixedSum(3, 50);
     sneak    += randList[0];
     smarts   += randList[1];
     strength += randList[2];
     Heal();
 }
Esempio n. 12
0
    static void Main(string[] args)
    {
        var list = new RandomList()
        {
            "Hello", "Olla", "Asta la", "Vista la"
        };

        Console.WriteLine(list.RandomString());
    }
Esempio n. 13
0
        /// <summary>
        /// Constructor
        /// </summary>
        public Neat()
        {
            AllConnections = new Dictionary <ConnectionGene, ConnectionGene>();
            AllNodes       = new RandomList <NodeGene>();
            AllClients     = new RandomList <Client>();
            AllSpecies     = new RandomList <Species>();

            Reset();
        }
Esempio n. 14
0
    // test class RandomList

    static void Main()
    {
        var list = new List <string> {
            "a", "s", "d"
        };
        var randomList = new RandomList(list);

        Console.WriteLine(randomList.RandomString());
    }
Esempio n. 15
0
        [Test] public void InsertMiddleTest()
        {
            var l = new RandomList <int> {
                1, 2, 3, 4
            };

            l.Insert(2, 10);
            Assert.AreEqual(F.list(1, 2, 10, 4, 3), l);
        }
Esempio n. 16
0
        [Test] public void InsertStartTest()
        {
            var l = new RandomList <int> {
                1, 2, 3, 4
            };

            l.Insert(0, 10);
            Assert.AreEqual(F.list(10, 2, 3, 4, 1), l);
        }
Esempio n. 17
0
        internal async Task NavigateToDetailPage(RandomList randomList)
        {
            var parameters = new NavigationParameters
            {
                { "randomlist", randomList }
            };

            await this.navigationService.NavigateAsync("RandomListDetailPage", parameters);
        }
Esempio n. 18
0
        [Test] public void RemoveAtNonExistingTest()
        {
            var l = new RandomList <int> {
                1, 2, 3, 4
            };

            Assert.Throws <ArgumentOutOfRangeException>(() => l.RemoveAt(5));
            Assert.AreEqual(F.list(1, 2, 3, 4), l);
            Assert.AreEqual(4, l.Count);
        }
Esempio n. 19
0
        [Test] public void RemoveNonExistingTest()
        {
            var l = new RandomList <int> {
                1, 2, 3, 4
            };

            Assert.AreEqual(false, l.Remove(5));
            Assert.AreEqual(F.list(1, 2, 3, 4), l);
            Assert.AreEqual(4, l.Count);
        }
Esempio n. 20
0
        [Test] public void RemoveFromEndTest()
        {
            var l = new RandomList <int> {
                1, 2, 3, 4
            };

            Assert.AreEqual(true, l.Remove(4));
            Assert.AreEqual(F.list(1, 2, 3), l);
            Assert.AreEqual(3, l.Count);
        }
Esempio n. 21
0
    public string RandomString(RandomList rndList)
    {
        Random rnd = new Random();

        int    randomIndex = rnd.Next(0, rndList.Count);
        string str         = rndList[randomIndex];

        rndList.Remove(str);
        return(str);
    }
Esempio n. 22
0
 ToggleableMultiplier(
     float multiplier, RandomList <ToggleableMultiplier> list,
     IRxRef <float> totalMultiplier, bool active
     )
 {
     _multiplier          = multiplier;
     this.list            = list;
     this.totalMultiplier = totalMultiplier;
     _active = active;
 }
Esempio n. 23
0
        [Test] public void RemoveWhereNoneTest()
        {
            var l = new RandomList <int> {
                1, 3, 5, 7, 9
            };

            l.RemoveWhere(i => i % 2 == 0);
            Assert.AreEqual(F.list(1, 3, 5, 7, 9), l);
            Assert.AreEqual(5, l.Count);
        }
Esempio n. 24
0
    public static void Main()
    {
        var randomList = new RandomList();

        randomList.Add("one");
        randomList.Add("two");
        randomList.Add("three");

        Console.WriteLine(randomList.RandomString());
    }
Esempio n. 25
0
        [Test] public void RemoveAtFromMiddleTest()
        {
            var l = new RandomList <int> {
                1, 2, 3, 4
            };

            l.RemoveAt(2);
            Assert.AreEqual(F.list(1, 2, 4), l);
            Assert.AreEqual(3, l.Count);
        }
Esempio n. 26
0
        [Test] public void RemoveAtFromStartTest()
        {
            var l = new RandomList <int> {
                1, 2, 3, 4
            };

            l.RemoveAt(0);
            Assert.AreEqual(F.list(4, 2, 3), l);
            Assert.AreEqual(3, l.Count);
        }
Esempio n. 27
0
        [Test] public void RemoveWhereAllTest()
        {
            var l = new RandomList <int> {
                2, 4, 6, 8, 10
            };

            l.RemoveWhere(i => i % 2 == 0);
            Assert.AreEqual(F.emptyList <int>(), l);
            Assert.AreEqual(0, l.Count);
        }
Esempio n. 28
0
    static void Main()
    {
        var randomList = new RandomList();

        randomList.Add("34wfsdsd");
        randomList.Add("444");
        randomList.Add("asdf");
        randomList.Add("55");

        Console.WriteLine(randomList.RandomString());
    }
Esempio n. 29
0
        public void CreatingInstance_Passing_IEnumerable()
        {
            // Arrange
            var list = Enumerable.Range(0, 10);

            // Act
            var randList = new RandomList <int>(list);

            // Assert
            Assert.True(randList.Count == list.Count());
        }
Esempio n. 30
0
        public void GetItemRandomly()
        {
            // Arrange
            var randList = new RandomList <int>(Enumerable.Range(0, 10));

            // Act
            int item = randList.GetItemRandomly();

            // Assert
            Assert.Contains(item, randList);
        }
Esempio n. 31
0
        public void TestCase()
        {
            var list = new RandomList<int>(new Random(239823), new int[]{0,1,2,3,4,5});

            long start = DateTime.Now.ToFileTimeUtc();
            int end = 1 << 6; // 24;
            int last = -1;
            for (int i = 0; i < end; i++) {
                int item = list.RandomItem();
                // Console.Write(item.ToString());
                Assert.True(item != last);
                last = item;
            }
            double seconds = (DateTime.Now.ToFileTimeUtc() - start) / 10000000.0;
            // Console.WriteLine("");
            Console.WriteLine(seconds);

            // Assert.False(true);
        }