0% found this document useful (0 votes)
214 views

ITC LAB 6 - Scratch + Algorithms

This document introduces block-based programming and algorithms. It discusses block-based languages like Scratch and Blockly. It provides an overview of Scratch including sprites, backdrops, scripts, motion blocks, and creating a simple conversation between two sprites. It defines what an algorithm is and provides examples of writing algorithms in Scratch, including animating letters of a name and a click-the-balloon game. The lab tasks at the end instruct students to write algorithms and block codes for these examples.

Uploaded by

pathway
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
214 views

ITC LAB 6 - Scratch + Algorithms

This document introduces block-based programming and algorithms. It discusses block-based languages like Scratch and Blockly. It provides an overview of Scratch including sprites, backdrops, scripts, motion blocks, and creating a simple conversation between two sprites. It defines what an algorithm is and provides examples of writing algorithms in Scratch, including animating letters of a name and a click-the-balloon game. The lab tasks at the end instruct students to write algorithms and block codes for these examples.

Uploaded by

pathway
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

Introduction to Computing LAB 6: Block based Programming and Algorithm

LAB # 6
Introduction to Block Based Programming and Algorithm
Objectives:
 To learn the logic building in programming
 To learn how computer follow instructions
 To write an algorithm before programming

Block-based-programming:

Block-based programming also known as block based-coding, is a type of programming language


where instructions are mainly represented as blocks. Block based coding involves dragging ‘blocks’ of
instructions.

Following are the examples of languages that are block-based:


 Scratch
 Blockly
 Elemental (still in development)

Introduction to Scratch:
Scratch is a visual programming language that allows students to create their own interactive stories,
games and animations. As students design Scratch projects, they learn to think creatively, reason
systematically, and work collaboratively. Scratch was created by the Lifelong Kindergarten group at
MIT Media lab and is available for free download at https://scratch.mit.edu. Once Scratch is
downloaded to a computer, you do not need Internet access to create a project.

1
Introduction to Computing LAB 6: Block based Programming and Algorithm

From main screen you can create new projects, explore other people's projects, catch up on what your
friends have been doing, and access your own projects.
Create New Project:
Every time you create something in Scratch, you'll be working on a project. You can create as many
projects as you like, share them and copy them. Each project stands alone and can't be linked to other
projects.

The project window includes a few key areas:


 The stage, with a cat sprite in place which you can work with or delete.
 Below the stage, the backdrops and sprites you're using in your project.
 To the left of the stage, the scripts pane. This contains blocks of code (called scripts) that you can
use in your project. This pane has two more tabs: Costumes and Sounds.
 The canvas, which is where you place your scripts and create or edit costumes and sounds. You
can place multiple scripts on the canvas.

Scripts:
Scripts are what make your assets do stuff in Scratch. They consist of blocks of code that you drag into
position on the canvas, and come under ten categories:
1. Motion: scripts that position your sprites and make them move.
2. Looks: scripts that change the way your sprites look, including changing their costume and
hiding them.
3. Sound: scripts to play sounds and change the volume.
4. Events: these make things happen, and include the start flag being clicked, the user clicking on
a sprite or a broadcast which you can create and have your sprites react to.

2
Introduction to Computing LAB 6: Block based Programming and Algorithm

5. Control: these include loops, conditional statements and pauses.


6. Sensing: these scripts sense when things happen such as the mouse being used or sprites
touching each other. They also include interactions such as asking the user a question.
7. Operators: use these to compare values, maybe based on your user's response to a question or
on a variable you've defined. For example, you might count the number of times the user clicks
on the wrong thing and use an operator to check when this reaches a given number so you can
display a message.
8. Variables: you can create new variables, set, change, show and hide them.
9. More Blocks: this is where you add your own custom blocks.

What is Motion
When we say that something is in motion, we usually mean that it is moving. But motion has a special
meaning in science. In science, motion is a change in position compared to a place or an object that is
not moving. The place or object that is not moving is called the frame of reference.

First Project Step by Step:


1. Drag when clicked block from Events blocks into the script area.
2. Then drag move 10 steps block from the Motion blocks into script area.
3. Now click on green flag to start program.
4. After clicking on green flag again and again you will see the cat continuously move 10 steps on
script.

3
Introduction to Computing LAB 6: Block based Programming and Algorithm

Now we are going to create a little story with two sprites with using looks block.
Steps:
Add 2 Sprites, Cat and Butterfly.
Then code cat with these set of blocks.

And code butterfly with following screenshot.

Now click on green flag to start program.


After clicking on green flag the little talk between two sprites will run for few seconds.
What does wait block do ?

The Wait block pauses the script for the specified amount of seconds.

Changing the Backdrop:


Before we make our more programs, let’s change the background of the Stage to something more
inspiring.
- To the left of the Sprites List, there is a panel for the
Stage. Underneath the heading New Backdrop, click the
first icon to choose a backdrop from the library. The other
icons enable you to paint a backdrop, upload a picture
from your computer, or use your webcam to take a photo.
- When the library opens, click the themes and categories
on the left to view different backdrops available, and use
the scrollbar on the right to see more designs.

4
Introduction to Computing LAB 6: Block based Programming and Algorithm

- Click the image you want to choose, and then click the
OK button.
- Your backdrop is added to the Stage, behind the cat, and
the Paint Editor opens on the right so you can edit the
background if you want to.
Backdrop Library

What is Algorithm?
The word algorithm derives from the name of the mathematician, Mohammed ibn-Musa al-
Khwarizmi, who was part of the royal court in Baghdad and who lived from about 780 to 850. Al-
Khwarizmi's work is the likely source for the word algebra as well.
An algorithm is a set of well-defined instructions in sequence to solve a problem.
Algorithms can be widely used in various areas, computer programming, mathematics and daily lives.

STEPS:
1: Drag when flag clicked block from Events into the script area.
2: Then go to the Sensing block and select the ask name and wait block and arrange it right below the
when flag clicked block.
3: Then go to the Looks section which is the purple section and drag the say Hello for 2 seconds and
arrange it right below.
4: Now insert join block from Operators block into the say hello block on hello column.
5: Then go again to the Sensing block and select the answer block and insert into the banana section
and write Hello in the apple section.

5
Introduction to Computing LAB 6: Block based Programming and Algorithm

When we type answer in text box, it will join your answer with Hello… like this,

6
Introduction to Computing LAB 6: Block based Programming and Algorithm

Lab Task

6.1) Write an algorithm for to Animate your name with separate letters sprite.

6.2) Create a block code to Animate your name with separate letters sprite.

6.3) Create a block code that runs horse with moving clouds effect. Select Unicorn sprite and
change its costumes to make it moving.

6.4) Create a block of code for click the balloon game to pop it with sound effect at random position.

6.5) Write an algorithm for click the balloon game to pop it with sound effect at random position.

Note: Attach a snap shot of every above mentioned task.

You might also like