Microsoft Small Basic

Program Listing:
Embed this in your website
top: 'Original code by Math Man - Randomizing update by codingCat aka Matthew L. Parets for the 50 line challange
Amount = Math.GetRandomNumber(13) + 3
GraphicsWindow.KeyDown = pressed
done = "false"
GraphicsWindow.Clear()
GraphicsWindow.BackgroundColor = "Black"
GraphicsWindow.Top = -27
GraphicsWindow.Left = -5
GraphicsWindow.Width = Desktop.Width - 5
GraphicsWindow.Height = Desktop.Height - 50
total = 0
For i = 1 To Amount
  angle[i] = Math.GetRandomNumber(90)
  Dist[i] = Math.GetRandomNumber(Math.Round((GraphicsWindow.Height / 2) / Amount)-15) + 15
  total = total + Dist[i]
  Rate[i] = Math.GetRandomNumber(20) - 10
EndFor
Dist[Amount] = Dist[Amount] + ((GraphicsWindow.Height / 2) - total)
X[0] = GraphicsWindow.Width/2
Y[0] = GraphicsWindow.Height/2
For i = 1 To Amount
  X[i] = X[i-1]+Dist[i]*Math.Cos(Math.GetRadians(Angle[i]))
  Y[i] = Y[i-1]+Dist[i]*Math.Sin(Math.GetRadians(Angle[i]))
EndFor
X[Amount+1] = X[Amount]
Y[Amount+1] = Y[Amount]
While 1=1
  For i = 1 To Amount
    Shapes.Remove(Line[i])
    Angle[i] = Angle[i]+Rate[i]
    X[i] = X[i-1]+Dist[i]*Math.Cos(Math.GetRadians(Angle[i]))
    Y[i] = Y[i-1]+Dist[i]*Math.Sin(Math.GetRadians(Angle[i]))
    GraphicsWindow.PenColor = "Green"
    Line[i] = Shapes.AddLine(X[i-1],Y[i-1],X[i],Y[i])
  EndFor
  GraphicsWindow.PenColor = GraphicsWindow.GetRandomColor()
  GraphicsWindow.DrawLine(X[Amount],Y[Amount],X[Amount+1],Y[Amount+1])
  X[Amount+1] = X[Amount]
  Y[Amount+1] = Y[Amount]
  GraphicsWindow.DrawEllipse(X[Amount]-2.5,Y[Amount]-2.5,5,5)
  Program.Delay(20)
  If done = "true" Or Math.Remainder(Math.Round(Clock.ElapsedMilliseconds / 100),150) = 0  Then
    Goto top
  EndIf
EndWhile
Sub pressed
  If GraphicsWindow.LastKey = "Space" Then
    done = "true"
  EndIf
EndSub
Copyright (c) Microsoft Corporation. All rights reserved.