JavaScript terrain generator