Beispiel #1
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="maze3d"></param>
        public SearchableMaze3D(AMaze maze3d)
        {
            m_maze3d = (Maze3d)maze3d;
            Position3D statrPosition = (Position3D)maze3d.getStartPosition();

            m_initialState = new MazeState(null, statrPosition.Col, statrPosition.Row, statrPosition.Level);
            Position3D goalPosition = (Position3D)maze3d.getGoalPosition();

            m_goalState = new MazeState(null, goalPosition.Col, goalPosition.Row, goalPosition.Level);
        }
Beispiel #2
0
        private static void testMaze3dGenerator(IMazeGenerator generator)
        {
            int[] size3D = { 3, 13, 17 }; // (z,y,x)
            Console.WriteLine(generator.geasureAlgorithmTime(size3D));
            AMaze     maze  = generator.generate(size3D);
            APosition start = maze.getStartPosition();

            start.print();
            maze.getGoalPosition().print();
            maze.print();
        }
Beispiel #3
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();
        }
Beispiel #4
0
        private static void testMaze2dGenerator(SimpleMaze2dGenerator mg)
        {
            ArrayList sizes = new ArrayList();

            sizes.Add(30);
            sizes.Add(30);

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

            start.print();
            maze.getGoalPosition().print();
            maze.Print();

            Console.ReadKey();
        }