コード例 #1
0
    private void printLevels()
    {
        int i = 0;

        while (LevelCount.ContainsKey(i))
        {
            print("Level " + i + ": " + LevelCount[i]);
            i++;
        }
    }
コード例 #2
0
 private void countLevels(Brain b, int level)
 {
     if (b != null)
     {
         if (!LevelCount.ContainsKey(level))
         {
             LevelCount.Add(level, 0);
             CurrentCount.Add(level, 1);
         }
         LevelCount[level]++;
         numberOfBrains++;
         if (b.Children != null)
         {
             foreach (Brain child in b.Children)
             {
                 countLevels(child, level + 1);
             }
         }
     }
 }