Skip to content

Instantly share code, notes, and snippets.

View christophermina's full-sized avatar

Christopher Mina christophermina

  • CMConsulting LLC
  • Boulder, CO
View GitHub Profile
@christophermina
christophermina / MazeHasExit.js
Last active December 27, 2015 08:08
Given some parameters to create a maze out of a grid of 0's and 1's, determines if we can get from a start point to an exit.
/**
* The purpose of this is to randomly generate a grid of preset height and width (dimensionX, dimensionY)
* with each cell either a 0 or a 1. There is a randomly assigned start and exit position, and you must
* determine if, by following a trail of contiguous ones in the up, down, left, right positions, you can
* get from the start to the exit.
*
* Assumptions:
* 1. the start coordinates fall within valid grid
* 2. You can only move up, down, left, right
* 3. You cannot jump a 0.