예제 #1
0
        public MathTask Next()
        {
            _step++;

            MathTask t = null;

            do
            {
                var op = GetNextOperationType();

                switch (op)
                {
                case Operation.Add: t = new Add(op, level); break;

                case Operation.Substract: t = new Substract(op, level); break;

                case Operation.Multiply: t = new Mult(op, level); break;

                case Operation.Divide: t = new Divide(op, level); break;

                case Operation.Prime: t = new Prime(op, level); break;

                case Operation.Perimeter: t = new Perimeter(op, level); break;
                }

                t.GenerateArgs(_step, _random);
            } while (hs.Contains(t.GetHashCode()));

            _tasks.Add(t);
            hs.Add(t.GetHashCode());

            return(t);
        }