Skip to content

Instantly share code, notes, and snippets.

@jmuzsik
Last active December 15, 2017 18:39
Show Gist options
  • Save jmuzsik/7e82c273750bafb80586122330f4a195 to your computer and use it in GitHub Desktop.
Save jmuzsik/7e82c273750bafb80586122330f4a195 to your computer and use it in GitHub Desktop.
findExit(clone, maze) {
//go to a random location that is not where the clone is
if( maze.location.next.length === 3 ) {
let currentLocation = clone.direction( maze.location.next[
Math.floor(Math.random()*3)]
) )
} //...more if's, etc.
if( currentLocation === maze.location.final ) {
return theMeaningOfLife
}
}
const clones = [/*so many clones*/], maze = createMaze()
clones.forEach( ( clone, i ) => {
if(i % 2 === 0) life.setTimeout( findExit( clone, maze ), 1)
else findExit( clone, maze )
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment