Skip to content

Instantly share code, notes, and snippets.

@xphong
Created July 15, 2015 14:16
Show Gist options
  • Save xphong/05954bd2f8e3d26ac7ff to your computer and use it in GitHub Desktop.
Save xphong/05954bd2f8e3d26ac7ff to your computer and use it in GitHub Desktop.
// TODO: Add comments
var GRID_BASE = 8,
ySize = parseInt(scope.ysize),
xSize = parseInt(scope.xsize),
startPosition = parseInt(scope.startposition),
quadrantArea = [],
yStartPosition = Math.floor(startPosition / GRID_BASE),
xStartPosition = startPosition % GRID_BASE;
for (i = 0; i < ySize; i++) {
for (j = 0; j < xSize; j++) {
gridArea.push(GRID_BASE * (yStartPosition + i) + (xStartPosition + j));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment