Skip to content

Commit

Permalink
fixes issue #159
Browse files Browse the repository at this point in the history
  • Loading branch information
walterhiggins committed Nov 9, 2014
1 parent ca974f2 commit 80522b6
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions src/main/js/plugins/drone/contrib/mazegen.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
// Maze generation based on http://rosettacode.org/wiki/Maze_generation#JavaScript

var Drone = require('../drone').Drone;

// User-facing code starts here
// Example: Try /js maze(5,7)
Drone.extend( function maze( size_x, size_y ) {
m = maze_make(size_x, size_y);
if (m.x > 0 && m.y > 0) {
maze_draw(maze_display(m), this);
}
} );
//
// Implementation
//
function maze_make(x,y) {
var n=x*y-1;
if (n<0) {
Expand Down Expand Up @@ -96,12 +106,3 @@ function maze_draw(maze_string, d) {
}
}
}
function maze(size_x, size_y) {
m = maze_make(size_x, size_y);
if (m.x > 0 && m.y > 0) {
maze_draw(maze_display(m), this);
}
}
// User-facing code starts here
// Example: Try /js amazing(5,7)
Drone.extend(maze);

0 comments on commit 80522b6

Please sign in to comment.