You are on page 1of 29

SMALL BASIC TASK SHEETS - TOM BENYON 1

Small Basic Task Sheets


Benyon DIY

For corresponding video tutorials visit
www.benyondiy.weebly.com













SMALL BASIC TASK SHEETS - TOM BENYON 2

Contents Page

How to Use This Pack 4
Differentiation 4
Text Window 4
1.1 Printing 5
1.2 Variables and User Input 5
1.3 Concatenation 6
1.4 If statements 7
1.5 Boolean (AND / OR) 8
1.6 ElseIf and Else 9
Sonic Challenge 9
1.7 While Loop 10
1.8 For Loop 12
1.9 Subs 13
1.10 Arrays (Lists) 13


SMALL BASIC TASK SHEETS - TOM BENYON 3

Graphics Window 16
2.01 Coordinates and Drawing 16
2.02 Delays and Loops 16
2.03 Shapes and Useful Variables 17
2.04 Comments and Subs 17
2.05 Bouncing Ball 18
2.06 Keyboard Input 18
2.07 Writing to the Graphics Window 19
2.08 Mouse in the Graphics Window 20
2.09 Buttons 21
2.10 Text Boxes (Text Inputs) 21
Fridge Challenge 23
Where Next? 28
Build your own ideas 28
Flappy Birds 28
Try a new language 28



SMALL BASIC TASK SHEETS - TOM BENYON 4

How to Use This Pack

Follow the video tutorials that can be found on YouTube
here. Alternatively you can download the videos by going to
the benyonDIY.weebly.com/learn website and downloading
them from the box account at the bottom of the page.
Differentiation

C/D Grade

C/B Grade

A-A* Grade

Tasks are differentiated in two different ways . . .
Box Tasks Bullet Tasks


Start on any task you like.
You can do only one, or all.
You must start at green and
progress as far as you can.
Text Window


SMALL BASIC TASK SHEETS - TOM BENYON 5

1.1 Printing
Why will this create an error messages?
TextWindow.WriteLine(Do you like cheese?)


Define the words string and integer?


Write some code that will write your (or the schools) address
on separate lines and paste it below.


What is the difference between the following
TextWindow.Write(Hello, World!)
TextWindow.WriteLine(Hello, World!)


1.2 Variables and User Input










SMALL BASIC TASK SHEETS - TOM BENYON 6

What is a variable?


Write some code that asks the user their age, stores it in a
variable and then writes it to the screen.


Why is it really important to have clear variable names?


1.3 Concatenation

Write some code that asks the user their age, and then
make it respond similarly to:
You are 27 years old.

Add some code that asks the user their name, and then
make it respond similarly to:
Your name is Tom and you are 27 years old.








SMALL BASIC TASK SHEETS - TOM BENYON 7


Add some additional code that asks a third bit of
information that is included in the print command.

You will need to use two variables and multiple + symbols to
complete this task. Paste your code below . . .


1.4 If statements

Write some code that asks the user their age, if the
users age is younger than 0 say:
Youre not even born yet!!!

Add another IF statement below for if their age is 13 it
would say:
Unlucky!


Write some code that asks the user their name, and if
they have the same name as you, write:
You have the best name in the world!!!





SMALL BASIC TASK SHEETS - TOM BENYON 8



1.5 Boolean (AND / OR)

Write some code that asks the user their age. If they are
a teenager (use And or Or ) it prints You are a teenager.


Write some code that asks the user if they are brave. If they
say yes/yeah it prints My hero!!!


Add more code that checks for at least three negative
responses (such as no) and then prints Whimp!!!


Fill in the answers as either True or False . . .
True or True = False and True =
True or False = False and False =
False or True = False or True or False =








SMALL BASIC TASK SHEETS - TOM BENYON 9

False or False = False or False or False =
True and True = True and True and False =
True and False = False and True and False =

1.6 ElseIf and Else

Write some code that asks the user their favourite
chocolate bar.

Make your code give different responses for three
different chocolate bars.

Add an Else statement for if they dont choose one of
your listed chocolate bars.



Sonic Challenge

In the original game of Sonic, if you lost all
your lives you could have continues which
would give you 3 extra lives.





SMALL BASIC TASK SHEETS - TOM BENYON 10


Ask the user how many Lives they have and store it in a
variable. Do the same to find out their amount of
Continues.

Write an IF Statement that says if you have no Lives and
no Continues then you write Game Over!!!

Add an ELSEIF that says if you have no lives then say
Do you want to use a continue?

After printing this question give the user a chance to say
yes or no.

If the user says yes, use the following code to reduce
the Continues by one.
continues = continues 1

Print the users current amount of Continues and Lives in
a way such as You now have 2 continues and 3 lives.
http://sonic.wikia.com/wiki/Continue




1.7 While Loop




SMALL BASIC TASK SHEETS - TOM BENYON 11

Write some code that prints the two times table forever!



Write some code that prints the two times table up to 20!


Write some code that prints doubles up to 1024.




Write some annoying code that simply asks the user who
their favourite teacher is without giving them a chance to
answer . . . FOREVER!!!

Add an element that allows the user to answer but if they
dont say Mr Benyon, ask them again.

Add an insult if they get it wrong and praise if they get it
correct.








SMALL BASIC TASK SHEETS - TOM BENYON 12


Stop asking if they get it right.


1.8 For Loop
Write a for loop that would print numbers from 1 to 15.



Write a for loop that would print the two times table to 100.


Write a for loop that would print square numbers to 100.


What are the two reasons you would use a While loop?













SMALL BASIC TASK SHEETS - TOM BENYON 13


When would you use a For loop?

1.9 Subs

Create your own version of the game created in the
Subs video.

Can you add in data validation as suggested in the video
(what happens if the user inputs -107).

Can the user be told a secret single digit number at each
of the three locations? They could then be given another
option, instead of going to a location, to guess the three-
digit number to win the game.

1.10 Arrays (Lists)
Dont delete any code in this list of bulleted tasks. Simply
keep adding to the bottom of your program.

Make a list of your top 3 dinners.






SMALL BASIC TASK SHEETS - TOM BENYON 14


Simply print the list.

Create a sub that uses a For loop to print each item of
the list on a separate line. On the line after EndSub, call
the sub you have created.

On the next line add a new item to the list. Call your sub
once more. Then delete the most recent item from the
list. Call your sub once more.


At this point start a new program.

Create a two dimensional array. You will have two main
sections, movies and tvShows. You have to store
your top 3 of each where the first item is your favourite.

Ask the user whether they want a TV show or a movie?
Then ask them if they want your number 1, 2 or 3 top
film/movie.

Display the selection to the user in a way that uses
concatenation effectively.







SMALL BASIC TASK SHEETS - TOM BENYON 15





SMALL BASIC TASK SHEETS - TOM BENYON 16

Graphics Window

2.01 Coordinates and Drawing
Create some code that draws a face using:

One type of shape including eyes, nose and mouth.

. . . and another type of shape with ears and hair

. . . and incorporate multiple colours.



2.02 Delays and Loops

Create your own screen saver that draws circles

. . . and triangles . . .

. . . and make the size of the circles random.







SMALL BASIC TASK SHEETS - TOM BENYON 17

2.03 Shapes and Useful Variables

Create a square graphics window and draw the dot to
represent a one on a dice.

Make separate subs for drawing a one, two and three
dice faces.

Create some code that will draw any side of the dice
randomly.

2.04 Comments and Subs
What is the main purpose of comments?


What does it mean to comment out code?


What can you do to reduce (or even eliminate) the need for
comments?








SMALL BASIC TASK SHEETS - TOM BENYON 18



In what way can comments cause problems?

2.05 Bouncing Ball

Make a ball bounce back and fourth horizontally.

Make the ball also bounce in the vertical direction also
allowing it to move diagonally.

Make multiple balls OR make the ball change colour
when it hits the walls.


2.06 Keyboard Input








SMALL BASIC TASK SHEETS - TOM BENYON 19

Make the background colour of the screen change when you
press the space bar.


Make a circle appear if the user presses the letter c
Make a square appear if the user presses the letter s


Make a ball move around the screen based on the user
pressing arrow keys.


2.07 Writing to the Graphics Window
Write code that counts down from 10 in the graphics window.


Write a magic word very large in the graphics window. When
the space bar is pressed, make the word change to another
magic word.










SMALL BASIC TASK SHEETS - TOM BENYON 20


I
In the text window, ask the user for a font size, colour and
word and draw that in the graphics window. Then ask if they
would like to change their choices.

2.08 Mouse in the Graphics Window
Write Click to the graphics window in the location of where
the mouse is clicked.


Store the users score in the corner of the screen (each click
gives them a point).Once the user has clicked 10 times clear
the graphics window and tell them they won.


Using your code from 2.05 Bouncing Ball. Give yourself a
point everytime you click on the ball. When you get to a










SMALL BASIC TASK SHEETS - TOM BENYON 21

score of 10 speed up the ball and reduce its size. When they
get to a score of 20 write You Win!!!

2.09 Buttons

Make a game where the user has 15 seconds to click the
button as many times as they can. Display their end
score on the screen.

. . . and make the button move to a random position after
every click . . .

. . . and have an additional button appearing in random
positions every second with different scores written on
the buttons include negative scores.

2.10 Text Boxes (Text Inputs)

Create a text box for username and password. If the
username and password are both correct display a
message saying Accepted.






SMALL BASIC TASK SHEETS - TOM BENYON 22


If the user gets them wrong display Incorrect Details.
Then delete what is currently entered into the boxes.

Include a captcha test that appears if the user gets the
details incorrect first time round.








SMALL BASIC TASK SHEETS - TOM BENYON 23

Fridge Challenge
Your task is to create a text based fridge stock system. The
user will need to be able to login, look at the stock of items in
the fridge, add things, delete things, move things and any
other developments you think would be useful.

The main skills that youll be are:

Creating a menu selection system to choose options

Creating and editing arrays (lists) of items

Password entry system


What to do if youre stuck?

Check out possible methods that can be called within
SmallBasic at the following site
http://smallbasic.com/doc.aspx?o=Array

Take a break. Itll come to you in the shower or on the
bog!

Ask a friend. Why not do some paired programming
together? Just make sure you understand everything
each of you are doing.
Task 1


SMALL BASIC TASK SHEETS - TOM BENYON 24

Create a list of different items for the Fridge (no more than 5
to start with).
e.g.
fridgeContents[1] = Cheese
fridgeContents[2] = Ketchup
I would recommend putting this in a setup sub.

Task 2
Create a text menu (in a new sub) that looks like this
Welcome to the fridge stock control menu. Please choose from the
following options:
1: View items in the fridge
2: Add an item to the fridge
3: Remove item from the fridge
4: Exit the program

Task 3
Create a sub that displays all of the items from the fridge.
There a couple of ways you could do this. With one line of
code you could print this but it may not look very nice. Do
see how it outputs however. . .
textwindow.writeline(fridgeContents)
Alternately you could print each item individually
textwindow.writeline(fridgeContents[1])
textwindow.writeline(fridgeContents[2])


SMALL BASIC TASK SHEETS - TOM BENYON 25

This would be quite laborious if we had 30 items in the fridge.
Instead, why not use a for loop. You may need to refer back
to the tutorial on how to create these on the system.

Task 4
Now can you allow the user to enter a 1 after displaying the
main menu. If they enter a 1 your program should list all the
items in the fridge. If they enter a 4 the program should exit.
Extension: If they enter anything else you could display an
error message and give them an opportunity to try another
number.

Task 5
Add a sub that asks the user what they want to add to the
list. You could store what they want to add in a variable. Your
only problem is how to choose what place to add the item to
in the list fridgeContents[???] = fish cakes
What could you replace the question marks with?

Task 6
Make it so that choosing option two from the main menu runs
the sub youve created.

Task 7
To delete an item in an array you simply do the following
fridgeContents[1] =


SMALL BASIC TASK SHEETS - TOM BENYON 26

Can you come up with a sub that would allow the user to
choose what they wanted to delete.

Task 8
Create a password entry sub that would allow different users
to enter their username and password to gain access to the
main menu. NOT EASY!

Task 9
Could you add a logout option for the menu to take you back
to the login screen for another user.

Task 10
Could you make it so that only certain users are
administrators and can add and delete items.

Task 11
Could you make it so that all foods were stored by category.
For example have sections for dairy products, meats and
fish, drinks and other?

Task 12
Make a way that would allow the user to search for all foods
from a certain section.

Task 13


SMALL BASIC TASK SHEETS - TOM BENYON 27

Can you create a graphical user interface for your program
including text boxes buttons etc.





SMALL BASIC TASK SHEETS - TOM BENYON 28

Where Next?
Build your own ideas
There are an infinite amount of possibilities to code to come
up with your own ideas. This is the best way to develop your
problem solving skills by tackling your own problems. What
game or utility could you build?

Flappy Birds
If you wanted to have a go at seeing a larger project building
up and coding along side, check out the Flappy Birds tutorial
on the website. This will also show you how to import your
own images making your content look much more
professional

Try a new language
Id recommend Python as your next step. It is language used
in industry and could teach you more complex concepts such
as:
Creating functions with input and return values.
More control over data types
Scope of variables (Local and Global variables)
Object oriented programming


SMALL BASIC TASK SHEETS - TOM BENYON 29



To learn python there are a bundle of tutorials on YouTube if
thats how you like learning. I quite like tutorials by
TheNewBoston. My preferred method is following the
CodeAcademy course which lets you interactively solve your
way through puzzle. This is how I began my Python journey.

You might also like