public void CopyFrom(AddCubeCfg from)
 {
     for (var i = 0; i < 27; i++)
     {
         p[i] = from.p[i];
     }
 }
        private static int Compare(AddCubeCfg a, AddCubeCfg b)
        {
            var sum = 0;

            for (var i = 0; i < 27; i++)
            {
                if (a.p[i] == b.p[i])
                {
                    sum += (a.p[i] == BlockSetting.Any ? 0 : 1);
                }
                else if (a.p[i] != BlockSetting.Any && b.p[i] != BlockSetting.Any)
                {
                    return(-1);
                }
            }

            return(sum);
        }
        public void WriteCubeCfg(AddCubeCfg a)
        {
            var str = "fdsf ";

            for (var i = 0; i < 27; i++)
            {
                str += a.p[i] + " ";
            }
            Debug.Log(str);

            for (var i = 2; i >= 0; i--)
            {
                for (var j = 2; j >= 0; j--)
                {
                    Debug.Log(a.p[i * 9 + j * 3] + "," + a.p[i * 9 + j * 3 + 1] + "," + a.p[i * 9 + j * 3 + 2] + " ----- " +
                              Random.Range(0, 99999));
                }
            }
        }
        public int CompareWithWorld(AddCubeCfg w, ref int rot)
        {
            TmpCubeCfg.CopyFrom(this);

            var maxScore = -1;

            for (var i = 0; i < 4; i++)
            {
                var val = Compare(w, TmpCubeCfg);
                if (val > maxScore)
                {
                    maxScore = val;
                    rot      = i;
                }

                if (i < 3)
                {
                    TmpCubeCfg.Spin();
                }
            }

            return(maxScore);
        }