Code Like A Kid using Small Basic

Posted: June 26, 2010 in Others
Tags:

Along with few of my friends I started learning programming with a language called BASIC.It seems to be a very long long time from now.But that was fun..real & honest.That was one of the few things, like learning to play chess, algebra, geometry.. etc, whenever I remember about it I feel happy.Last week I came across the new version of Small Basic in a blog post, old memories sparked,I downloaded and started playing with it.

Small Basic is introduced by Microsoft to help people learn and enjoy programming.The first thing that drew my attention was it’s plain and minimalist IDE.

sb

Next thing I liked is the Intellisense support.It’s plain simple and beautiful.

sbit

The language is also pretty straightforward and lucid without much frills.

  • It does not have any explicit typing, you do not have to define any types for the variables.
  • It support the basic array data structure.
  • If-Else & Goto
  • For & While Loops
  • Subroutines
  • Ability to read & write from command line
  • Shapes & GraphicsWindow object to support GUI based programming
  • Events & Event Handler

I was not satisfied just by looking at the IDE and going through the specs.Some program had to be written.. like old days.But what would be that?

Currently I am reading “The Tao of Physics: An Exploration of the Parallels Between Modern Physics and Eastern Mysticism” by Fritjof Kapra.Here I had read about the Yin Yang symbol.The original meaning of the word is shady and sunny side of a mountain.But this is used in Chinese philosophy to symbolize the opposing forces of nature and their harmony or balance.Anyway’s let’s not get into these philosophical details.The Yin Yang symbol looks like:

So how to draw these in SmallBasic.We will do this by drawing three circles and filling them partly with black as shown below:

yinyang1

We will use the GraphicsWindow object to draw a circle as shown below:

yyc1

Now I have to fill one part this circle with black.But Small Basic does not have any Arc or Semi Circle kind of object which I can fill with black.So I thought of filling out the area within one half of the circle with straight lines in black.To draw a straight line I need two points, here one will be on center of the circle and one on the circumference.XII standard coordinate geometry came to rescue.I computed the coordinates on the circumference using simple polar coordinates as shown below:

yyc2

The circle now looks like:

yy2

Now I add two more smaller circles and one in the upper half of the outer circle is filled with white.

yyc3

The shape now appears as:

yyc4

Now the two smaller circles is added as shown below:

yyc5

The finally the symbol appears to be all perfect:

yyc7

Advertisements
Comments
  1. Vaibhav says:

    A very practical and intuitive post for BASIC programmers.
    The take away for me was the intellisense window.
    Just thinking of a VS extension for 2010 to replicate the same.
    I have personally always loved Basic (as in VB) for the advantages it has (some of which are mentioned above, like typeless coding).
    The minimalist IDE is what should attract beginners (atleast).

    A really good sample (simple, yet complex).

    Just a thought: I should have been more serious with my maths πŸ™‚

  2. sankarsan says:

    @Vaibhav Thanks…..

  3. Reube says:

    A very practical and intuitive post for BASIC programmers.The take away for me was the intellisense window.Just thinking of a VS extension for 2010 to replicate the same.I have personally always loved Basic (as in VB) for the advantages it has (some of which are mentioned above, like typeless coding).The minimalist IDE is what should attract beginners (atleast).
    +1

  4. Coleman Reed says:

    A very practical and intuitive post for BASIC programmers.The take away for me was the intellisense window.Just thinking of a VS extension for 2010 to replicate the same.I have personally always loved Basic (as in VB) for the advantages it has (some of which are mentioned above, like typeless coding).The minimalist IDE is what should attract beginners (atleast).+1
    +1

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