Microsoft Small Basic

Program Listing:
Embed this in your website
GraphicsWindow.Width=500
GraphicsWindow.Height=500
GraphicsWindow.BackgroundColor="black"
rf=Controls.AddButton("refresh",0,475)
ok=Controls.AddButton("OK",470,475)
Controls.ButtonClicked=bttn
Sub bttn
  last=Controls.LastClickedButton
  If last=rf Then
    chart()
  EndIf
  If last=ok Then
    Controls.Remove(rf)
    Controls.Remove(ok)
  EndIf
EndSub
chart()
'This Part Made By WhTurner33,Thanks WhTurner33.
sub chart
  NN=4
  sum=0
  For i=1 To NN
    num[i]=50
    sum=sum+num[i]
  EndFor
  p2=Math.Pi/50
  GraphicsWindow.FontSize=20
  For i=1 To NN
    pct[i]=Math.Round(1000*num[i]/sum)/10
  EndFor
  alf=0
  For i=1 To NN
    alfh=alf+p2*pct[i]/2
    alfa=alf+p2*pct[i]
    o=Math.GetRandomNumber(8)
    If o>0 And o<3 Then
      GraphicsWindow.PenColor="red"
    EndIf
    If o>2 And o<5 Then
      GraphicsWindow.PenColor="yellow"
    EndIf
    If o>4 And o<7 Then
      GraphicsWindow.PenColor="blue"
    EndIf
    If o>6 And o<9 Then
      GraphicsWindow.PenColor="green"
    EndIf
    GraphicsWindow.BrushColor="red"
    For j=alf To alfa Step 0.01
      sline=Math.Sin(j)
      cline=Math.cos(j)
      GraphicsWindow.DrawLine(225,225,225+125*sline,225+125*cline)
    EndFor
    ss=Math.Sin(alf)
    cc=Math.Cos(alf)
    s2=Math.Sin(alfh)
    c2=Math.Cos(alfh)
    GraphicsWindow.PenColor="black"
    GraphicsWindow.DrawLine(225,225,225+125*ss,225+125*cc)

    alf=alfa
  EndFor
  GraphicsWindow.DrawLine(225,225,225,350)
  GraphicsWindow.DrawEllipse(100,100,250,250)
EndSub
Copyright (c) Microsoft Corporation. All rights reserved.