

Task
Produce a graphical or ASCII-art representation of a Hilbert curve of at least order 3.

 
Dim Shared As Integer ancho = 64
 
Sub Hilbert(x As Integer, y As Integer, lg As Integer, i1 As Integer, i2 As Integer)
    If lg = 1 Then
        Line - ((ancho-x) * 10, (ancho-y) * 10)
        Return
    End If
    lg = lg / 2
    Hilbert(x+i1*lg, y+i1*lg, lg, i1, 1-i2)
    Hilbert(x+i2*lg, y+(1-i2)*lg, lg, i1, i2)
    Hilbert(x+(1-i1)*lg, y+(1-i1)*lg, lg, i1, i2)
    Hilbert(x+(1-i2)*lg, y+i2*lg, lg, 1-i1, i2)
End Sub
 
Screenres 655, 655
 
Hilbert(0, 0, ancho, 0, 0)
End
 