Skip to content

Instantly share code, notes, and snippets.

@videlais

videlais/maze.js Secret

Last active Jan 2, 2016
Embed
What would you like to do?
var x = 1;
var y = 1;
$posx = 1;
$posy = 1;
macros['navigate'] =
{
handler: function(obj, fnc, val)
{
x = $posx; y = $posy;
if(maze[y-1][x] eq 1) {
$North = 1;
} else if(maze[x][y+1] eq 2) {
$Exit = 1;
} else {
$North = 0;
}
if(maze[y+1][x] eq 1) {
$South = 1;
} else if(maze[x][y-1] eq 2) {
$Exit = 1;
} else {
$South = 0;
}
if(maze[y][x-1] eq 1) {
$West = 1;
} else if(maze[x-1][y] eq 2) {
$Exit = 1;
} else {
$West = 0;
}
if(maze[y][x+1] eq 1) {
$East = 1;
} else if(maze[x+1][y] eq 2) {
$Exit = 1;
} else {
$East = 0;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment