예제 #1
0
        public void LeadToStandard(Parallelepiped Standard)
        {
            for (int j = 0; j<2;j++)
               {
               for (int i = 0; i < 5; i += 2)
               {

                   while (this.ColorParallelepiped[i] != Standard.ColorParallelepiped[i])
                   {

                       int pos = Standard.ColorParallelepiped.IndexOf(this.ColorParallelepiped[i]);

                       if (this.ColorParallelepiped[i] == '.' && this.ColorParallelepiped[i + 1] == '.')
                       {
                           break;
                       }

                       if (this.ColorParallelepiped[i] == '.' && this.ColorParallelepiped[i + 1] != '.' && this.ColorParallelepiped[i + 1] == Standard.ColorParallelepiped[i + 1])
                       {
                           break;
                       }

                       if (this.ColorParallelepiped[i] == '.' && this.ColorParallelepiped[i + 1] != '.' && this.ColorParallelepiped[i + 1] != Standard.ColorParallelepiped[i + 1])
                       {
                          pos = Standard.ColorParallelepiped.IndexOf(this.ColorParallelepiped[i+1]);

                       }

                       if (pos % 2 == 1)
                       {
                           pos -= 1;
                       }

                       if (Math.Abs(pos - i) == 1)
                       {
                           pos = Math.Min(i, pos);

                           if (pos % 2 == 1)
                           {
                               pos -= 1;
                           }

                           Swap(pos, pos);
                       }
                       else
                       {
                           Swap(i, pos);
                       }
                  }
               }
               }

               DefinitionType();
        }
예제 #2
0
        static void Main()
        {
            var standard = Parallelepiped.ConsoleRead();
            int NumberParallelepiped = int.Parse(Console.ReadLine());

            Parallelepiped[] ArrayParallelepipeds = new Parallelepiped[NumberParallelepiped];

            int IndexLeftPiece = 0;
            CharacterPiece charact;

            for (int i = 0; i < NumberParallelepiped; ++i)
            {
                ArrayParallelepipeds[i] = Parallelepiped.ConsoleRead();
                ArrayParallelepipeds[i].LeadToStandard(standard);

                if (ArrayParallelepipeds[i].Type == TypePiece.Left)
                {
                    IndexLeftPiece = i;
                    charact = ArrayParallelepipeds[i].Character;
                    standard.Character = charact;
                }
            }

            int CumulativeLength = ArrayParallelepipeds[IndexLeftPiece].LengthCharacter();

            string StandardLocation = "FBDULR";

            for (int i = 0; i < NumberParallelepiped; ++i)
            {
                string outstr = "";

                char front = StandardLocation[ArrayParallelepipeds[i].Displacement[0]];
                char lower = StandardLocation[ArrayParallelepipeds[i].Displacement[2]];

                outstr += front + " " + lower + " ";

                if (ArrayParallelepipeds[i].Type == TypePiece.Left)
                {
                    outstr += ArrayParallelepipeds[i].StrCoord(0);
                }

                if (ArrayParallelepipeds[i].Type == TypePiece.Right)
                {
                    outstr += ArrayParallelepipeds[i].StrCoord(standard.LengthCharacter() - ArrayParallelepipeds[i].LengthCharacter());
                }

                if (ArrayParallelepipeds[i].Type == TypePiece.Center)
                {
                    outstr += ArrayParallelepipeds[i].StrCoord(CumulativeLength);
                    CumulativeLength += ArrayParallelepipeds[i].LengthCharacter();
                }

                Console.WriteLine(outstr);
            }
        }