MCPcopy Create free account
hub / github.com/Vishal-raj-1/Awesome-JavaScript-Projects / Maze

Function Maze

assets/js/maze.js:48–211  ·  view source on GitHub ↗
(Width, Height)

Source from the content-addressed store, hash-verified

46}
47
48function Maze(Width, Height) {
49 var mazeMap;
50 var width = Width;
51 var height = Height;
52 var startCoord, endCoord;
53 var dirs = ["n", "s", "e", "w"];
54 var modDir = {
55 n: {
56 y: -1,
57 x: 0,
58 o: "s"
59 },
60 s: {
61 y: 1,
62 x: 0,
63 o: "n"
64 },
65 e: {
66 y: 0,
67 x: 1,
68 o: "w"
69 },
70 w: {
71 y: 0,
72 x: -1,
73 o: "e"
74 }
75 };
76
77 this.map = function () {
78 return mazeMap;
79 };
80 this.startCoord = function () {
81 return startCoord;
82 };
83 this.endCoord = function () {
84 return endCoord;
85 };
86
87 function genMap() {
88 mazeMap = new Array(height);
89 for (y = 0; y < height; y++) {
90 mazeMap[y] = new Array(width);
91 for (x = 0; x < width; ++x) {
92 mazeMap[y][x] = {
93 n: false,
94 s: false,
95 e: false,
96 w: false,
97 visited: false,
98 priorPos: null
99 };
100 }
101 }
102 }
103
104 function defineMaze() {
105 var isComp = false;

Callers

nothing calls this directly

Calls 3

genMapFunction · 0.85
defineStartEndFunction · 0.85
defineMazeFunction · 0.85

Tested by

no test coverage detected