Ejemplo n.º 1
0
        public static Worm Create(int maxSize)
        {
            int spaceSize;
            int charSize;

            SetSpaceAndCharSize(maxSize, out spaceSize, out charSize);

            char[] chars = new char[maxSize];
            for (int i = 0; i < maxSize; i++)
            {
                chars[i] = CharUtils.GetRandomChar();
            }
            return(new Worm(spaceSize, charSize, chars));
        }
Ejemplo n.º 2
0
 public char GetNextChar()
 {
     length--;
     if (length == -1)
     {
         isCurrentWhite = !isCurrentWhite;
         if (isCurrentWhite)
         {
             length = GetRandomSpaceSize();
         }
         else
         {
             length = GetRandomCharSize();
         }
     }
     if (isCurrentWhite)
     {
         return(' ');
     }
     return(CharUtils.GetRandomChar());
 }