Пример #1
0
        private static void testMeze3dGenerator(MyMaze3dGenerator mg)
        {
            ArrayList s = new ArrayList();

            s.Add(20);
            s.Add(20);
            s.Add(4);

            Console.WriteLine(mg.MeasureAlgorithmTime(s));
            AMaze    maze  = mg.generate(s);
            Position start = maze.getStartPosition();

            start.print();
            maze.getGoalPosition().print();
            maze.Print();
            byte[]      dar  = (maze as Maze3d).toByteArray();
            Maze3d      hara = new Maze3d(dar);
            ICompressor car  = new MyMaze3DCompressor();

            byte[] hara1 = car.compress(dar);
            byte[] hara2 = car.decompress(hara1);
            Maze3d hara3 = new Maze3d(hara2);

            hara3.Print();


            /*using (FileStream fileOutStream = new FileStream("1.maze", FileMode.Create))
             * {
             *  using (Stream outStream = new MyCompressorStream(fileOutStream, 1))
             *  {
             *      outStream.Write((maze as Maze3d).toByteArray(),0,1);
             *      outStream.Flush();
             *  }
             * }
             * byte[] mazeBytes;
             * using (FileStream fileInStream = new FileStream("1.maze", FileMode.Open))
             * {
             *  using (Stream inStream = new MyCompressorStream(fileInStream,1))
             *  {
             *      mazeBytes = new byte[(maze as Maze3d).toByteArray().Count()];
             *      input.read(b);
             *  }
             * }
             * Maze3d loadedMaze = new Maze3d(mazeBytes);
             * System.out.println(loaded.equals(maze));*/



            Console.ReadKey();
        }