Microsoft Small Basic

Program Listing:
Embed this in your website
' Easy maze game All shape version By NaochanON
' Use Right Left Up Down keys
GraphicsWindow.KeyDown=onkeydown
GUI()

Sub onkeydown
  If NN<starnumber Then
    KeyNo=text.GetCharactercode(GraphicsWindow.LastKey)                 ' Left:76 Right:82 Down:68 Up:85
    target=playerpos+dxx[KeyNo]+(MM+2)*dyy[KeyNo]                       ' MM chrs +chr(10)
    if text.GetSubText(a,target,1)<>stars[2] Then                       ' 2= ■ check
      if text.GetSubText(a,target,1)=stars[3]   Then                    ' 3 ☆ check
        NN=NN+1                                                         ' count gotten stars
      EndIf
      c=Text.GetSubText(a,1,playerpos-1)+stars[1]+Text.GetSubTextToEnd(a,playerpos+1)
      a=Text.GetSubText(c,1,target-1)+stars[4]+Text.GetSubTextToEnd(c,target+1)
      playerpos=target
      Shapes.SetText(base,a)
      Shapes.Move(base,Shapes.GetLeft(base)-SZ*dxx[KeyNo],Shapes.GetTop(base)-SZ*dyy[KeyNo]) ' move to new position
    endif
    msg="There are "+starnumber+" stars. You've gotten "+NN +" stars. row= "
    GraphicsWindow.Title=msg+Math.Ceiling(target/(MM+2))+"/"+MM+" column ="+(target-(MM+2)*Math.Floor(target/(MM+2)))+"/"+MM
  Else
    GraphicsWindow.BrushColor="red"
    GraphicsWindow.DrawText(100,5," Finished !!!!!!!!!!!!!! " )
    Sound.PlayBellRingAndWait()
  endif
EndSub

Sub GUI
  SZ=25
  MM=75
  GraphicsWindow.FontSize=SZ
  GraphicsWindow.Width=sz*40
  GraphicsWindow.Height=SZ*25
  stars="1=・;2=■;3=☆;4="+text.GetCharacter(2*16*16*16+6*16*16+12*16+4)
  For i=1 To MM*MM
    NMB= 1+Math.Floor(1/Math.GetRandomNumber(6))+Math.Floor(1/Math.GetRandomNumber(75))
    a=a+stars[NMB]
    If Math.Remainder(i,MM)=0 and i<MM*MM Then
      a=a+text.GetCharacter(13)+text.GetCharacter(10)                  'text.GetCharacter(13)+
    ElseIf i=20*MM+30-1 then                     '
      a=a+stars[4]                               ' Player position is X=30 Y=20
      PlayerPos=20*(MM+2)+30
    elseif NMB=3 then
      starnumber=starnumber+1                    ' count star
    endif
  EndFor
  GraphicsWindow.Show()
  GraphicsWindow.Title="There are "+starnumber+" stars. You've gotten stars."
  base=shapes.AddText(a)
  Shapes.Move(base,-10*SZ,-10*SZ)
  dxx="68=0;76=-1;82=1;85=0"                     ' Left:76 Right:82 Down:68 Up:85
  dYY="68=1;76=0;82=0;85=-1"                     ' if arrow key pressed
EndSub
Copyright (c) Microsoft Corporation. All rights reserved.