32 lines
733 B
Plaintext
32 lines
733 B
Plaintext
Dim Shared As Ubyte colores(4) => {7,13,14,3,2}
|
|
|
|
Sub showTree(n As Integer, A As String)
|
|
Dim As Integer i, co = 0, b = 1, col
|
|
Dim As String cs = Left(A, 1)
|
|
|
|
If cs = "" Then Exit Sub
|
|
|
|
Select Case cs
|
|
Case "["
|
|
co += 1 : showTree(n + 1, Right(A, Len(A) - 1))
|
|
Exit Select
|
|
Case "]"
|
|
co -= 1 : showTree(n - 1, Right(A, Len(A) - 1))
|
|
Exit Select
|
|
Case Else
|
|
For i = 2 To n
|
|
Print " ";
|
|
co = n
|
|
Next i
|
|
Color colores(co) : Print !"\&hc0-"; cs
|
|
showTree(n, Right(A, Len(A) - 1))
|
|
Exit Select
|
|
End Select
|
|
End Sub
|
|
|
|
Cls
|
|
showTree(0, "[1[2[3][4[5][6]][7]][8[9]]]")
|
|
Print !"\n\n\n"
|
|
showTree(0, "[1[2[3[4]]][5[6][7[8][9]]]]")
|
|
Sleep
|