-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathclient.ts
More file actions
22 lines (20 loc) · 791 Bytes
/
client.ts
File metadata and controls
22 lines (20 loc) · 791 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import {Maze,IMaze} from './maze'
import {IMazeElementFactory} from './factory'
import Direction from './direction';
export function makeMaze(theFactory: IMazeElementFactory): IMaze {
let theMaze = new Maze();
let r1 = theFactory.makeRoom()
let r2 = theFactory.makeRoom()
let theDoor = theFactory.makeDoor(r1, r2);
theMaze.addRoom(r1);
theMaze.addRoom(r2);
r1.setSide(Direction.North, theFactory.makeWall());
r1.setSide(Direction.East, theDoor);
r1.setSide(Direction.South, theFactory.makeWall());
r1.setSide(Direction.West, theFactory.makeWall());
r2.setSide(Direction.North, theFactory.makeWall());
r2.setSide(Direction.East, theFactory.makeWall());
r2.setSide(Direction.South, theFactory.makeWall());
r2.setSide(Direction.West, theDoor);
return theMaze;
}