Maze generation: Difference between revisions

Content added Content deleted
Line 1,050: Line 1,050:
// draw the north edge
// draw the north edge
for (int j = 0; j < x; j++) {
for (int j = 0; j < x; j++) {
System.out.print(((maze[j][i] & 1) == 0) ? "+--" : "+ ");
System.out.print(((maze[j][i] & 1) == 0) ? "+---" : "+ ");
}
}
System.out.println("+");
System.out.println("+");
// draw the west edge
// draw the west edge
for (int j = 0; j < x; j++) {
for (int j = 0; j < x; j++) {
System.out.print(String.format("%s ",
System.out.print(String.format("%s ",
((maze[j][i] & 8) == 0 ? "|" : " "), maze[j][i]));
((maze[j][i] & 8) == 0 ? "|" : " "), maze[j][i]));
}
}
Line 1,062: Line 1,062:
// draw the bottom line
// draw the bottom line
for (int j = 0; j < x; j++) {
for (int j = 0; j < x; j++) {
System.out.print("+--");
System.out.print("+---");
}
}
System.out.println("+");
System.out.println("+");
Line 1,126: Line 1,126:
</lang>
</lang>
<lang>
<lang>
+--+--+--+--+--+--+--+--+--+--+
+---+---+---+---+---+---+---+---+---+---+
| | | | |
| | | |
+ + + + +--+ +--+ + + +
+ +---+---+ +---+---+ + + +---+
| | | | | | | |
| | | | | | |
+--+--+--+--+ +--+ +--+ + +
+---+---+ + + + +---+ +---+ +
| | | |
| | | | | | |
+ +--+ +--+ +--+--+--+--+ +
+ +---+---+ +---+ + +---+ + +
| | | | |
| | | | | | |
+--+ +--+ +--+ +--+--+--+--+
+ + + +---+ +---+---+---+ + +
| | | | | |
| | | | | |
+ + + +--+--+--+--+--+ + +
+ + +---+ + +---+---+ +---+---+
| | | | | |
| | | | | | |
+ +--+--+--+--+ + + + + +
+ +---+ + +---+ +---+---+ + +
| | | | | | |
| | | | | |
+ +--+--+ + +--+--+ +--+ +
+---+ + +---+ + +---+---+---+ +
| | | |
| | | | | | |
+ +--+--+--+--+--+ +--+--+ +
+ + +---+ + +---+---+ +---+ +
| | | | | |
| | | | | | | |
+ +--+--+ + +--+--+ + + +
+ +---+ + +---+---+ + + + +
| | | |
| | | |
+--+--+--+--+--+--+--+--+--+--+
+---+---+---+---+---+---+---+---+---+---+
</lang>
</lang>