コード例 #1
0
    public void Create()
    {
        if (benchmark)
        {
            sw.Restart();
        }

        Clear();
        int layers = Convert.ToInt32(layerInput.text);

        val        = 1;
        highestVal = 0;

        for (int i = 0; i < layers; i++)
        {
            for (int j = 0; j <= i; j++)
            {
                if (j == 0 || i == 0)
                {
                    val = 1;
                }
                else
                {
                    val = val * (i - j + 1) / j;
                }

                if (val > highestVal)
                {
                    highestVal = val;
                }
                CreateNumber(val, i, j);
            }
        }

        if (benchmark)
        {
            sw.Stop();
            benchmarkText.ShowToast("Generation took " + sw.ElapsedMilliseconds + "ms (" + sw.ElapsedMilliseconds / 1000 + "s)", 3);
        }

        highestValueText.text = "Highest value: " + highestVal.ToString();
    }