webDotWiz talks Windows Live

A daily list of links to interesting sites

Strain the brain – try Small Basic – webDotWiz Online column Nov 5 2009

clip_image001

Getting started

Yes, webDotWiz can hear you loudly protesting that your brain is already stressed enough as you learn to cope with all the ways you can use your photos such as create movies, keep up with all the options now available in Live Hotmail, track people on your Live network with What’s new on your network, easily upload photos from Live Photo Gallery to your new Facebook site – and so the list goes on.

Well, you’ll be pleased to know that often by straining the brain with some different types of problems that the brain copes better. So this week we’ll take a look at learning some computer programming with Small Basic.

Get started by going to smallbasic.com to download and install Small Basic (the download is only a few megabytes). The download button is over on the right-hand side of the web page. You’ll notice there’s a Getting Started document (Word 2007 or PDF format) so download this as well. It’s got some theory but more importantly there are plenty of small sample programs that you can run so you can see how things work.

Start Small Basic (you’ll find it under your All Programs on the Windows Start menu). There are the usual New, Open, Save, Save As and Copy/Paste menu items. As well there’s an Import button and a Run button to run your programs. The Import button is interesting because it enables you to download programs that others have written so you can learn from what others have done (that’s one of the secrets of learning to write computer programs).

Small Basic doesn’t have many keywords – only fifteen in fact – unlike full-blown programming environments such as Visual Basic with hundreds. Once you start typing in the programming area,  Small Basic will help you out by popping up suggestions as to what it thinks you’re trying to say. For example, start typing webdotwiz (not one of Small Basic’s keywords). Now try typing TextWindow – Small Basic knows something about this text because it’s one of its keywords and will popup some information about it.

Hello world

All real programmers write their first program to say Hello world. Starting out with Small Basic is no different – well, it keeps the tradition alive. All you need do is type TextWindow.WriteLine("hello") and press the Run button (or press the F5 button on your keyboard).

Your program runs and prints Hello world in a very basic text window (check the task bar if you can’t see this window).

You can jazz up things a bit by changing the colour of the text so look in the Introducing Small Basic document for the list of colours you can use and the extra line of code you’ll need to type in.

Add some colour

Go to about page 24 of the Introducing Small Basic document to type in some code to get Small Basic to use a graphics window. Now you can draw lines, circles and rectanges using different colours and start to see more possibilities (see page 25 and following pages in Introducing Small Basic).

Learn from others

The Import button enables you to download programs that others have written. You may want to just play Asteroids or Gorilla but you’ll also be able to glance at the code to see how the program works. If you’re a coder from way back, it won’t take you long to pick up Small Basic’s way of programming and you might even trying porting some of your old games over to Small Basic (as lots of others have done).

To use Import you’ll need a code for each program. You’ll find each program’s code in the Small Basic forum threads Post your sample code and Post your sample code part II (go online to today’s sites listing page for direct links).

For example you want to play Tetris – click on Import and enter TETRIS as the code. The program code downloads into Small Basic. Before running, it would be a good idea to save the program so you can open and play again at a later time.

Note that some programs need images and sounds to be downloaded from the web; if they’re causing humbugs with your Windows firewall, leave them till later. You can pre-check any program, though, by entering its code on the Small Basic program listing page.

Have fun straining the brain

There’s little point in getting the brain to try out a new challenge if it’s not enjoyable so look for program listings on the Small Basic forums that use graphics and output some interesting designs. Want more challenges with Small Basic? Try out the Project Euler problems!

Quicklinks

  • Asteroids Version 2 on Small Basic: blogs.msdn.com/smallbasic/
  • Gorillas v1.0 for Microsoft Small Basic: code.msdn.microsoft.com/SmallBasicGorillas
  • Graduating from Small Basic: blogs.msdn.com/smallbasic/
  • Happy Birthday Small Basic – Version 0.7 available: blogs.msdn.com/smallbasic/
  • Learning Small Basic: wotudo.net/blogs/how2/
  • Post your sample source code: social.msdn.microsoft.com/Forums/en-US/smallbasic/
  • Post your sample source code Part II: social.msdn.microsoft.com/Forums/en-US/smallbasic/
  • Small Basic Code Gallery: code.msdn.microsoft.com/smallbasic
  • Small Basic Forums: social.msdn.microsoft.com
  • Small Basic Homepage: smallbasic.com
  • Small Basic Introduction Document: smallbasic.com
  • Small Basic Program Listings: smallbasic.com/smallbasic.com/program/
  • Small Basic version 0.7 (Oct 2009): blogs.msdn.com/alfredth/
  • Teaching Small Basic: social.msdn.microsoft.com/Forums/en-US/smallbasic/
  • —————

    Follow webDotWiz on Twitter.

    Posted using the 2009 version of Windows Live Writer.

    Windows Live Tags: ,

    webDotWiz Online at www.webdotwiz.com

    webDotWiz on Facebook at www.facebook.com/webdotwiz

    Advertisements

    Leave a Reply

    Fill in your details below or click an icon to log in:

    WordPress.com Logo

    You are commenting using your WordPress.com account. Log Out / Change )

    Twitter picture

    You are commenting using your Twitter account. Log Out / Change )

    Facebook photo

    You are commenting using your Facebook account. Log Out / Change )

    Google+ photo

    You are commenting using your Google+ account. Log Out / Change )

    Connecting to %s

    %d bloggers like this: