Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
function diamondSquare(matrix) {
let chunkSize = MATRIX_LENGTH - 1;
let randomFactor = RANDOM_INITIAL_RANGE;
while (chunkSize > 1) {
calculateSquare(matrix, chunkSize, randomFactor)
calculateDiamond(matrix, chunkSize, randomFactor)
chunkSize /= 2;
randomFactor /= 2;
}
return matrix;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment