Dragon curve: Difference between revisions
Dragon curve en FreeBASIC
(Dragon curve en Yabasic) |
(Dragon curve en FreeBASIC) |
||
Line 1,751:
The option to show Fōrmulæ programs and their results is showing images. Unfortunately images cannot be uploaded in Rosetta Code.
=={{header|FreeBASIC}}==
{{trans|BASIC}}
<lang freebasic>Const pi As Double = 4 * Atn(1)
Dim Shared As Double angulo = 0
Sub giro (grados As Double)
angulo += grados*pi/180
End Sub
Sub dragon (longitud As Double, division As Integer, d As Double)
If division = 0 Then
Line - Step (Cos(angulo)*longitud, Sin(angulo)*longitud), Int(Rnd * 7)
Else
giro d*45
dragon longitud/1.4142136, division-1, 1
giro -d*90
dragon longitud/1.4142136, division-1, -1
giro d*45
End If
End Sub
'--- Programa Principal ---
Screen 12
Pset (150,180), 0
dragon 400, 12, 1
Bsave "Dragon_curve_FreeBASIC.bmp",0
Sleep</lang>
=={{header|Gnuplot}}==
|