public static List <Ladders> DrawLadders(int quantity, int upperLimit, int lowerLimit)
        {
            List <Ladders> LaddersList = new List <Ladders>();

            for (int i = 0; i < quantity; i++)
            {
                Ladders currenShape = (Ladders)FormOfTheLadder.GetShape(new Ladders(), lowerLimit, upperLimit);
                LaddersList.Add(currenShape);
                upperLimit = upperLimit + 10;
                lowerLimit = lowerLimit + 8;
            }
            return(LaddersList);
        }
Exemple #2
0
        public static Ladders GetShape(Ladders form, int lowerLimit, int upperLimit)
        {
            var rand  = new Random();
            int limit = rand.Next(lowerLimit, upperLimit);
            int lower = rand.Next(lowerLimit, upperLimit);

            if (limit > lower)
            {
                form.LadderHead = limit;
                form.LadderTail = lower;
            }
            else
            {
                GetShape(form, lowerLimit, upperLimit);
            }
            return(form);
        }