Last active
December 15, 2017 18:39
-
-
Save jmuzsik/7e82c273750bafb80586122330f4a195 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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