Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- maze.setStartPosition((maze.Rand(maze)));
- Position index=new Position(0,0,0);
- index=maze.getStartPosition();
- Viz.push(index);
- maze.ChngeMaze(index.getX(), index.getY(),index.getZ() ,0 );
- while(!Viz.isEmpty())
- {
- po=(PosibleMoves(maze, index));
- if(!po.isEmpty())
- {
- num=rnd.nextInt(po.size());
- index=po.get(num);
- maze.ChngeMaze(index.getX(), index.getY(),index.getZ() ,0 );
- Viz.push(index);
- }
- else
- {
- index=Viz.pop();
- }
- }
- maze.setGoalPosition((maze.Rand(maze)));
- while (maze.getPosetion(maze.getGoalPosition())==1 || maze.getStartPosition().equals(maze.getGoalPosition())) {
- maze.setGoalPosition((maze.Rand(maze)));
- }
- return maze;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement