コード例 #1
0
        Cube2 PrepareCubeAndPrint()
        {
            var cube = new Cube2();

            cube.Rotate("a1", 1);
            cube.Rotate("b1", 1);
            cube.Rotate("c1", 1);
            Console.WriteLine(cube.ToStringWithPieces());
            return(cube);
        }
コード例 #2
0
        void PrintSolution(List <List <string> > result, Cube2 cube)
        {
            if (result != null && result.Count > 0)
            {
                result.Sort((x, y) => x.Count.CompareTo(y.Count));
                Console.WriteLine($"Paths found: {result.Count}");
                Console.WriteLine();
                for (int i = 0; i < result[0].Count; i++)
                {
                    Console.Write((i > 0 ? ", " : "") + (i + 1) + ". " + result[0][i]);
                }
                Console.WriteLine();
                Console.WriteLine();
                cube.Rotate(result[0]);

                Console.WriteLine(cube.ToStringWithPieces());
            }
            else
            {
                Console.WriteLine("No moves found :(");
            }
        }