Skip to content

Commit 80522b6

Browse files
committed
fixes issue #159
1 parent ca974f2 commit 80522b6

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

src/main/js/plugins/drone/contrib/mazegen.js

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,17 @@
11
// Maze generation based on http://rosettacode.org/wiki/Maze_generation#JavaScript
22

33
var Drone = require('../drone').Drone;
4-
4+
// User-facing code starts here
5+
// Example: Try /js maze(5,7)
6+
Drone.extend( function maze( size_x, size_y ) {
7+
m = maze_make(size_x, size_y);
8+
if (m.x > 0 && m.y > 0) {
9+
maze_draw(maze_display(m), this);
10+
}
11+
} );
12+
//
13+
// Implementation
14+
//
515
function maze_make(x,y) {
616
var n=x*y-1;
717
if (n<0) {
@@ -96,12 +106,3 @@ function maze_draw(maze_string, d) {
96106
}
97107
}
98108
}
99-
function maze(size_x, size_y) {
100-
m = maze_make(size_x, size_y);
101-
if (m.x > 0 && m.y > 0) {
102-
maze_draw(maze_display(m), this);
103-
}
104-
}
105-
// User-facing code starts here
106-
// Example: Try /js amazing(5,7)
107-
Drone.extend(maze);

0 commit comments

Comments
 (0)