예제 #1
0
        /// <summary>
        /// </summary>
        /// <param name="Quiz_Turn_Max_Num">게임 최대 턴.</param>
        /// <param name="Quiz_Words_Count">문제들 최대 개수.</param>
        /// <param name="Quiz_Example_Num">답안 개수.</param>
        private GameInfo(int Quiz_Turn_Max_Num, int Quiz_Words_Count, int Quiz_Example_Num)
        {
            Current_Turn_      = 0;
            quiz_turn_max_num_ = Quiz_Turn_Max_Num;

            quiz_index_array_         = RandomExtention.GetNotOverlapRandNumberArray(0, Quiz_Words_Count - 1, 20);
            right_answer_index_array_ = new int[Quiz_Turn_Max_Num];
            quiz_example_array_       = new int[quiz_index_array_.Length][];

            for (int i = 0; i < quiz_example_array_.Length; ++i)
            {
                quiz_example_array_[i] = new int[Quiz_Example_Num];
                int right_answer_index = RandomExtention.Rand_.Next(Quiz_Example_Num);
                right_answer_index_array_[i] = right_answer_index;
                quiz_example_array_[i][right_answer_index] = quiz_index_array_[i];

                int[] wrong_example_index_array = RandomExtention.GetNotOverlapRandNumberArray_Lib(
                    0,
                    Quiz_Turn_Max_Num, Quiz_Example_Num - 1
                    );
                int wrong_example_index_count = 0;
                for (int j = 0; j < Quiz_Example_Num; ++j)
                {
                    if (j != right_answer_index)
                    {
                        quiz_example_array_[i][j] = wrong_example_index_array[wrong_example_index_count++];
                    }
                }
            }
        }
예제 #2
0
        void TestSortedRandomArray()
        {
            int[] values = RandomExtention.GetNotOverlapRandNumberArray(0, 10, 5);
            foreach (int value in values)
            {
                Console.WriteLine(value);
            }

            values = RandomExtention.GetNotOverlapRandNumberArray_Lib(0, 10, 5);
            foreach (int value in values)
            {
                Console.WriteLine(value);
            }
        }