Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Global Const $MAX = 10
- Dim $size[2] = [20, 20]
- Global $pointsNumber = Random(30, 40, 1)
- Dim $map[$size[0]][$size[1]]
- For $x = 0 To $size[0] - 1
- For $y = 0 To $size[1] - 1
- $map[$x][$y] = 0
- Next
- Next
- Dim $points[$pointsNumber][4]
- For $i = 0 To UBound($points) - 1
- $points[$i][0] = Random(0, $size[0] - 1, 1)
- $points[$i][1] = Random(0, $size[0] - 1, 1)
- $points[$i][2] = Random(-$MAX, $MAX, 1)
- $points[$i][3] = Random(-1, 0, 1)
- If $points[$i][3] == 0 Then $points[$i][3] += 1
- Next
- For $i = 0 To UBound($points) - 1
- For $r = $points[$i][2] To 0 Step -1
- For $kx = -$points[$i][2] + $r To $points[$i][2] - $r
- For $ky = -$points[$i][2] + $r To $points[$i][2] - $r
- If ($points[$i][0] + $kx) < 0 Or ($points[$i][0] + $kx) > $size[0] - 1 Then ContinueLoop
- If ($points[$i][1] + $ky) < 0 Or ($points[$i][1] + $ky) > $size[1] - 1 Then ContinueLoop
- If ($map[$points[$i][0] + $kx][$points[$i][1] + $ky] >= $MAX) And ($points[$i][3] > 0) Then ContinueLoop
- If ($map[$points[$i][0] + $kx][$points[$i][1] + $ky] <= -$MAX) And ($points[$i][3] < 0) Then ContinueLoop
- $map[$points[$i][0] + $kx][$points[$i][1] + $ky] += $points[$i][3]
- Next
- Next
- Next
- Next
- $output = FileOpen("output.hmap", 2)
- For $y = 0 To $size[1] - 1
- For $x = 0 To $size[0] - 1
- FileWrite($output, $map[$x][$y] & ",")
- Next
- FileWrite($output, @CRLF)
- Next
- FileClose($output)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement