ChatGPT is getting better and better. It helped me break down my 4 section grid one from my other thread and just make 1 section but with many mountains. This one is also a lot easier to learn by. Press the Space Bar for more random designs.
![[Image: Many-Mountains-Grid-by-Sierra-Ken-and-Chat-GPT.png]](https://i.ibb.co/S7yCQ4H1/Many-Mountains-Grid-by-Sierra-Ken-and-Chat-GPT.png)
![[Image: Many-Mountains-Grid-by-Sierra-Ken-and-Chat-GPT.png]](https://i.ibb.co/S7yCQ4H1/Many-Mountains-Grid-by-Sierra-Ken-and-Chat-GPT.png)
Code: (Select All)
_Title "Many Mountains - by SierraKen and ChatGPT - Press Space Bar For More - Esc to quit"
Cls
Screen _NewImage(800, 600, 32)
Do
' === Initialize arrays for mountains and indentations ===
Dim XA(20), YA(20), ZA(20) ' Mountains
Dim XB(20), YB(20), ZB(20) ' Indentations
' === Generate 20 indentions ===
For I = 0 To 19
XA(I) = Rnd * 80
YA(I) = Rnd * 40
ZA(I) = Rnd * 20 + 10 ' height
Next
' === Generate 20 mountains ===
For I = 0 To 19
XB(I) = Rnd * 80
YB(I) = Rnd * 40
ZB(I) = Rnd * -20 - 10 ' depth (negative)
Next
' === Draw grid lines horizontally ===
For Y = 0 To 40
For X = 0 To 80
T = X
GoSub calculations
Next
Next
' === Draw grid lines vertically ===
For X = 0 To 80
For Y = 0 To 40
T = Y
GoSub calculations
Next
Next
Do
a$ = InKey$
If a$ = Chr$(27) Then End
Loop Until a$ = " "
Cls
Loop
End
calculations:
XNEW = X * 20 + 10 * Y - 300 ' Perspective X
' === Calculate cumulative height adjustment ===
ZTotal = 0
' Indentions
For I = 0 To 19
L = Sqr((XA(I) - X) ^ 2 + (YA(I) - Y) ^ 2) + 1
ZTotal = ZTotal + ZA(I) / L
Next
' Mountains
For I = 0 To 19
L2 = Sqr((XB(I) - X) ^ 2 + (YB(I) - Y) ^ 2) + 1
ZTotal = ZTotal + ZB(I) / L2
Next
YNEW = 200 - Y * 5 - 10 * ZTotal + 300 ' Perspective Y
If T > 0 Then Line (XOLD, YOLD)-(XNEW, YNEW), _RGB32(0, 255, 0)
XOLD = XNEW: YOLD = YNEW
Return


![[Image: Many-Mountains-2-Grid-by-Sierra-Ken-and-Chat-GPT.png]](https://i.ibb.co/B76GXGm/Many-Mountains-2-Grid-by-Sierra-Ken-and-Chat-GPT.png)
![[Image: Forest-4.jpg]](https://i.ibb.co/6zFRsjw/Forest-4.jpg)