示例#1
0
        /// <summary>
        /// Initializes the game (list) data.
        /// </summary>
        private void Initialize()
        {
            _categories = new CircularLinkedList <string>();

            _categories.AddLast("Sport");
            _categories.AddLast("Culture");
            _categories.AddLast("History");
            _categories.AddLast("Geography");
            _categories.AddLast("People");
            _categories.AddLast("Technology");
            _categories.AddLast("Nature");
            _categories.AddLast("Science");
        }
示例#2
0
        /// <summary>
        /// Functional test of circular linked list.
        /// </summary>
        private static void CircularLinkedListDemo()
        {
            WriteLine("CIRCULAR LINKED LIST");
            WriteLine();

            var circularList =
                new CircularLinkedList <int>();

            for (var count = 0; count < 10; ++count)
            {
                circularList.AddLast(count);
            }

            var sampleData = circularList.Take(24);

            WriteLine("Sample data:");

            WriteLine(String.Join(", ", sampleData.ToList()));

            WriteLine();

            WriteLine("Sample data 2:");

            int counter = 0;

            foreach (var item in circularList)
            {
                if (counter > 32)
                {
                    break;
                }

                Write($"{item}, ");

                ++counter;
            }

            WriteLine();

            var sampleData3 = (circularList as IEnumerable <int>)?.Take(28);

            WriteLine("Sample data 3:");

            WriteLine(String.Join(", ", sampleData3.ToList()));

            WriteLine();

            WriteLine();
        }