Last active
August 21, 2021 16:12
-
-
Save YonatanKra/d8ac5aa2664b934435492ccb434d30b0 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
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