-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMazeGame.java
More file actions
32 lines (23 loc) · 880 Bytes
/
Copy pathMazeGame.java
File metadata and controls
32 lines (23 loc) · 880 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package creational.builder;
import domain.Maze;
public class MazeGame {
public void CreateMaze() {
// standard builder
MazeBuilder mazeBuilder = new StandardMazeBuilder();
mazeBuilder.BuildMaze();
mazeBuilder.BuildRoom();
mazeBuilder.BuildRoom();
mazeBuilder.BuildRoom();
mazeBuilder.BuildDoor();
final Maze createdMaze = mazeBuilder.GetMaze();
// counting builder
CountingMazeBuilder countingMazeBuilder = new CountingMazeBuilder();
countingMazeBuilder.BuildMaze();
countingMazeBuilder.BuildDoor();
countingMazeBuilder.BuildDoor();
countingMazeBuilder.BuildDoor();
countingMazeBuilder.BuildRoom();
final int numberOfDoors = countingMazeBuilder.GetDoorCount();
final int numberOfRooms = countingMazeBuilder.GetRoomCount();
}
}