<?xml version="1.0"?><?xml-stylesheet type="text/xsl" href="http://code.msdn.microsoft.com/rss.xsl"?><rss version="2.0"><channel><title>Small Basic</title><link>http://code.msdn.microsoft.com/smallbasic/Project/ProjectRss.aspx</link><description>Share code, ideas, tips, suggestions, etc. relating to Microsoft Small Basic&amp;#33;</description><item><title>NEW POST: How to keep track of projects</title><link>http://code.msdn.microsoft.com/smallbasic/Thread/View.aspx?ThreadId=1868</link><description>&lt;div class="wikidoc"&gt;
I was testing out the software and inadertently posted some broken code. What's worse, I accidentally posted it twice and didn't keep track of the program id's (it generated two separate program id's). Is there some way to make the code that you write &amp;quot;sticky&amp;quot; (ie retrievable by coder's name), in case the end user loses track of a program list (said possibility being likely in that no user is ever infallible and may accidentally fold, mutilate,spindle or otherwise just misplace their list of programs)? Additionally, will there be a release of small basic in the foreseeable future with a full menu bar and additional coding resources built in for amateurs such as myself? I personally would enjoy a bit more guidance, and judging from the scant few other posts already current upon this discussion board, it seems that others could also benefit from such an enriched programming interface.&lt;br /&gt;
&lt;/div&gt;</description><author>frank_in_wi</author><pubDate>Fri, 12 Jun 2009 01:20:34 GMT</pubDate><guid isPermaLink="false">NEW POST: How to keep track of projects 20090612A</guid></item><item><title>COMMENTED ISSUE: New Version Broken</title><link>http://code.msdn.microsoft.com/smallbasic/WorkItem/View.aspx?WorkItemId=1</link><description>I just downloaded and installed v .4 from the website. I tried to run it from the Quick Launch shortcut, the menu shortcut and Program Files. The first time I tried to run it I got an error message stating that the parameter was incorrect. Every other time I try to run it, I get the splash screen and then nothing. Is there a problem with the new version&amp;#63;&lt;br /&gt;Comments: I found out how to fix the problem. I just deleted the folder from Program Files and reinstalled the program. Now it runs fine&amp;#33;</description><author>ga6939russell</author><pubDate>Thu, 16 Apr 2009 23:07:01 GMT</pubDate><guid isPermaLink="false">COMMENTED ISSUE: New Version Broken 20090416P</guid></item><item><title>CREATED ISSUE: New Version Broken</title><link>http://code.msdn.microsoft.com/smallbasic/WorkItem/View.aspx?WorkItemId=1</link><description>I just downloaded and installed v .4 from the website. I tried to run it from the Quick Launch shortcut, the menu shortcut and Program Files. The first time I tried to run it I got an error message stating that the parameter was incorrect. Every other time I try to run it, I get the splash screen and then nothing. Is there a problem with the new version&amp;#63;&lt;br /&gt;</description><author>ga6939russell</author><pubDate>Thu, 16 Apr 2009 22:09:24 GMT</pubDate><guid isPermaLink="false">CREATED ISSUE: New Version Broken 20090416P</guid></item><item><title>NEW POST: Missing Command - Keyboard events</title><link>http://code.msdn.microsoft.com/smallbasic/Thread/View.aspx?ThreadId=1464</link><description>&lt;div class="wikidoc"&gt;
Sorry, found the command. Thanks whoever wrote this. It is very good.&lt;br /&gt;
&lt;/div&gt;</description><author>SuperNewb</author><pubDate>Sun, 22 Mar 2009 02:08:17 GMT</pubDate><guid isPermaLink="false">NEW POST: Missing Command - Keyboard events 20090322A</guid></item><item><title>NEW POST: Portability</title><link>http://code.msdn.microsoft.com/smallbasic/Thread/View.aspx?ThreadId=1468</link><description>&lt;div class="wikidoc"&gt;
How come I can't run Small Basic on my other computer? My copy of Small Basic is saved to a flash drive.&lt;br /&gt;
&lt;/div&gt;</description><author>bobjacques</author><pubDate>Fri, 20 Mar 2009 20:14:44 GMT</pubDate><guid isPermaLink="false">NEW POST: Portability 20090320P</guid></item><item><title>NEW POST: Missing Command - Keyboard events</title><link>http://code.msdn.microsoft.com/smallbasic/Thread/View.aspx?ThreadId=1464</link><description>&lt;div class="wikidoc"&gt;
Small Basic has mouse click events but no keyboard events - you can read text but you can't trigger something by pressing a key, at least as far as I could find (The manual's unfinished and I can't find a command list anywhere.) Can someone clear this up or is it really not possible?&lt;br /&gt;
&lt;/div&gt;</description><author>SuperNewb</author><pubDate>Thu, 19 Mar 2009 05:24:47 GMT</pubDate><guid isPermaLink="false">NEW POST: Missing Command - Keyboard events 20090319A</guid></item><item><title>NEW POST: Programming Basics</title><link>http://code.msdn.microsoft.com/smallbasic/Thread/View.aspx?ThreadId=1391</link><description>&lt;div class="wikidoc"&gt;
In Small Baisc - How does one:&lt;br /&gt;- Compile a program (Small Basic)&lt;br /&gt;- Create an &amp;quot;implementation package&amp;quot; that will allow for the distribution and the program to be installed on another computer and run as a program ( exe)?&lt;br /&gt;- Create and access data (files)?&lt;br /&gt;- Print data / pictures / documents?&lt;br /&gt; &lt;br /&gt;Is it possible (like in the old basic language) to:&lt;br /&gt;- Create a &amp;quot;R&amp;quot;andom access flat file and use it to store data?&lt;br /&gt;- Create &amp;quot;Forms&amp;quot; for data input&lt;br /&gt;
&lt;/div&gt;</description><author>HennieG</author><pubDate>Sat, 28 Feb 2009 06:48:57 GMT</pubDate><guid isPermaLink="false">NEW POST: Programming Basics 20090228A</guid></item><item><title>UPDATED WIKI: Updates for the next release</title><link>http://code.msdn.microsoft.com/smallbasic/Wiki/View.aspx?title=Updates for the next release&amp;version=4</link><description>&lt;div class="wikidoc"&gt;
&lt;h2&gt;
Planned updates for the Christmas 08 release.
&lt;/h2&gt;&lt;h3&gt;
Bug fixes
&lt;/h3&gt;&lt;ul&gt;
&lt;li&gt;Tons of IDE crashes have been fixed.  &lt;/li&gt;&lt;li&gt;The compiler is now locale invariant, which means, Small Basic programs will work across all input locales.&lt;/li&gt;
&lt;/ul&gt; &lt;br /&gt;&lt;h3&gt;
Language/Editor updates
&lt;/h3&gt;&lt;ul&gt;
&lt;li&gt;Parentheses for conditional expressions are not required anymore.  For example, the following fragment of code is now legal:&lt;/li&gt;
&lt;/ul&gt;&lt;pre&gt;
While input &amp;lt; 30
  TextWindow.WriteLine(&amp;quot;Too low&amp;quot;)
  input = TextWindow.ReadNumber()
EndWhile
&lt;/pre&gt;&lt;ul&gt;
&lt;li&gt;ElseIf.  It's now possible to chain If..Then conditions.&lt;/li&gt;
&lt;/ul&gt;&lt;pre&gt;
If input &amp;gt; 20 Then
  TextWindow.WriteLine(&amp;quot;Too High&amp;quot;)
ElseIf input &amp;lt; 10 Then
  TextWindow.WriteLine(&amp;quot;Too Low&amp;quot;)
Else
  TextWindow.WriteLine(&amp;quot;Just Right&amp;quot;)
EndIf
&lt;/pre&gt;&lt;ul&gt;
&lt;li&gt;Support for in-line comments.&lt;/li&gt;
&lt;/ul&gt;&lt;pre&gt;
poly = x * x * a + x * b + c 'Evaluates the polynomial
&lt;/pre&gt;&lt;ul&gt;
&lt;li&gt;Auto-indent feature for the editor.  The editor automatically indents the next line for you!&lt;/li&gt;&lt;li&gt;Negative Step Value in For..EndFor.  In fact, the compiler now supports variable Step Value.&lt;/li&gt;
&lt;/ul&gt;&lt;pre&gt;
s = -100
For i = 10000 To 1 Step s
  s = s + 1
  TextWindow.WriteLine(i)
EndFor
&lt;/pre&gt; &lt;br /&gt;&lt;h3&gt;
Library Updates
&lt;/h3&gt;&lt;h4&gt;
Array
&lt;/h4&gt;&lt;ul&gt;
&lt;li&gt;GetItemCount: &lt;i&gt;Gets the total count of items in an array&lt;/i&gt;&lt;/li&gt;&lt;li&gt;ContainsIndex: &lt;i&gt;Gets whether or not the given array contains the specified index&lt;/i&gt;&lt;/li&gt;&lt;li&gt;ContainsValue: &lt;i&gt;Gets whether or not the given array contains the specified value&lt;/i&gt;&lt;/li&gt;&lt;li&gt;RemoveValue: &lt;i&gt;Removes an item from the array given an index&lt;/i&gt; &lt;/li&gt;
&lt;/ul&gt; &lt;br /&gt;&lt;h4&gt;
Desktop
&lt;/h4&gt;&lt;ul&gt;
&lt;li&gt;Screen Dimensions&lt;/li&gt;
&lt;/ul&gt; &lt;br /&gt;&lt;h4&gt;
File
&lt;/h4&gt;&lt;ul&gt;
&lt;li&gt;CreateDirectory&lt;/li&gt;&lt;li&gt;DeleteFile&lt;/li&gt;&lt;li&gt;GetFiles: &lt;i&gt;Gets the list of files in a specified directory&lt;/i&gt;&lt;/li&gt;&lt;li&gt;GetDirectories: &lt;i&gt;Gets the list of subdirectories in a specified directory&lt;/i&gt;&lt;/li&gt;&lt;li&gt;WriteContents: &lt;i&gt;Now works even if the file doesn't already exist&lt;/i&gt;&lt;/li&gt;
&lt;/ul&gt; &lt;br /&gt;&lt;h4&gt;
GraphicsWindow
&lt;/h4&gt;&lt;ul&gt;
&lt;li&gt;Tons of performance improvements.  Much fewer UI thread transitions.&lt;/li&gt;&lt;li&gt;Bug fixes for setting Width/Height.&lt;/li&gt;&lt;li&gt;Hide no longer crashes.&lt;/li&gt;&lt;li&gt;AddTriangle&lt;/li&gt;&lt;li&gt;DrawTriangle&lt;/li&gt;&lt;li&gt;FillTriangle&lt;/li&gt;&lt;li&gt;RotateShape&lt;/li&gt;&lt;li&gt;CanResize: &lt;i&gt;You can now choose whether the Graphics Window should be resizable&lt;/i&gt;&lt;/li&gt;&lt;li&gt;Left/Top: &lt;i&gt;You can now set the position of the Graphics Window, on the screen&lt;/i&gt;&lt;/li&gt;&lt;li&gt;GetColorFromRGB: &lt;i&gt;You can now supply R, G, B component values and get a color to use&lt;/i&gt;&lt;/li&gt;
&lt;/ul&gt; &lt;br /&gt;&lt;h4&gt;
Math
&lt;/h4&gt;&lt;ul&gt;
&lt;li&gt;Power: &lt;i&gt;Exponent&lt;/i&gt;&lt;/li&gt;
&lt;/ul&gt; &lt;br /&gt;&lt;h4&gt;
Program
&lt;/h4&gt;&lt;ul&gt;
&lt;li&gt;End now exits the application - regardless of what other operations are running&lt;/li&gt;&lt;li&gt;GetProgramDirectory: &lt;i&gt;Gets the directory of the executing program&lt;/i&gt;&lt;/li&gt;
&lt;/ul&gt; &lt;br /&gt;&lt;h4&gt;
Text
&lt;/h4&gt;&lt;ul&gt;
&lt;li&gt;Append: &lt;i&gt;Always treats input arguments as text and returns an appended result.  Helpful when you're unsure if the input is text or number&lt;/i&gt;&lt;/li&gt;&lt;li&gt;GetCharacter: &lt;i&gt;Given a unicode character code, returns the corresponding unicode character&lt;/i&gt;&lt;/li&gt;&lt;li&gt;GetCharacterCode: &lt;i&gt;Given a unicode character, returns the character code&lt;/i&gt;&lt;/li&gt;
&lt;/ul&gt; &lt;br /&gt;&lt;h4&gt;
TextWindow
&lt;/h4&gt;&lt;ul&gt;
&lt;li&gt;Clear&lt;/li&gt;&lt;li&gt;Left/Top: &lt;i&gt;You can now set the position of the text window on screen&lt;/i&gt;&lt;/li&gt;
&lt;/ul&gt; &lt;br /&gt;&lt;h4&gt;
Turtle
&lt;/h4&gt;&lt;ul&gt;
&lt;li&gt;Angle: &lt;i&gt;You can now get or set the absolute angle of the turtle&lt;/i&gt;&lt;/li&gt;&lt;li&gt;X/Y: &lt;i&gt;You can now get or set the position of the turtle on screen&lt;/i&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;</description><author>Vijaye</author><pubDate>Sat, 13 Dec 2008 10:39:15 GMT</pubDate><guid isPermaLink="false">UPDATED WIKI: Updates for the next release 20081213A</guid></item><item><title>NEW POST: Sleep functionality</title><link>http://code.msdn.microsoft.com/smallbasic/Thread/View.aspx?ThreadId=1019</link><description>&lt;div class="wikidoc"&gt;
I think you are looking for &lt;br /&gt;   Program.Delay(milliseconds)&lt;br /&gt;
&lt;/div&gt;</description><author>robfoulk</author><pubDate>Mon, 01 Dec 2008 01:56:11 GMT</pubDate><guid isPermaLink="false">NEW POST: Sleep functionality 20081201A</guid></item><item><title>NEW POST: Can I host the workspace on Web?</title><link>http://code.msdn.microsoft.com/smallbasic/Thread/View.aspx?ThreadId=1020</link><description>&lt;div class="wikidoc"&gt;
In context with Microsoft's moving to Internet shift..&lt;br /&gt; &lt;br /&gt;Can I host Smallbasic workspace on web, where kids/enthusiasts may go online and be able to write fun programs and execute them thru web?&lt;br /&gt; &lt;br /&gt;This will be amazing for kids and schools. Plus that way, I can share my new programs with all the friends without having to share my program file.&lt;br /&gt; &lt;br /&gt;I am not sure, if you guys have any plans in that direction.. but this would like next big involving thing from Microsoft. There is nothing like this out there where anyone can share there creativity with others... :D&lt;br /&gt; &lt;br /&gt;
&lt;/div&gt;</description><author>Akhilesh</author><pubDate>Sun, 30 Nov 2008 21:40:21 GMT</pubDate><guid isPermaLink="false">NEW POST: Can I host the workspace on Web? 20081130P</guid></item><item><title>NEW POST: Sleep functionality</title><link>http://code.msdn.microsoft.com/smallbasic/Thread/View.aspx?ThreadId=1019</link><description>&lt;div class="wikidoc"&gt;
First.. &lt;br /&gt;many many kudos to bring SmallBasic to public.&lt;br /&gt; &lt;br /&gt;I am long time programmer.. but.. all work no fun. Small basic is really fun and so easy to get into.&lt;br /&gt; &lt;br /&gt;I was going thru various examples from the .PDF file.&lt;br /&gt; &lt;br /&gt;I am sorely missing &amp;quot;sleep&amp;quot; functionality in the language.&lt;br /&gt; &lt;br /&gt;it would be fun to add it. It kinda animates the graphics.&lt;br /&gt; &lt;br /&gt;If it's already there.. could you please publish it in the .pdf or reply here.&lt;br /&gt; &lt;br /&gt;Thanks&lt;br /&gt;
&lt;/div&gt;</description><author>Akhilesh</author><pubDate>Sun, 30 Nov 2008 21:32:59 GMT</pubDate><guid isPermaLink="false">NEW POST: Sleep functionality 20081130P</guid></item><item><title>UPDATED WIKI: Game of Life</title><link>http://code.msdn.microsoft.com/smallbasic/Wiki/View.aspx?title=Game of Life&amp;version=2</link><description>&lt;div class="wikidoc"&gt;
An implementation of Game of Life, complete with clickable buttons&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
' --------------------------------------------------------------------------------  
' Filename: gol.sb  
' Author: Christian Jacob &amp;lt;cjacob@hotmail.de&amp;gt;  
' --------------------------------------------------------------------------------  
  
' Width of the life grid  
maxX = 100  
  
' Height of the life grid  
maxY = 100  
  
' Size of the life pixels  
lifeSize = 5  
  
max = maxX * maxY  
currentPos = 0  
neighbourPos = 0  
start = 0  
initialize = 1  
  
GraphicsWindow.BackgroundColor = &amp;quot;SteelBlue&amp;quot;   
GraphicsWindow.BrushColor = &amp;quot;Black&amp;quot;  
GraphicsWindow.Title = &amp;quot;Game of Life&amp;quot;   
GraphicsWindow.Width = maxX * lifeSize + 100  
GraphicsWindow.Height = maxY * lifeSize  
GraphicsWindow.MouseDown = OnMouseDown   
GraphicsWindow.Show()  
  
RunLoop:      
    If (quit = 1 ) Then  
        Goto End  
    EndIf  
  
    If (initialize = 1) Then  
        Initialize()      
    EndIf  
      
    If (start = 0 ) Then  
        Goto RunLoop  
    EndIf       
          
    GraphicsWindow.Clear()  
      
    DrawUI()      
    DrawSimulation()      
    CalculateNextGeneration()      
  
Goto RunLoop  
  
End:  
Program.End()  
  
Sub Initialize  
  
    GraphicsWindow.Clear()  
      
    ' Initialize life grid  
    For y = 0 To maxY - 1  
        For x = 0 To maxX - 1  
            currentPos = y * maxX + x  
            Array.SetValue (&amp;quot;lifegrid&amp;quot;, currentPos, 0)  
            Array.SetValue (&amp;quot;lifegridcopy&amp;quot;, currentPos, 0)  
        EndFor  
    EndFor  
  
    ' Initialize  f-Pentomino  
    Array.SetValue (&amp;quot;lifegridcopy&amp;quot;, 50*maxX+50, 1)  
    Array.SetValue (&amp;quot;lifegridcopy&amp;quot;, 51*maxX+50, 1)  
    Array.SetValue (&amp;quot;lifegridcopy&amp;quot;, 52*maxX+50, 1)  
    Array.SetValue (&amp;quot;lifegridcopy&amp;quot;, 51*maxX+49, 1)  
    Array.SetValue (&amp;quot;lifegridcopy&amp;quot;, 50*maxX+51, 1)  
      
    DrawUI()  
    DrawSimulation()  
      
    initialize = 0  
EndSub  
  
Sub DrawSimulation  
    For y = 0 To maxY - 1  
        For x = 0 To maxX - 1  
            currentPos = y * maxX + x  
              
            life = Array.GetValue (&amp;quot;lifegridcopy&amp;quot;, currentPos)              
            Array.SetValue (&amp;quot;lifegrid&amp;quot;, currentPos, life)  
              
            if (life = 1) Then  
                GraphicsWindow.FillRectangle (x*lifeSize, y*lifeSize, lifeSize-1, lifeSize-1)  
            EndIf              
        EndFor  
    EndFor  
EndSub  
  
Sub CalculateNextGeneration  
    For y = 0 To maxY-1  
        For x = 0 To maxX - 1  
            currentPos = y * maxX + x  
              
            GetNeighbourCount()  
              
            life = Array.GetValue(&amp;quot;lifegrid&amp;quot;, currentPos)  
                          
            If( life = 0 And neighbourCount = 3 ) Then                  
                ' Get alife  
                Array.SetValue (&amp;quot;lifegridcopy&amp;quot;, currentPos, 1)                              
            EndIf  
                          
            If ( life = 1 ) Then                  
                if(  neighbourCount = 2 Or neighbourCount = 3 ) Then  
                    ' Stay alive  
                    Array.SetValue (&amp;quot;lifegridcopy&amp;quot;, currentPos, 1)    
                Else  
                    ' Die  
                    Array.SetValue (&amp;quot;lifegridcopy&amp;quot;, currentPos, 0)             
                EndIf    
            EndIf        
        EndFor  
    EndFor  
EndSub  
  
Sub DrawUI  
    GraphicsWindow.DrawLine( maxX*lifeSize, 0, maxX*lifeSize, maxY*lifeSize)  
      
    ' Start button  
    GraphicsWindow.DrawRectangle( maxX * lifeSize + 5, 5, 90, 30 )  
    GraphicsWindow.DrawText( maxX * lifeSize + 10, 12, &amp;quot;Start&amp;quot; )  
      
    ' Stop button  
    GraphicsWindow.DrawRectangle( maxX * lifeSize + 5, 35, 90, 30 )  
    GraphicsWindow.DrawText( maxX * lifeSize + 10, 42, &amp;quot;Stop&amp;quot; )  
      
    ' Init button  
    GraphicsWindow.DrawRectangle( maxX * lifeSize + 5, 70, 90, 30 )  
    GraphicsWindow.DrawText( maxX * lifeSize + 10, 77, &amp;quot;Init&amp;quot; )  
      
    ' Quit button  
    GraphicsWindow.DrawRectangle( maxX * lifeSize + 5, 105, 90, 30 )  
    GraphicsWindow.DrawText( maxX * lifeSize + 10, 107, &amp;quot;Quit&amp;quot; )  
EndSub  
  
Sub OnMouseDown   
    x = GraphicsWindow.MouseX  
    y = GraphicsWindow.MouseY      
      
    ' Draw or remove life pixel  
    If( x &amp;gt; 0 And x &amp;lt; maxX * lifeSize And y &amp;gt; 0 And y &amp;lt; maxX * lifeSize ) Then  
      
        lifeY = Math.Round(y / lifeSize)  
        lifeX = Math.Round(x / lifeSize)  
          
        newLife = ( lifeY * maxX ) + lifeX   
          
        life = Array.GetValue (&amp;quot;lifegridcopy&amp;quot;, newLife)  
        If( life = 1 ) Then  
            Array.SetValue (&amp;quot;lifegridcopy&amp;quot;, newLife, 0)  
            GraphicsWindow.BrushColor = &amp;quot;SteelBlue&amp;quot;  
            GraphicsWindow.FillRectangle (lifeX*lifeSize, lifeY*lifeSize, lifeSize-1, lifeSize-1)       
        Else  
            Array.SetValue (&amp;quot;lifegridcopy&amp;quot;, newLife, 1)  
            GraphicsWindow.BrushColor = &amp;quot;Black&amp;quot;  
            GraphicsWindow.FillRectangle (lifeX*lifeSize, lifeY*lifeSize, lifeSize-1, lifeSize-1)       
        EndIf          
          
        GraphicsWindow.BrushColor = &amp;quot;Black&amp;quot;  
    EndIf      
      
    ' Start button  
    If ( x &amp;gt; maxX * lifeSize + 5 And x &amp;lt; maxX * lifeSize + 95 And y &amp;gt; 5 And y &amp;lt; 30 ) Then         
        start = 1  
    EndIf    
      
    ' Stop button  
    If ( x &amp;gt; maxX * lifeSize + 5 And x &amp;lt; maxX * lifeSize + 95 And y &amp;gt; 35 And y &amp;lt; 65 ) Then         
        start = 0  
    EndIf     
      
    ' Init button  
    If ( x &amp;gt; maxX * lifeSize + 5 And x &amp;lt; maxX * lifeSize + 95 And y &amp;gt; 70 And y &amp;lt; 100 ) Then         
        initialize = 1  
    EndIf    
      
    ' Quit button  
    If ( x &amp;gt; maxX * lifeSize + 5 And x &amp;lt; maxX * lifeSize + 95 And y &amp;gt; 105 And y &amp;lt; 135 ) Then   
        quit = 1   
    EndIf    
EndSub  
  
Sub GetNeighbourCount  
    neighbourCount = 0  
      
    ' Left  
    neighbourPos = currentPos - 1      
    GetNeighbour()  
      
    ' Right  
    neighbourPos = currentPos + 1  
    GetNeighbour()  
      
    ' Above  
    neighbourPos = currentPos - maxX   
    GetNeighbour()  
      
    ' Beneath  
    neighbourPos = currentPos + maxX   
    GetNeighbour()  
      
    ' Above left  
    neighbourPos = currentPos - maxX - 1  
    GetNeighbour()  
     
    ' Above right  
    neighbourPos = currentPos - maxX + 1   
    GetNeighbour()  
      
    ' Beneath left  
    neighbourPos = currentPos + maxX - 1   
    GetNeighbour()  
      
    ' Beneath right  
    neighbourPos = currentPos + maxX + 1  
    GetNeighbour()      
EndSub  
  
Sub GetNeighbour  
    If (neighbourPos &amp;gt;= 0 And neighbourPos &amp;lt; max-1) Then  
        If( Array.GetValue(&amp;quot;lifegrid&amp;quot;, neighbourPos) = 1 ) Then  
            neighbourCount = neighbourCount + 1  
        EndIf   
    EndIf  
EndSub  
&lt;/pre&gt; &lt;br /&gt;&lt;img src="http://code.msdn.microsoft.com/Project/Download/FileDownload.aspx?ProjectName=smallbasic&amp;amp;DownloadId=4011" alt="gol.png" /&gt;&lt;br /&gt;
&lt;/div&gt;</description><author>Vijaye</author><pubDate>Sun, 30 Nov 2008 21:10:23 GMT</pubDate><guid isPermaLink="false">UPDATED WIKI: Game of Life 20081130P</guid></item><item><title>UPDATED WIKI: Game of Life</title><link>http://code.msdn.microsoft.com/smallbasic/Wiki/View.aspx?title=Game of Life&amp;version=1</link><description>&lt;div class="wikidoc"&gt;
An implementation of Game of Life, complete with clickable buttons&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
' --------------------------------------------------------------------------------  
' Filename: gol.sb  
' Author: Christian Jacob &amp;lt;cjacob@hotmail.de&amp;gt;  
' --------------------------------------------------------------------------------  
  
' Width of the life grid  
maxX = 100  
  
' Height of the life grid  
maxY = 100  
  
' Size of the life pixels  
lifeSize = 5  
  
max = maxX * maxY  
currentPos = 0  
neighbourPos = 0  
start = 0  
initialize = 1  
  
GraphicsWindow.BackgroundColor = &amp;quot;SteelBlue&amp;quot;   
GraphicsWindow.BrushColor = &amp;quot;Black&amp;quot;  
GraphicsWindow.Title = &amp;quot;Game of Life&amp;quot;   
GraphicsWindow.Width = maxX * lifeSize + 100  
GraphicsWindow.Height = maxY * lifeSize  
GraphicsWindow.MouseDown = OnMouseDown   
GraphicsWindow.Show()  
  
RunLoop:      
    If (quit = 1 ) Then  
        Goto End  
    EndIf  
  
    If (initialize = 1) Then  
        Initialize()      
    EndIf  
      
    If (start = 0 ) Then  
        Goto RunLoop  
    EndIf       
          
    GraphicsWindow.Clear()  
      
    DrawUI()      
    DrawSimulation()      
    CalculateNextGeneration()      
  
Goto RunLoop  
  
End:  
Program.End()  
  
Sub Initialize  
  
    GraphicsWindow.Clear()  
      
    ' Initialize life grid  
    For y = 0 To maxY - 1  
        For x = 0 To maxX - 1  
            currentPos = y * maxX + x  
            Array.SetValue (&amp;quot;lifegrid&amp;quot;, currentPos, 0)  
            Array.SetValue (&amp;quot;lifegridcopy&amp;quot;, currentPos, 0)  
        EndFor  
    EndFor  
  
    ' Initialize  f-Pentomino  
    Array.SetValue (&amp;quot;lifegridcopy&amp;quot;, 50*maxX+50, 1)  
    Array.SetValue (&amp;quot;lifegridcopy&amp;quot;, 51*maxX+50, 1)  
    Array.SetValue (&amp;quot;lifegridcopy&amp;quot;, 52*maxX+50, 1)  
    Array.SetValue (&amp;quot;lifegridcopy&amp;quot;, 51*maxX+49, 1)  
    Array.SetValue (&amp;quot;lifegridcopy&amp;quot;, 50*maxX+51, 1)  
      
    DrawUI()  
    DrawSimulation()  
      
    initialize = 0  
EndSub  
  
Sub DrawSimulation  
    For y = 0 To maxY - 1  
        For x = 0 To maxX - 1  
            currentPos = y * maxX + x  
              
            life = Array.GetValue (&amp;quot;lifegridcopy&amp;quot;, currentPos)              
            Array.SetValue (&amp;quot;lifegrid&amp;quot;, currentPos, life)  
              
            if (life = 1) Then  
                GraphicsWindow.FillRectangle (x*lifeSize, y*lifeSize, lifeSize-1, lifeSize-1)  
            EndIf              
        EndFor  
    EndFor  
EndSub  
  
Sub CalculateNextGeneration  
    For y = 0 To maxY-1  
        For x = 0 To maxX - 1  
            currentPos = y * maxX + x  
              
            GetNeighbourCount()  
              
            life = Array.GetValue(&amp;quot;lifegrid&amp;quot;, currentPos)  
                          
            If( life = 0 And neighbourCount = 3 ) Then                  
                ' Get alife  
                Array.SetValue (&amp;quot;lifegridcopy&amp;quot;, currentPos, 1)                              
            EndIf  
                          
            If ( life = 1 ) Then                  
                if(  neighbourCount = 2 Or neighbourCount = 3 ) Then  
                    ' Stay alive  
                    Array.SetValue (&amp;quot;lifegridcopy&amp;quot;, currentPos, 1)    
                Else  
                    ' Die  
                    Array.SetValue (&amp;quot;lifegridcopy&amp;quot;, currentPos, 0)             
                EndIf    
            EndIf        
        EndFor  
    EndFor  
EndSub  
  
Sub DrawUI  
    GraphicsWindow.DrawLine( maxX*lifeSize, 0, maxX*lifeSize, maxY*lifeSize)  
      
    ' Start button  
    GraphicsWindow.DrawRectangle( maxX * lifeSize + 5, 5, 90, 30 )  
    GraphicsWindow.DrawText( maxX * lifeSize + 10, 12, &amp;quot;Start&amp;quot; )  
      
    ' Stop button  
    GraphicsWindow.DrawRectangle( maxX * lifeSize + 5, 35, 90, 30 )  
    GraphicsWindow.DrawText( maxX * lifeSize + 10, 42, &amp;quot;Stop&amp;quot; )  
      
    ' Init button  
    GraphicsWindow.DrawRectangle( maxX * lifeSize + 5, 70, 90, 30 )  
    GraphicsWindow.DrawText( maxX * lifeSize + 10, 77, &amp;quot;Init&amp;quot; )  
      
    ' Quit button  
    GraphicsWindow.DrawRectangle( maxX * lifeSize + 5, 105, 90, 30 )  
    GraphicsWindow.DrawText( maxX * lifeSize + 10, 107, &amp;quot;Quit&amp;quot; )  
EndSub  
  
Sub OnMouseDown   
    x = GraphicsWindow.MouseX  
    y = GraphicsWindow.MouseY      
      
    ' Draw or remove life pixel  
    If( x &amp;gt; 0 And x &amp;lt; maxX * lifeSize And y &amp;gt; 0 And y &amp;lt; maxX * lifeSize ) Then  
      
        lifeY = Math.Round(y / lifeSize)  
        lifeX = Math.Round(x / lifeSize)  
          
        newLife = ( lifeY * maxX ) + lifeX   
          
        life = Array.GetValue (&amp;quot;lifegridcopy&amp;quot;, newLife)  
        If( life = 1 ) Then  
            Array.SetValue (&amp;quot;lifegridcopy&amp;quot;, newLife, 0)  
            GraphicsWindow.BrushColor = &amp;quot;SteelBlue&amp;quot;  
            GraphicsWindow.FillRectangle (lifeX*lifeSize, lifeY*lifeSize, lifeSize-1, lifeSize-1)       
        Else  
            Array.SetValue (&amp;quot;lifegridcopy&amp;quot;, newLife, 1)  
            GraphicsWindow.BrushColor = &amp;quot;Black&amp;quot;  
            GraphicsWindow.FillRectangle (lifeX*lifeSize, lifeY*lifeSize, lifeSize-1, lifeSize-1)       
        EndIf          
          
        GraphicsWindow.BrushColor = &amp;quot;Black&amp;quot;  
    EndIf      
      
    ' Start button  
    If ( x &amp;gt; maxX * lifeSize + 5 And x &amp;lt; maxX * lifeSize + 95 And y &amp;gt; 5 And y &amp;lt; 30 ) Then         
        start = 1  
    EndIf    
      
    ' Stop button  
    If ( x &amp;gt; maxX * lifeSize + 5 And x &amp;lt; maxX * lifeSize + 95 And y &amp;gt; 35 And y &amp;lt; 65 ) Then         
        start = 0  
    EndIf     
      
    ' Init button  
    If ( x &amp;gt; maxX * lifeSize + 5 And x &amp;lt; maxX * lifeSize + 95 And y &amp;gt; 70 And y &amp;lt; 100 ) Then         
        initialize = 1  
    EndIf    
      
    ' Quit button  
    If ( x &amp;gt; maxX * lifeSize + 5 And x &amp;lt; maxX * lifeSize + 95 And y &amp;gt; 105 And y &amp;lt; 135 ) Then   
        quit = 1   
    EndIf    
EndSub  
  
Sub GetNeighbourCount  
    neighbourCount = 0  
      
    ' Left  
    neighbourPos = currentPos - 1      
    GetNeighbour()  
      
    ' Right  
    neighbourPos = currentPos + 1  
    GetNeighbour()  
      
    ' Above  
    neighbourPos = currentPos - maxX   
    GetNeighbour()  
      
    ' Beneath  
    neighbourPos = currentPos + maxX   
    GetNeighbour()  
      
    ' Above left  
    neighbourPos = currentPos - maxX - 1  
    GetNeighbour()  
     
    ' Above right  
    neighbourPos = currentPos - maxX + 1   
    GetNeighbour()  
      
    ' Beneath left  
    neighbourPos = currentPos + maxX - 1   
    GetNeighbour()  
      
    ' Beneath right  
    neighbourPos = currentPos + maxX + 1  
    GetNeighbour()      
EndSub  
  
Sub GetNeighbour  
    If (neighbourPos &amp;gt;= 0 And neighbourPos &amp;lt; max-1) Then  
        If( Array.GetValue(&amp;quot;lifegrid&amp;quot;, neighbourPos) = 1 ) Then  
            neighbourCount = neighbourCount + 1  
        EndIf   
    EndIf  
EndSub  
&lt;/pre&gt;
&lt;/div&gt;</description><author>Vijaye</author><pubDate>Sun, 30 Nov 2008 21:09:25 GMT</pubDate><guid isPermaLink="false">UPDATED WIKI: Game of Life 20081130P</guid></item><item><title>UPDATED WIKI: Samples</title><link>http://code.msdn.microsoft.com/smallbasic/Wiki/View.aspx?title=Samples&amp;version=5</link><description>&lt;div class="wikidoc"&gt;
&lt;h3&gt;
Small Basic Samples
&lt;/h3&gt;&lt;ol&gt;
&lt;li&gt;&lt;a href="http://code.msdn.microsoft.com/smallbasic/Wiki/View.aspx?title=Turtle%20plus%20Flickr&amp;amp;referringTitle=Samples"&gt;Turtle plus Flickr&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://code.msdn.microsoft.com/smallbasic/Wiki/View.aspx?title=Blackboard&amp;amp;referringTitle=Samples"&gt;Blackboard&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://code.msdn.microsoft.com/smallbasic/Wiki/View.aspx?title=Flickr%20collage&amp;amp;referringTitle=Samples"&gt;Flickr collage&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://code.msdn.microsoft.com/smallbasic/Wiki/View.aspx?title=Turtle%20Squiral&amp;amp;referringTitle=Samples"&gt;Turtle Squiral&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://code.msdn.microsoft.com/smallbasic/Wiki/View.aspx?title=Game%20of%20Life&amp;amp;referringTitle=Samples"&gt;Game of Life&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;</description><author>Vijaye</author><pubDate>Sun, 30 Nov 2008 21:08:54 GMT</pubDate><guid isPermaLink="false">UPDATED WIKI: Samples 20081130P</guid></item><item><title>UPDATED WIKI: Turtle Squiral</title><link>http://code.msdn.microsoft.com/smallbasic/Wiki/View.aspx?title=Turtle Squiral&amp;version=2</link><description>&lt;div class="wikidoc"&gt;
The classic logo &amp;quot;Squiral&amp;quot;&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
GraphicsWindow.Show()      
Turtle.Speed = 5 
angle = 91   
Squiral() 
    
Sub Squiral   
 side = 0      
 For i = 1 to 180       
  Turtle.Move(side)      
  Turtle.Turn(angle)      
  side = side + 1      
 EndFor      
EndSub   
&lt;/pre&gt; &lt;br /&gt;&lt;img src="http://code.msdn.microsoft.com/Project/Download/FileDownload.aspx?ProjectName=smallbasic&amp;amp;DownloadId=4010" alt="screenshot.jpg" /&gt;&lt;br /&gt;
&lt;/div&gt;</description><author>Vijaye</author><pubDate>Sun, 30 Nov 2008 21:08:13 GMT</pubDate><guid isPermaLink="false">UPDATED WIKI: Turtle Squiral 20081130P</guid></item><item><title>UPDATED WIKI: Turtle Squiral</title><link>http://code.msdn.microsoft.com/smallbasic/Wiki/View.aspx?title=Turtle Squiral&amp;version=1</link><description>&lt;div class="wikidoc"&gt;
The classic logo &amp;quot;Squiral&amp;quot;&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
GraphicsWindow.Show()      
Turtle.Speed = 5 
angle = 91   
Squiral() 
    
Sub Squiral   
 side = 0      
 For i = 1 to 180       
  Turtle.Move(side)      
  Turtle.Turn(angle)      
  side = side + 1      
 EndFor      
EndSub   
&lt;/pre&gt; &lt;br /&gt;
&lt;/div&gt;</description><author>Vijaye</author><pubDate>Sun, 30 Nov 2008 21:07:39 GMT</pubDate><guid isPermaLink="false">UPDATED WIKI: Turtle Squiral 20081130P</guid></item><item><title>UPDATED WIKI: Flickr collage</title><link>http://code.msdn.microsoft.com/smallbasic/Wiki/View.aspx?title=Flickr collage&amp;version=2</link><description>&lt;div class="wikidoc"&gt;
Collects a bunch of pictures from Flickr and creates a collage out of it&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
tag = &amp;quot;World Series&amp;quot;  
pic = &amp;quot;MyPic&amp;quot;  
  
For i = 1 To 10   
    x = Math.GetRandomNumber(300)   
    y = Math.GetRandomNumber(300)   
               
    picName = pic + i   
    ImageList.LoadImage(picName, Flickr.GetRandomPicture(tag))   
           
    height = ImageList.GetHeightOfImage(picName)    
    'This line crashes every time for me (running Vista 32bit).   
    'width = ImageList.GetWidthOfImage(picName)   
                   
    GraphicsWindow.DrawResizedImage(picName, x, y, 300, height / 3)   
EndFor 
&lt;/pre&gt; &lt;br /&gt;&lt;img src="http://code.msdn.microsoft.com/Project/Download/FileDownload.aspx?ProjectName=smallbasic&amp;amp;DownloadId=4009" alt="collage.jpg" /&gt;&lt;br /&gt;
&lt;/div&gt;</description><author>Vijaye</author><pubDate>Sun, 30 Nov 2008 21:06:28 GMT</pubDate><guid isPermaLink="false">UPDATED WIKI: Flickr collage 20081130P</guid></item><item><title>UPDATED WIKI: Flickr collage</title><link>http://code.msdn.microsoft.com/smallbasic/Wiki/View.aspx?title=Flickr collage&amp;version=1</link><description>&lt;div class="wikidoc"&gt;
Collects a bunch of pictures from Flickr and creates a collage out of it&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
tag = &amp;quot;World Series&amp;quot;  
pic = &amp;quot;MyPic&amp;quot;  
  
For i = 1 To 10   
    x = Math.GetRandomNumber(300)   
    y = Math.GetRandomNumber(300)   
               
    picName = pic + i   
    ImageList.LoadImage(picName, Flickr.GetRandomPicture(tag))   
           
    height = ImageList.GetHeightOfImage(picName)    
    'This line crashes every time for me (running Vista 32bit).   
    'width = ImageList.GetWidthOfImage(picName)   
                   
    GraphicsWindow.DrawResizedImage(picName, x, y, 300, height / 3)   
EndFor 
&lt;/pre&gt;
&lt;/div&gt;</description><author>Vijaye</author><pubDate>Sun, 30 Nov 2008 21:05:14 GMT</pubDate><guid isPermaLink="false">UPDATED WIKI: Flickr collage 20081130P</guid></item><item><title>UPDATED WIKI: Samples</title><link>http://code.msdn.microsoft.com/smallbasic/Wiki/View.aspx?title=Samples&amp;version=4</link><description>&lt;div class="wikidoc"&gt;
&lt;h3&gt;
Small Basic Samples
&lt;/h3&gt;&lt;ol&gt;
&lt;li&gt;&lt;a href="http://code.msdn.microsoft.com/smallbasic/Wiki/View.aspx?title=Turtle%20plus%20Flickr&amp;amp;referringTitle=Samples"&gt;Turtle plus Flickr&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://code.msdn.microsoft.com/smallbasic/Wiki/View.aspx?title=Blackboard&amp;amp;referringTitle=Samples"&gt;Blackboard&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://code.msdn.microsoft.com/smallbasic/Wiki/View.aspx?title=Flickr%20collage&amp;amp;referringTitle=Samples"&gt;Flickr collage&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://code.msdn.microsoft.com/smallbasic/Wiki/View.aspx?title=Turtle%20Squiral&amp;amp;referringTitle=Samples"&gt;Turtle Squiral&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;</description><author>Vijaye</author><pubDate>Sun, 30 Nov 2008 21:03:21 GMT</pubDate><guid isPermaLink="false">UPDATED WIKI: Samples 20081130P</guid></item><item><title>UPDATED WIKI: Blackboard</title><link>http://code.msdn.microsoft.com/smallbasic/Wiki/View.aspx?title=Blackboard&amp;version=2</link><description>&lt;div class="wikidoc"&gt;
A Blackboard application that lets you draw on a window&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
GraphicsWindow.BackgroundColor = &amp;quot;Black&amp;quot;    
GraphicsWindow.PenColor = &amp;quot;White&amp;quot;    
GraphicsWindow.MouseDown = OnMouseDown    
GraphicsWindow.MouseMove = OnMouseMove      
 
Sub OnMouseDown      
  prevX = GraphicsWindow.MouseX      
  prevY = GraphicsWindow.MouseY    
EndSub      
 
Sub OnMouseMove      
  x = GraphicsWindow.MouseX      
  y = GraphicsWindow.MouseY      
  If (Mouse.IsLeftButtonDown) then        
    GraphicsWindow.DrawLine(prevX, prevY, x, y)      
  endif      
  prevX = x      
  prevY = y    
EndSub  
&lt;/pre&gt; &lt;br /&gt;&lt;img src="http://code.msdn.microsoft.com/Project/Download/FileDownload.aspx?ProjectName=smallbasic&amp;amp;DownloadId=4008" alt="blackboard.jpg" /&gt;&lt;br /&gt;
&lt;/div&gt;</description><author>Vijaye</author><pubDate>Sun, 30 Nov 2008 21:00:40 GMT</pubDate><guid isPermaLink="false">UPDATED WIKI: Blackboard 20081130P</guid></item></channel></rss>