0% found this document useful (0 votes)
40 views27 pages

Programming L4

The document outlines a lesson plan focused on designing programming structures using logical and relational operators for students. It includes instructions for a silent starter activity, tasks for explaining code, and creating a basic game using Scratch that incorporates these operators. Additionally, it covers advanced mathematical operators and concludes with a plenary to define logical and relational operators.

Uploaded by

sm0004837
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
40 views27 pages

Programming L4

The document outlines a lesson plan focused on designing programming structures using logical and relational operators for students. It includes instructions for a silent starter activity, tasks for explaining code, and creating a basic game using Scratch that incorporates these operators. Additionally, it covers advanced mathematical operators and concludes with a plenary to define logical and relational operators.

Uploaded by

sm0004837
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 27

Silent Starter

1. Sanitise and log into Office 365

2. Download the lesson presentation directly to


OneDrive.

3. Move to the <Week 31> folder inside your Computing


folder.

4. Read the lesson objectives and complete the silent


starter.

1
LESSON OBJECTIVE: In this lesson, you will design programming structures using logical and relational
operators.

Grade: 7.4
Describe and use the following symbols: AND, OR, NOT, >, <,
=.
K
N
O
Grade: 7.5
W
AP

LE
EVALUATIO

PL

Explain how logical and relational operators can be used in


D
G
IC

E
the programming of games.
A NA

AT
I ON
LYSI

Grade: 7.6 - 7.7


N

Create a game that uses both logical and relational


operators.

Grade: 7.8 – 7.9


Show an understanding of the advanced mathematical
operators MOD, ROUND and the drop down operators.

2
Silent Starter
This lesson you will be using operator blocks.
Drag and drop the correct description next to the correct operator.

The result is true if the expression is false.

Less than. Determines if the first number is less than


the second number.

Greater than. Determines if the first number is


greater than the second number.

The result is true if either of the two expressions is


true.

The result is true only if the two expressions are true.

Equal to. Determines if two values are equal.


3
Operator blocks
Scratch has 3 operators that allow you to
compare the relationship between two values.

It will compare the two and decide whether it is


true or false.

4
Operator blocks
Using logical operators, you can combine two or
more relational operators to produce a single true/false
result. Using these blocks allow you to further refine your
comparison of values.
There are 3 logic
operators:​
•And​
•Or​
•Not

5
Task 1a – Explain the code

Look at the following


blocks of code on the
next few slides that
include relational and
logical operators. In the
purple text box, write
down what you think
the code will do.

Answer…

6
Task 1b – Explain the code

Answer…

7
Task 1c – Explain the code

Answer…

8
Task 1d – Explain the code

Answer…

9
Task 1e – Explain the code

Answer…

10
Task 1f - Explain the code

Answer…

11
Task 2: Viewing a game
Click on the following link below:

https://scratch.mit.edu/projects/112
41535/editor/

Analyse the code for the soccer


ball, and how it makes use of the
AND, OR NOT logical operators.

Add the block to these


blocks of code.

Click the green flag to test the


game.
12
Task 3: Creating a
game
You will now create a basic game that incorporates
the use of both logical and relational operators.

Open https://scratch.mit.edu/ and click Create.

Follow the instructions starting below:

1. Delete the cat sprite (right click and


delete or click on the small x in the
top left corner of the sprite).​

2. Add a sprite & backdrop of your


choice
13
Task 3: Creating a
game
3. The first part of our game
involves us telling the user what
the game is about. We need to
have our sprite say a few words
when the ‘Green Flag’ is
pressed. Add the following code to
your sprite:

4. Click on the Variables


category and select ‘Make a
variable’.

5. Give this variable a name like


‘NumberToGuess’, this will be the
number that the computer has 14
Task 3: Creating a
game
6. We are going to set the variable to a random
number, you can pick how hard your game is
going to be by changing the range of the
random numbers. I’ve picked 1 – 10, meaning
that the computer could pick a number
between 1 and 20.

Add the following block to the bottom of your


code:

7. After we have stored our number in a


variable, it’s time to ask the user for their first
guess.
We use the blue ‘Ask’ block for this (under the
sensing tab). The block will ask the user a
question and wait for the user to respond by
typing something into the text box.
15
Task 3: Creating a
game
8. Add the following code to your sprite. 9. Now the only
other possible case is if
the player picks the
same number
that the computer picked.
In this case, we are going
to use the equals sign.​

Test this out.

What is missing from our


game at this point?

16
Task 3: Creating a
game
10. We only give the player a single
chance to guess the number. We really
need to give the player more chances.

We want the player to always be guessing


a number until they pick the correct
number.

If we always want to be doing something,


then we should be using the forever block.

Add the forever block around the following


code like so:

17
Task 3: Creating a
game
11. Let’s keep count of how many guesses they take
before they reach the correct number. Add a new
variable called ‘Guesses’:

12. We need to make sure that our game resets


the number of Guesses to zero when it first runs.
Under the hat block, add the Set. We made it 1,
because it will take at least one guess to pick the
correct number.

18
Task 3: Creating a
game
13. Now we want to stop the game if the player
picks the correct number, so add the ‘Stop All’
block inside the equals if block section.

19
Task 3: Creating a
game
14. Next, we need to tell the player
that they need to pick another
number, so ask them to try again.

We also need to tell the player that


they need to pick another number, so
ask them to try again.

We need to make sure that the first


‘Ask’ block is removed from the
‘forever’ block, we only want to ask
that question once, after the first
attempt we will say ‘try again’.

Add the following code:

20
Task 3: Creating a
game
15. We need to give our players some reward
for picking the correct number. This could be
a cheering sound or maybe it could be some
really cool visual trick.

I’ve done something cool to my chick:

I have also let the player know how many


guesses they took.

We need to make sure this is just above the


‘Stop All’ block.

21
Task 3: Creating a
game
16. Finally, we need to hide our ‘NumberToGuess’ variable so it
doesn’t appear on the stage.

Go to the Variables category and untick ‘NumberToGuess’.

You should only see the ‘Guesses’ variable on your stage.

17. You can now test your game and make sure it is working.
22
Task 3 – Guessing Game Evidence

23
Show an understanding of the advanced
Extension 1 mathematical operators MOD, ROUND and
the drop down operators.

Write a description for the operator blocks


above.
MOD operator ROUND operator Drop Down
operator

You can use the following link to help you:


https://en.scratch-wiki.info/wiki/Operators_Blocks 24
Extension 2 Show an understanding of the advanced
mathematical operators MOD, ROUND and
the drop down operators.

Find an example of how they could be


used in Scratch.
MOD operator ROUND operator Drop Down
operator

You can use the following link to help you:


https://en.scratch-wiki.info/wiki/Operators_Blocks 25
26

Plenary
Define logical operators and give three examples of
logical operators:

Define relational operators and give three examples


of relational operators: SUCCESS
3.
1. Use your 5.
7.
Save and wipe to sanitise, Align desk,
Throw wipe in
Upload your chair, desk, keyboard and
yellow bin on
work keyboard & mouse. monitor.
exit from class.
6.
2. 4. Stand in silence
Sign out of the Chair under behind your
Computer the desk. chair.

n e !
o n Do
Less

27

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy