Random maze generator in Javascript