Quantcast
Channel: Small Basic
Viewing all 201 articles
Browse latest View live

New Project SBDoc Started

$
0
0

I started to develop new tool SBDoc.  This tool is like JavaDoc or JSDoc to create document HTML files from program source code.  The current version’s program ID is NPW862.

Now SBDoc has CUI (character user interface).  So, to run it, import, run once (for compile) and type as follows from command prompt, while src and out are source and output folder names.

SBDoc src /O out

SBDoc01b2

And SBDoc will create an HTML file index.html in the described output folder.

SBDoc02out

The source code of this program is also uploaded on GitHub.


Small Basic Challenges of the Month! April 2016

$
0
0

These challenges are intended for people who are learning to program for the first time or for those returning to programming who want to start using Small Basic.  Some will be easy, some will be hard – but they will all make you think, and more importantly be GREAT FUN!

Please post your solutions / partial solutions / questions / feedback etc. into this thread that will remain ‘sticky’ for the month.  The only rule is that your solution must use standard Small Basic methods (no extensions).

https://social.msdn.microsoft.com/Forums/en-US/5d8c41c2-a327-4185-abaa-763bf3d5a109/challenge-of-the-month-april-2016?forum=smallbasic 

It would be good if people could post their problems with these challenges so that a discussion can start so that everyone can learn from each other.

We may extend these challenges over into a second month if solutions and questions are still coming in.

Also post feedback on the kind of challenges that you want to see more of in the future.

Text Challenge

  • Write a program that records your typing speed (words per minute).  Consider using a multi-line textbox for the user to type into.

Maths Challenge

  • Try to write the fastest code to calculate the sum of all prime factors of the first 1000 numbers.

For example the first 10 numbers (1 has no prime factors) have the following prime factors (2, 3, 2+2, 5, 2+3, 7, 2+2+2, 3+3, 2+5) and their sum is 45.

Graphics Challenge

  • Write subroutines to convert between RGB colour values and HSL (to and from).  RGB are the Red, Green and Blue components, while HSL are the Hue, Lightness and Saturation.  Using HSL to set colours can give nice effects.  Start here to learn about HSL and maybe search for some online algorithms to help writing the conversioncode.
  • Write a program using the HSL conversion to change the Hue (colour) of an image by changing each pixel.  For performance reasons (it will be slow), try using fairly small images, say 100 by 100 pixels (that is still 10000 pixels to change).

Game Challenge

  • Write a program to play GO.  Some AI would be great to play against the computer.  Read aboutAlphaGo.

Community Suggestions

This month the communty suggestons for challenges were posted in separate threads. Thanks for all suggestions.

Post answers here or on the challenge threads linked to below.

  • Create a fully functional calculator (8-digit, basic calculator, not scientific) but do all the calculations by hand…meaning that if the user wants 356 * 8…the program should multiply 8*6 then 8*5+4 then 8*3+4. Just like you would do it if you had to multiply with pencil and paper. This would require addition, subtraction, multiplication and division and as an added challenge, negative numbers.  By jherch77 (ORIGINAL POST).
  • Write a program to calculate how much power (watt)  is necessary to climb an elevation of 5% grade.  By Yvan Leduc (ORIGINAL POST).
  • Write a program that could quantify the number of Watts uses the writing, storage on differentservers, and the delivery to the addressee of a simple e-mailBy Yvan Leduc (ORIGINAL POST).
  • A knight’s tour is a sequence of moves of a knight on a chessboard such that the knight visits every square only once. If the knight ends on a square that is one knight’s move from the beginning square (so that it could tour the board again immediately, following the same path), the tour is closed, otherwise it is openBy Yvan Leduc (ORIGINAL POST).

Do you have an idea for a future challenge? Please post it here!

 

Small and basically Basic,

LitDev & Ninja Ed

 

Chess Problems in Small Basic

$
0
0

Today I’d like to introduce two chess problems posted in Small Basic forum.  You can use Unicode characters for chessmen in Small Basic programs.  e.g. ♟, ♞, ♝, ♜, ♛ and ♚.

Knight’s Tour

The original post is here by Yvan Leduc.  This problem is also picked up in the challenge of this month.

A knight’s tour is a sequence of moves of a knight on a chessboard such that the knight visits every square only once. If the knight ends on a square that is one knight’s move from the beginning square (so that it could tour the board again immediately, following the same path), the tour is closed, otherwise it is open.

KnightsTour06

This picture above shows a solution solved by WPV159-3.

8-Queens

This problem was a community suggestion by Amir CPS in Challenge of the Month – January 2013.

The 8-Queens problem in chess is to place 8 queens on a chess board such that none of the queens is threatening any of the others.  The problem is to input the 8 columns of the queens on the rows of a chess board, with 1 being the first column and 8 being the last, e.g. 1 2 3 4 5 6 7 8 means the queens are along the diagonal, which would not be a valid solution.

More Info about this problem

Write a program to test a user input guess.

Examples:

  • Enter board configuration: 2 4 6 8 3 1 7 5 – This is a valid configuration (as above).
  • Enter board configuration: 1 8 2 5 3 7 4 6 – This is NOT a valid configuration.

8-Queens02

This picture above shows that the pattern is not a solution: red queens are threatening others.  The ID of this program is QDX521.

 

Build month! So much new to know! Small Basic Gurus needed!

$
0
0

A wonderful month of news and new technology advances from Build have filled our minds with new possibilities!

So much to play with!

Can you help us document some of the new features coming out over the next year?

Do you have a good grasp on how we should now be doing that thing that we do?

Did you find a knowledge gap in the web for the new features now available?

This is a great chance to jump into the TechNet Guru competition and stamp your authority on your favoutrite subject.

All you have to do is add an article to TechNet Wiki from your own specialist field. Something that fits into one of the categories listed on the submissions page. Copy in your own blog posts, a forum solution, a white paper, or just something you had to solve for your own day’s work today.

Drop us some nifty knowledge, or superb snippets, and become MICROSOFT TECHNOLOGY GURU OF THE MONTH!

This is an official Microsoft TechNet recognition, where people such as yourselves can truly get noticed!

HOW TO WIN

1) Please copy over your Microsoft technical solutions and revelations to TechNet Wiki.

2) Add a link to it on THIS WIKI COMPETITION PAGE (so we know you’ve contributed)

3) Every month, we will highlight your contributions, and select a “Guru of the Month” in each technology.

If you win, we will sing your praises in blogs and forums, similar to the weekly contributor awards. Once “on our radar” and making your mark, you will probably be interviewed for your greatness, and maybe eventually even invited into other inner TechNet/MSDN circles!

Winning this award in your favored technology will help us learn the active members in each community.

 

Below are February’s mighty Small Basic Guru winners:

Guru Award  Small Basic Technical Guru – February 2016 
Gold Award Winner Ed Price – MSFT Small Basic 1.2: Installation Guide Richard Mueller: “Good use of Wiki guidelines. Great images that detail the steps.”
Silver Award Winner Nonki Takahashi Small Basic: Desktop Michiel Van Hoorn: “Realy cool to interact with Windows components.”
Richard Mueller: “Excellent use of Wiki guidelines”
Bronze Award Winner Ed Price – MSFT Small Basic: How to Publish Your Program Richard Mueller: “Good images and useful information.”
Michiel Van Hoorn: “Sharing is caring. How much fun is it to share your code with friends and family”

   

Next, here are March’s super Small Basic Guru winners:

Guru Award  Small Basic Technical Guru – March 2016 
Gold Award Winner Yvan Leduc How to produce a complete music chord using SoundPlay.Music in Small Basic DEVA: “Great Music app Yvan :)”
Michiel Van Hoorn: “Great, music!”
Silver Award Winner Nonki Takahashi Small Basic: Program DEVA: “Great Stuff Nonki :)”
Michiel Van Hoorn: “Thanks Nonki!”

 

Good luck! Small & Basically yours,
Pete Laker

 

& Ninja Ed!

MSDN Blog Article List – Small Basic Tools

$
0
0

Today, I’d like to introduce two tools written in Small Basic.

MSDN Blog Article List

This tool (NPB609) is a new version of my Blog Article List series.

MSDNBlogArticleList01

The screen shot above shows that this tool generated an article list HTML for User Ed blog.  You can generate any other article list in MSDN blogs with this tool.

This program needs a GUI form definition file Blog.frm.sb (SHP804).

Form

The next tool “Form” is a GUI form checker now.  But my intention is to update this tool as GUI form and dialog editor.  The source code is uploaded to GitHub.

Form05b

GUI form definition is saved as a Small Basic comment file.  So we can edit this form with the editor in the Small Basic Environment (IDE).

Other Tools

Small Basic – Hardware Story

$
0
0

It’s time for us to shout on a rooftop and proclaim all the wonderful hardware capabilities that you’re going to find in Small Basic!

Today we’re highlighting four powerful capabilities:

  1. Lego Mindstorms EV3
  2. Kinect for Windows
  3. Arduino
  4. Oculus Rift

Let’s get started!

 

1. Lego Mindstorms EV3

Our support here goes way beyond the capability to program on Lego Mindstorms EV3. Because Small Basic is a learning language, you can learn professional programming while you command your robots! In addition, EV3 Basic is the only great solution for taking EV3 units into actual programming and a learning language… that’s free!

Read more here, and download the EV3 Basic extension:

Lego Mindstorms EV3 Extension for Small Basic – EV3 Basic

Finally, as if all that isn’t enough, EV3 Basic lets you take your robots to the next level, where you can get more control over sound, better variable handling, the ability create UI-based apps and games to interact through, with the robots, synchronized wheel motions, Ease-In and Ease-Out on your motion for the motors, Bluetooth/Wifi support, and simply robots that move faster!

 

2. Kinect for Windows

Small Basic 1.2 included Kinect for Windows in the core library! Learn about the different capabilities here:

Kinect for Windows

image

 

3. Arduino

In this blog post, LitDev explains how to use his extension to program on Arduino:

Arduino

 

4. Oculus Rift

This extension comes from Zock77:

Oculus Rift

 

Please check out these different hardware capabilities! We hope to add more hardware solutions in the future, so if you find yourself playing with Small Basic on Raspberry Pi or another hardware solution, please let us know!

 

Thank you for stopping. Bye!

– Ninja Ed

Small Basic Extension Manager

$
0
0

I created a utility to manage Small Basic extensions.

It can be downloaded from TechNet Gallery.

If you would like an extension added to the database, or have other suggestions then please leave a message on this Small Basic Forum Thread.

Details

It uses a web database maintained by me to list current versions of extensions, and can handle extensions for different versions of Small Basic.

It manages (Web) based extensions downloaded through the utility as well as extensions you install locally (Local).

The minimum requirements to add an extension to the database are that a web accessible zip download exists containing the extension dll and xml files.

By default it assumes that Small Basic is installed in the default location.

  • C:\Program Files (x86)\Microsoft\Small Basic on 64 bit Windows
  • C:\Program Files\Microsoft\Small Basic on 32 bit Windows

Hopefully the number of extensions supported by this utility will grow.

With the utilitiy you can:

  • download and install or update selected extensions
  • permanently uninstall (delete) extensions
  • temporarily disable and enable extensions

The utility interface below shows installed extensions, their status and single click options to install/update or enable/disable.  Only available extensions for the currently installed version of Small Basic are displayed.

  • Blue is uninstalled, but available to be downloaded and installed
  • Purple is is installed and enabled, but a differenent (usually more recent) version is available
  • Green is installed and enabled
  • Red is installed, but disabled

EM

Right click an extension to get additional details and options.

EMOptions

Fractals in Small Basic

$
0
0

There is a list of fractal programs in a blog article here. But, I’d like to update and summarize again about fractal programs in this post.

Fractal Tree

I think this may be the first fractal program written in Small Basic. The program is listed in Small Basic Getting Started Guide.
Turtle_drawing_a_tree_fractal

Dragon Curve

Last month, Kenneth Lee Taylor started posting fractal graphics and that codes to Small Basic Enthusiasts.  Following graphic is the first one of them.
fractal_dragon

Sierpinski Triangle

This is another one by Kenneth.

Screen shot of a fractal triangle program

Mandelbrot

There are some programs drawing Mandelbrot set here.  Following screen shot is one of them written by Rene_Miner.

Screen shot of a Mandelbrot program

Koch Curve

This program written by solongos has menu to choose some fractals.  This program is shared in this thread.

Screen shot of a fractal program

 

Hilbert Curve

The last one is my program (CMN910).  This program is a good sample of recursive call.

Screen shot of a program Hilbert Curve 0.1

Other Resources


Small Basic – May 2016 Challenges of the Month

$
0
0

These challenges are intended for people who are learning to program for the first time or for those returning to programming who want to start using Small Basic.  Some will be easy, some will be hard – but they will all make you think, and more importantly be GREAT FUN!

Please post your solutions / partial solutions / questions / feedback etc. into this thread that will remain ‘sticky’ for the month.  The only rule is that your solution must use standard Small Basic methods (no extensions).

Post your solutions here:

https://social.msdn.microsoft.com/Forums/en-US/a2cf21a5-6046-4d92-8cb9-579f67835ea0/challenge-of-the-month-may-2016?forum=smallbasic

It would be good if people could post their problems with these challenges so that a discussion can start so that everyone can learn from each other.

We may extend these challenges over into a second month if solutions and questions are still coming in.

Table Update

  • Write a program to display a simple table of data like the scores for 10 students
  • Extend the program so that it reads the data from a file
  • Extend it further so that the table display is automatically updated when the fie contents change

Swipe login

  • Make a 9 zone ‘swipe’ login screen like you get on phones

Binary Lights

  • Write a program to show the binary value for numbers – the lights change when the number is changed or entered by the user
  • Perhaps extend to a binary digit clock

Sum of Digits

  • Write a program to recrsively sum all the digits in a number
  • There is a pattern for any number divisible by 9

For example 561096 : 5+6+1+0+9+6 = 27 : 2+7 = 9

Community Suggestion (By Coding Cat)

Rotation in Stages

  1. Placing multiple shapes around a circle – Example: Peddles on a flower
  2. Rotating the shapes around the center – Example: Farris Wheel
  3. Rotating the shapes themselves as they rotate around the center – Example: A rotating marquee, where the bottoms of the letters always face the center
  4. Vary the radius of the of the circle as the shapes rotates – Example: The rotating letters would pulse in and out from the center as they rotated.

Community Suggestions (By Lvan Leduc)

These suggestions come on separate discussion threads.

  • Convert a color image into a Black and White INFRARED effect – LINK
  • Domination CHESS problems – LINK
  • The mysterious number – LINK
  • Who’s gonna win the Stanley Cup this year? – LINK
  • 3 points of perspective graphic view – LINK

 

Do you have an idea for a future challenge? Please post it here!

 

Thank you for all your community contributions, even if they’re Small and Basic!

– Ninja Ed

Characters for Names in Small Basic

$
0
0

General rule for variable, label, subroutine names are:

  • starts with “_” or alphabet character.
  • followed by “_”, alphabet or number.

But I found some multi-byte characters can be used for these names in Small Basic.  There are not official documents about it.

So following is my conjecture about which character can be used for variable, label and subroutine names:

  • Double byte characters can be used like alphabet.
  • But no double byte symbol can be used.

Sample code is here.

I think this is useful for following cases:

  • to write names in your local languages. ex. なまえ = “のんき”
  • to use Greek alphabet in equations. ex. x = r * Math.Cos(θ)

See Also

May Day! We need YOU as a TechNet Small Basic Guru!

$
0
0

May is under way!

And the Guru early birds are showing the way!

Could this be the month that we see the best ever TechNet article in the WORLD!!?

You could be thinking it right now words of wisdom that enrich people’s lives!

Technical truths and wise words of widgets and wizardry!

So many upper eyes within Microsoft adjudicate this competition, yet so few stumble on this small community and realise the potential of getting their name known in such circles!

Some of our biggest community voices and many MVPs have passed through these halls, on their way to fame and fortune.

Come and see who is making waves in all your favourite technologies.

Maybe it will be you!

All you have to do is add an article to TechNet Wiki from your own specialist field. Something that fits into one of the categories listed on the submissions page. Copy in your own blog posts, a forum solution, a white paper, or just something you had to solve for your own day’s work today.

Drop us some nifty knowledge, or superb snippets, and become MICROSOFT TECHNOLOGY GURU OF THE MONTH!

This is an official Microsoft TechNet recognition, where people such as yourselves can truly get noticed!

HOW TO WIN

1) Please copy over your Microsoft technical solutions and revelations to TechNet Wiki.

2) Add a link to it on THIS WIKI COMPETITION PAGE (so we know you’ve contributed)

3) Every month, we will highlight your contributions, and select a “Guru of the Month” in each technology.

If you win, we will sing your praises in blogs and forums, similar to the weekly contributor awards. Once “on our radar” and making your mark, you will probably be interviewed for your greatness, and maybe eventually even invited into other inner TechNet/MSDN circles!

Winning this award in your favoured technology will help us learn the active members in each community.

April’s articles are off with the Judges. We hope to have enough votes by mid-month. They’re all busy people.

Below are March’s mighty Small Basic winners! The full list of winners and contenders is here.

Guru Award  Small Basic Technical Guru – March 2016 
Gold Award Winner Yvan Leduc How to produce a complete music chord using SoundPlay.Music in Small Basic DEVA: “Great Music app Yvan :)”
Michiel Van Hoorn: “Great, music!”
Silver Award Winner Nonki Takahashi Small Basic: Program DEVA: “Great Stuff Nonki :)”
Michiel Van Hoorn: “Thanks Nonki!”

A huge thank you to EVERYONE who contributed an article to March’s competition.

Good Luck May Gurus!

Ninja Ed, and…

Pete Laker

Turtle Brick – Small Basic Sample Program

$
0
0

I wrote a 2D brick program controlled with Turtle.  The program ID is  KDH145.

Screen shot of a program Turtle Brick

You can use five commands to control Turtle: Left, Right, Up, Down, and Fill.

Have fun!

Drawing Voxel and Cuboid in Small Basic

$
0
0

Today, I’d like to introduce my new program to draw voxels and cuboids.  The program ID is QRC070.  A voxel is a 3-D pixel.

DrawCuboid01

As a next step, I’m planning to make this program using 3-point perspective.

Small Basic – June Challenges: Psychedelic Spiral, MARS orbit, Anagrams, On-Screen Keyboard, and more!

$
0
0

These challenges are intended for people who are learning to program for the first time or for those returning to programming who want to start using Small Basic.  Some will be easy, some will be hard – but they will all make you think, and more importantly be GREAT FUN!

Please post your solutions / partial solutions / questions / feedback etc. into this thread that will remain ‘sticky’ for the month.  The only rule is that your solution must use standard Small Basic methods (no extensions).

Here is the forum thread:

https://social.msdn.microsoft.com/Forums/en-US/f7b62609-6994-48e1-b353-8de4b278ec16/challenge-of-the-month-june-2016?forum=smallbasic

It would be good if people could post their problems with these challenges so that a discussion can start so that everyone can learn from each other.

We may extend these challenges over into a second month if solutions and questions are still coming in.

Text Challenges

  • Create an on screen keyboard.
  • Create a program to find the differences between 2 text files – a simple file difference program.

Graphics Challenges

  • Create a custom cursor – no extensions.
  • Draw a multi-coloured spiral

Game Challenge

  • Create a game based on the user trying to unscramble anagrams.  The program should create anagrams and time or check the user answers.

These Community Suggestions come on separate discussion threads.

By Coding Cat

  • Animation techniques – LINK

By YLed

  • M A R S orbit – LINK
  • New steps in this cells calculator- LINK
  • The impossible stair – LINK
  • Binary ADD calculator – LINK
  • Draw a regular dodecahedron – LINK

 

Do you have an idea for a future challenge? Please post it here!

 

Small and Basically yours,

– LitDev & Ninja Ed

ANNOUNCING THE 20 SMALL BASIC BOOK GIVEAWAY WINNERS: “Learn to Program with Small Basic: An Introduction to Programming with Games, Art, Science, and Math”

$
0
0

ABOUT THE GIVEAWAY

In today’s blog post, we’ll dig into a Small Basic sample that will select 10 random winners from folks who took the Small Basic 1.2 Feedback Survey!

Awhile ago we had a promotion to win the Small Basic book I cowrote with Majed Marji:

 

You can learn more about the book here:

 

            

 

No Starch Press is giving away 20 books as prizes to that contest!

  • 10 PRIZES: 1 Ebook for 10 randomly chosen survey participants
  • 10 PRIZES: 1 Printed Book for the Top 10 best feedback answers in the survey

 

And today we’re announcing the winners!

 

10 FEEDBACK WINNERS

Here are the 10 winners who gave us great feedback and helped us find missing bugs (chosen by our Small Basic team, who acted as judges):

  1. David EW
  2. David P
  3. Sivaraj A
  4. Matthew P
  5. Petr V
  6. Joseph B
  7. Garth F
  8. Pete M
  9. Tiago B
  10. David W

Those 10 winners received emails to get their printed books!

Special thanks to all the participants who gave us great feedback! You helped us prioritize our bugs, feature back log, and we added a few bugs and feature ideas to our backlog, based on your feedback! (The good news is that we’re using it as we’re working on Small Basic 1.3, and so this feedback is very valuable.)

Now that we know our 10 Feedback winners, let’s pick the 10 random winners!

 

SAMPLE TO PICK 10 RANDOM WINNERS

I’m going to do it as a Small Basic sample!

I wrote a Small Basic program to select the winners! I wrote this program in 14 lines of code (click it for a larger version, but be sure to come back):

SB_EbookWinners_14Lines

First, I wrote a line that declares a simple array, which is like having one variable that collects an unlimited number of strings. It collects as many different strings or items of data content that I feed into it.

Here is the line:

contestants = “1=TB;2=KA;3=JN;4=TKG;5=TE;6=JDC;7=DBe;8=RAD;9=CA;10=CB;11=MT;12=JD;13=LM; 14=PH;15=JAu;16=DH;17=TMC;18=JAb;19=GC;20=DMK;21=DL;22=JC;23=DF;24=AHa; 25=GH;26=BR;27=RP;28=WC;29=SP;30=ArR;31=JH;32=AM;33=AmR;34=JI;35=RI;36=DBu; 37=BS;38=JK;39=EN;40=CK;41=AnH;42=OH;43=SG;44=DS;45=KP;46=SM”

That’s all one line! It’s just a long line.

In this case, I assigned 46 strings into an array. Those 46 strings are each just a few letters represent the 46 contestants. I took the total number of people who took the survey, I subtracted any folks who already won the printed books (see 10 Feedback Winners above).

What was left was those 46 contestants. I assigned them to the contestants array.

Now I’m ready to start displaying out the text (yes, already!). I’m beginning with a bit of title text that will tell you what this list is about:

TextWindow.WriteLine(“The Winners are:”)

I used the TextWindow object, since I’m going to be displaying text in the text window. I used the TextWindow object’s WriteLine method to write a line of text in the text window. And the text is “The Winners are:” to let the reader know very easily what this list is all about.

I’m ready for my next line! For my third line, I’m assigning the number variable the value of 1:

number = 1

This is just a very basic variable. I’m going to use this variable in my For loop in order to display the numbers 1-10, one number on each line, to count the 10 winners. These numbers (1-10) are displayed on the left side of the list.

It’s time to start the For loop! The fourth line gets the loop started:

For N = 1 To 10

This loop starts at the number 1 and goes 10 times. That’s all this line means. So whatever is inside this loop gets 10 passes. We need to make each pass count!

The fifth line is the first line in our loop. This line picks one of the 10 winners:

winner = Math.GetRandomNumber(46)

We selected a winner! We use the Math object’s GetRandomNumber method to, yup you guessed it, select a random number. The 46 means the random number will be between 1 and 46. Pretty easy! Then it’s assigned into our new variable, winner. The variable is a container that holds one thing at a time. Now it’s holding the number that corresponds to one of our 46 winners!

Our next three lines are interesting. These lines are just checking to see if the person has been picked yet. We can’t pick someone more than once! That wouldn’t be fair to the other 45 contestants! Check it out; here are lines 6-8 (all are still inside the For loop, so we run this check 10 times, once for each winner selection):

While (contestants[winner] = 0)

winner = Math.GetRandomNumber(46)

EndWhile

What just happened? Well, a While loop runs the loop only as long as the condition is true. The condition is contestants[winner] = 0. This uses the winner number we just randomly assigned (for example, let’s say it picked the number 22 from the choices of 1 to 46). Then it checks into the array we declared (back in line 1), looks at the value of the winner number (in the example, it looks into the #22 spot), and sees if the value for that number is 0. Obviously, none of those strings are the number 0 (and the value of our contestants[22] spot in the array is JC)! So in our first iteration of our For loop, this While loop checks, finds the condition is false (nothing is valued at 0), and it never runs. It just skips ahead.

Then why am I using it? Well, later on I’m assigning values to zero after I select them as the winners! Why? Because this way I make sure we don’t select the same winner twice! I’ll explain this more in a bit.

Now line 9 is a blank space. Why? Sometimes your code just needs a break! Some breathing room so that you can visually see where one thought ends before starting another thought.

Line 10 gets to write out the first line in our list of winners! Finally! Here it is:

TextWindow.WriteLine(number + “. “ + contestants[winner])

We use WriteLine to display another line of text out in the text window. The number variable displays the first number in the list (since this is the first time we’re running the loop, and we’ll run it 10 times). So it displays 1. The plus symbol conctatenates (glues) the period with a space, so it looks like (1. ), Then the plus sign concatenates the value of our first winner (so if it the randomly selected number for winner was 3, then it displays: 1. JC).

We have our first winner, displayed on the line! It’s time to look at our 11th line of code:

number = number + 1

That line just takes the number for the line in the list, and it increments the value to one number higher. For example, we started at number 1, and the first line in the list in the text window, displayed the number 1 (it was 1. JC). Now it’s time to add 1 to the value of the variable number, so that it’s ready to display the number 2 on the second line of our list! Why didn’t we just print out the number 2? Well, we’re putting all this in a For loop so we don’t have to print out 10 different lines of code for these different 10 numbers! We can just add one to the variable number instead. So the next time we run this For loop, the number gets incremented to the value of 3.

Next we’re going to set our winner to the value of 0:

contestants[winner] = 0

Now that our winner is set to the value of 0 (instead of to JC), we won’t select JC again!

Line 13 ends our For loop:

EndFor

And then line 14 gives us a blank line (so we get a nice space in the text window before you get the text, “Press any key to continue…”):

TextWindow.WriteLine(“”)

And that’s our code! We did it in just 14 lines!

The second pass on the For loop

Now let’s take a look at what happens the second time we run our For loop (remember we run it 10 times total):

  1. On line 5, the variable winner gets assigned a new random number, between 1 and 46.
  2. On lines 6-8, the While loop checks if the array value is set to 0. If it is, that means the person already won. So line 7 selects a new random winner, from 1-46, and then the While loop checks again to see if that person has won yet. The loop continues until it selects someone who hasn’t won yet. Then it exits the loop and moves on…
  3. Line 10 displays the line for our second winner. In this case, it displays: 2. PH
  4. Line 11 assigns number to the value of 3 (to display number 3 on the third list item for the next time we run the loop).
  5. Line 12 sets the second winner to the value of 0, so we don’t pick that person again!

Then we exit the For loop and go to the third pass! Make sense? If not, leave a comment below!

Get the code!

Want the code so you can play with it?

You can import the program with this code (in Small Basic, click the Import button):

  • RVG855

You can find an example run of the program, and get the code, on the online gallery:

And that leads us to the 10 winners selected by the program!

Selecting the Winners:

Here are the results of the program and what I saw in the text window when I ran it:

The Winners are:

1. JC

2. PH

3. CK

4. JN

5. RAD

6. KA

7. MT

8. GC

9. DF

10. DH

 

Press any key to continue…

Here is the screenshot:

SB_EbookWinners

We did it! We selected the 10 random winners using computer programming and by using a method that we know is truly random! =^)

There’s probably a website out there that randomly selects winners for you, but since this is for Small Basic, and the whole point is to learn computer science, I turned it into a Small Basic sample!

 

10 RANDOM EBOOK WINNERS

Here are our 10 winners:

  1. John C
  2. Patteri H
  3. Carl K
  4. John N
  5. Ruth AD
  6. Karthikeyan A
  7. Matthew T
  8. Gary C
  9. David F
  10. David H

 

THANK YOU!

A big thanks go out to all 20 winners and everyone who took the survey! We’ve already put the information to use, and it will be very useful for the future of Small Basic!

And don’t forget to check out the book and see if it’s something that will help you:

Learn to Program with Small Basic: An Introduction to Programming with Games, Art, Science, and Math

Small Basic is the only computer programming syntax/text-based language and IDE/UI that was built specifically for kids and learners!

 

Keep things Small and Basic!

– Ninja Ed


Date Calculator – Small Basic Sample Program

$
0
0

I wrote a date calculator program in Small Basic.  The program ID is JQQ629.

This program calculates days between two dates.  To calculate days, dates are converted to Julian days.

DateCalculator01_313

There are two convert subroutines DateToJD() and JDToDate().  To test these two subroutines, I wrote unit test subroutine UnitTest().  You can see the test if change “False” to “True” in line 9.

Small Basic Gurus! Where are you!? Scooby Doo? Join the June Guru competition!

$
0
0

Scooby Doo! Where are you? What? I don’t know. Oh, Small Basic Guru!

Behold! It’s the June TechNet Guru Contest!

Your chance to get your name known, raise your profile, get credit where credit is due!

Yes my friends, this is your chance to get listed along-side some of the industry’s greatest community heroes!

All you have to do is add an article to TechNet Wiki from your own specialist field. Something that fits into one of the categories listed on the submissions page. Copy in your own blog posts, a forum solution, a white paper, or just something you had to solve for your own day’s work today.

Drop us some nifty knowledge, or superb snippets, and become MICROSOFT TECHNOLOGY GURU OF THE MONTH!

This is an official Microsoft TechNet recognition, where people such as yourselves can truly get noticed!

HOW TO WIN

1) Please copy over your Microsoft technical solutions and revelations to TechNet Wiki.

2) Add a link to it on THIS WIKI COMPETITION PAGE (so we know you’ve contributed)

3) Every month, we will highlight your contributions, and select a “Guru of the Month” in each technology.

If you win, we will sing your praises in blogs and forums, similar to the weekly contributor awards. Once “on our radar” and making your mark, you will probably be interviewed for your greatness, and maybe eventually even invited into other inner TechNet/MSDN circles!

Winning this award in your favoured technology will help us learn the active members in each community.

May’s articles are with the judges, but below are the previous month’s mighty winners and contenders!

 

 

Guru Award  BizTalk Technical Guru – April 2016 
Gold Award Winner Eldert Grootenboer Using BizTalk Deployment Framework with MSBuild to bypass reserved placeholders JS: “BTDF if getting quite popular. Nice to see some advanced use cases.”
LG: “Good practical tip. Thank you sharing!”
Sandro Pereira: “Well written, excellent article for BTDF lovers”
Silver Award Winner SMSVikasK Integration Between Microsoft BizTalk Server 2013 & Microsoft Dynamics CRM Online 2016 LG: “BizTalk Dynamic CRM is a very hot topic.”
JS: “Microsoft CRM’s API is very (maybe too) flexible; this is a simple and expandable pattern to start a BizTalk integration app with. “
Bronze Award Winner Sandro Pereira BizTalk Server DevOps: Configuring Receive and Send Handlers in BizTalk Ports with PowerShell JS: “Great addition to BizTalk’s PowerShell story. Super useful for VM provisioning and similar cases.”
LG: “Thank you sharing!”

 

 

Guru Award  Forefront Identity Manager Technical Guru – April 2016 
Gold Award Winner Jeff Ingalls Managing Contacts in the FIM/MIM Portal PG: “Wow, nice! Keep up the good work!”
Søren Granfeldt: “Good and detailed walk-through”

 

 

Guru Award  Microsoft Azure Technical Guru – April 2016 
Gold Award Winner Sandro Pereira Azure Logic Apps: Dynamic Hello World using Azure Functions inside Logic Apps JH: “Good articles from Sandro this month. This one is a good entry into Azure Functions.”
AN: “Very good”
Silver Award Winner Bhushan Gawale Azure Remote Apps – In Depth Walkthrough JH: “Nice Azure Remote Apps walkthrough with a good mixture of text and pictures.”
AN: “Great walkthrough!”
Bronze Award Winner Janshair Khan Understanding and Creating Azure Deployment Slots JH: “Short overview about deployment slots. A little bit more on their usage would be great.”
AN: “Another great article!”

 

 

Guru Award  Miscellaneous Technical Guru – April 2016 
Gold Award Winner Namrah Khurram Getting started with the Raspberry Pi – A walk-through Richard Mueller: “Great images and good explanation”
Silver Award Winner SYED SHANU Draw MVC Pie Chart using WEB API, AngularJS and JQuery Richard Mueller: “More good images and code.”
Bronze Award Winner Janshair Khan Understanding Docker for Absolute Beginners Richard Mueller: “A great tutorial to explain what it is.”

 

 

Guru Award  SharePoint 2010 / 2013 Technical Guru – April 2016 
Gold Award Winner Nathanaël Stassart SharePoint 2013 – Crawl file shares beyond the 260 MAX_PATH limit – Issue with ErrorID 808 829 – The object is not found TN: “This article is extremely helpful providing real-world experience when working with fileshare”
Silver Award Winner Waqas Sarwar SharePoint 2016 Rename Site Collection URL Best Practice TN: “Great article in SharePoint 2016 which is very new to the community.”
Bronze Award Winner Nathanaël Stassart SharePoint 2016 – Crawl Error List [ErrorID] TN: “Thanks Nat”

 

Guru Award  Small Basic Technical Guru – April 2016 
Gold Award Winner Nonki Takahashi Small Basic: Flickr Michiel Van Hoorn: “Nice to see updated doc”
DEVA: “Great one Nonki. You rock one more time…!!”

 

 

Guru Award  SQL BI and Power BI Technical Guru – April 2016 
Gold Award Winner Greg Deckler (Fusion Alliance) Power Query: Using Recursion to Solve Hex to Decimal Conversion PT: “A very good wiki contribution. Thank you! This post is deep and specific to solve a particular challenging issue.”

 

 

Guru Award  Transact-SQL Technical Guru – April 2016 
Gold Award Winner Natig Gurbanov Sql Server: Using Parameterized Functions JS: “”
Richard Mueller: “Interesting code. Grammar needs work.”

 

 

Thanks in advance!

Ninja Ed and…
Pete Laker

Do you teach Lego Mindstorms EV3? Take it to the next level!

$
0
0

This extension evolves Lego Mindstorms EV3.

Lego Mindstorms is a tile-based programming solution. So it just teaches conceptual programming, like Kodu, LightBot, Project Spark, and Scratch Jr (those are other examples of tile-based coding). But it doesn’t teach professional programming. That makes sense for 1st and 2nd graders (6 and 7 year olds)… to not learn the real stuff. But grade 3 and up should learn professional programming via Small Basic!

This extension also significantly enhances the Lego Mindstorms experience, you can simply do a whole lot more, from power, speed, traction/control, computer sounds, implementing your software games to interact with the robots, etc. In fact, there are a few similar products that let you program Lego Mindstorms robots with actual code, but almost all of them cost money, and all of them are inferior to this solution! This one is better in every way… including being free!

There are so many improvements, that we wrote all 24 of them down here:

http://blogs.msdn.com/b/smallbasic/archive/2015/10/18/lego-mindstorms-ev3-extension-for-small-basic-ev3-basic.aspx

Small Basic typically starts at age 8. It teaches actual text-based programming to kids: https://blogs.msdn.microsoft.com/smallbasic/2012/10/25/small-basic-elementary-middle-student-testimonials/

If your students are too young (7 or younger), but you see any kids crush it (where they’re obviously ready for something beyond the tile-based programming), then this is a good way to give them a challenge. You can also recommend it to parents/kids if they have Lego Mindstorms at home as well (so they can accelerate their learning).

 

Also, if you teach Lego Mindstorms EV3, you should join us in our exclusive network for teachers to engage with the Microsoft employees who are making the CS tools (like Small Basic, Kodu, Touch Develop) and running the CS programs (Imagine Cup, TEALS, DigiGirlz, etc.). Just fill out this form to join us:

 

Small and Basically yours,

– Ninja Ed

MARS Orbit in Small Basic

$
0
0

I wrote many programs as the solutions for monthly challenges.  Today I will introduce a couple of my solutions.

M A R S orbit – suggestion for JUNE challenge of the month is one of a community challenge by YLed in this month.

drawing MARS orbit,

I searched this forum and no one have thought to

What seems simple as challenge, draw the orbit of Mars with Small Basic.

In our course of physics, we had draw the orbit of Mars on graph paper, using Kepler’s Law.

NASA videos Galleries: Video: Orbits and Kepler’s Laws

A General Equation for Orbital Speed

Motion in the Heavens, Project Physics Text and Handbook Volume 2

For this challenge, I wrote two programs.  One is to visualize Kepler’s Second Law.  The program ID is CXZ359.

Screen shot of a program Kepler's Second Law

You can change e (eccentricity) and see how different the planet speed whether near a focus or not.  At the beginning, I planed to use a part of this program to write orbit animation.  But I found a following site, I changed the plan.

Keplerian Elements for Approximate Positions of the Major Planets (NASA/JPL)

Then finally I wrote the second program with the equations provided by JPL above.  The program ID is CLJ212-5.

Screen shot of a program Orbit 0.3

You can use mouse and [Right] [Left] arrow keys and [Home] [End] keys to select date.

Thank you YLed for providing such an attractive challenge.

“Learn to Program with Small Basic”– Book Review by Middle School Teacher, Martin Fish

$
0
0

Today’s guest blogger is Martin Fish! Today he’s reviewing Small Basic and the book, “Learn to Program with Small Basic” (No Starch Press | Amazon).

Martin Fish is a middle school Coding and Robotics teacher at Mason Middle School in Mason, Ohio.  His Coding and Robotics STEM Lab started out as a club in 2014.  The community interest was so strong that the club became an elective course available to 7th graders in the 2015-2016 school year.

=============================

I am an educator with 14 years in the classroom under my belt, but I’ll be the first to admit that I’m not a trained computer programmer.  I started the Coding and Robotics STEM Lab at my school because I thought it was important, I was interested, and I was willing to learn.  But I pretty much had to start at the beginning and teach myself everything.

So not only did I need to educate myself about computer programming in general, but I had to wade through the vast variety of programming styles (Graphical blocks? Text based?) and programming languages (Python? Java?  C++?  JavaScript?).  And at the same time I needed to write a curriculum that attempted to create an educational experience that was challenging but accessible, educational and engaging, with entry points for a wide range of knowledge levels that would inspire all students to learn and grow.

Small Basic

The Small Basic UI

I’m not sure how I found Microsoft’s Small Basic, but I am incredibly glad that I did!  Here are some of the things that made it ideal for my classroom:

  • It was specifically designed as an educational programming language for middle school aged students
  • The “IntelliSense” built into the IDE provides students with an accessible text-based coding experience
  • It scaffolds into Visual Basic, which is used in our High School CS1 course
  • It generally introduces students to the concept of a programming “Object” and the idea that an object can have properties that describe it and operations that can act upon it.
  • It is extensible – and there are some fantastic extensions that introduce physics or allow Lego Mindstorms EV3 programming.
  • It is free!!

Having settled upon a primary coding language for my course, I then needed to develop a curriculum to support it.  Oh how I wish that “Learn to Program with Small Basic” by Majed Marji and Ed Price had been available in those early stages in my course creation!

One of the newest entries in the fantastic No Starch Press collection of coding guides for younger learners, “Learn to Program with Small Basic” is clearly designed with multiple audiences in mind.  It could be picked up off the shelf by an 8-14 year old with a new interest in computer programming.  It can be a guide for an adult just starting out on their journey.  It can provide the framework for a homeschooling course.  It can be the backbone for a teacher’s course or a club.  In all of these situations, Learn to Program with Small Basic takes its readers from the most basic of computer science questions (“What is a Computer?  What is a Computer Program?”) and accompanies them on a journey of discovery in computer programming.

The structure of the book is clearly designed to teach the basics of computer science.  Chapters are divided into topics that make sense for CS beginners and are applicable to any computer programming environment such as “Using Variables,” “Empowering Programs with Math,” “Making Decisions with If Statements,” “Solving Problems with Subroutines,” and even “Building Graphical User Interfaces.”

Cover of the Small Basic book

Although a scan of the table of contents may make the book sound like a Computer Science 101 text, it is the structure within those chapters and Marji and Price’s engaging writing style that really sets this book apart.  It is clearly written with an eye towards a middle school audience.  The text is easy to read and filled with little jokes and gags that are guaranteed to make the coolest 13-year-old roll her eyes (that’s a good thing).  But beyond the standard descriptions of concepts and examples, my favorite part of the book by far is that each chapter provides the reader with challenges that utilize the new content introduced in the chapter and draw on what has been previously learned.

So often, computer programming books are filled with math-based challenges (count by 2s . . . now count by 3s . . . find the prime number . . . is the number a square) that would put a classroom of middle school students (and their teacher) to sleep.  These challenges, on the other hand, keep their audience in mind.  They are engaging and creative and appropriate for a middle school aged audience.  Further, they leverage the website for the book to provide resources, hints and solutions.  Readers can access comment-only “starter” files to get them moving and provide a roadmap for their projects or, if they get hopelessly stuck, can access solutions — all online.  I particularly like the fact that the solutions do not appear in the book itself.  That would make it too easy to simply page to the back and type in the solution.  By requiring the reader to take the additional step of hopping online and navigating to the correct URL before seeing a solution, readers are encouraged to keep trying to solve the challenges on their own.

In Learn to Program with Small Basic, Marji and Price have accomplished something very difficult.  They have created an outline of basic computer science principles that is appropriate for middle schoolers in a text based programming language.  Many of the resources that are currently being produced are of the drag-and-drop, block-based graphical structure.  While I believe that these are a great way to get younger students interested in coding, the Small Basic programming language and its intuitive IDE has worked incredibly well in my middle school classroom.  In my end of course surveys, a strong majority of students (nearly 70%!)  recommended that I limit the use of block-based programming languages in order to provide them with even more opportunities to do text-based programming with Small Basic.  I am certain that Learn to Program with Small Basic will be a trusted companion as I expand this portion of my course and I am thrilled that such a resource is available.

But don’t think that this book is designed only to be a teacher’s guide.  That couldn’t be further from the truth.  This book is for anyone who is interested in learning more about the basics of computer programming in a fun and engaging way and I highly recommend Learn to Program with Small Basic and Microsoft’s excellent Small Basic programming language.

– Martin Fish

============================

Learn to Program with Small Basic

An Introduction to Programming with Games, Art, Science, and Math
by Dr. Majed Marji and Ed Price

May 2016, 304 pp.
ISBN: 978-1-59327-702-4
Full Color

Viewing all 201 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>