Terrain Generator in JavaScript