Download presentation
Presentation is loading. Please wait.
1
Marty the Robot
2
Lesson 1 – Introduction to Marty the Robot
By the end of this lesson you will be able to, Describe what a robot is Describe what things you think Marty can do Create a program to control Marty using Python Predict what will happen before running small Python scripts
3
Is a Printer a Robot??
4
What is a Robot? A robot is a machine that can carry out a number of tasks automatically that can usually be programmed by a computer.
5
What movements do you think Marty can do?
6
Predict what you think the following commands will do…
7
mymarty.walk()
8
mymarty.kick(‘right’)
9
mymarty.stop()
10
mymarty.lean(‘forward’,200,3000)
11
mymarty.sidestep(‘left’,26,3000)
12
mymarty.circle_dance(‘right’,3000)
13
Try programming Marty using Python to move into some of the poses using the Marty Says cards. Here are a few examples of the poses..
19
Lesson 2 – Marty Dance Party
By the end of this lesson you will be able to, Write loops or repeat statements using Python Predict the outcome of a Python script using a loop Understand when to use loops whilst programming
20
Yesterday we started making small programs like this…
mymarty.walk() mymarty.sidestep(‘left’,26,1000) Can you see any patterns in this code snippet? What moves do you think this would make me do?
21
We can use loops to make this neater and easier to read!
for x in range(2): mymarty.walk() mymarty.sidestep(‘left’,26,1000)
22
How would we rewrite this code snippet to make use of loops?
mymarty.walk() mymarty.kick(‘left’) mymarty.kick(‘right’)
23
for x in range(2): mymarty. walk() mymarty. kick(‘left’) mymarty
for x in range(2): mymarty.walk() mymarty.kick(‘left’) mymarty.kick(’right’) mymarty.kick(‘right’)
24
Challenge: Marty Dance-Off!
25
Lesson 3 – Building a Marty Remote Control
By the end of this lesson you will be able to, Explain if statements using real life examples Create a small program using if statements with Python Explain a Python script that uses if statements and predict what will happen
26
If Statements IF there is a green man present
THEN it is safe to cross the road
27
If Statements IF I have done all of my chores
THEN I can get my pocket money
28
If Statements If today is Monday THEN I have math homework to do
ELSE IF today is Wednesday THEN I have English homework to do ELSE I have no homework to do
29
Can you think of any other examples?
30
What do you think the outcome of the following code snippets will be?
value = 10 dayOfTheWeek = ’Monday’ if dayOfTheWeek == ‘Monday’: value = value * 10 else: value = value – 5 print(value)
31
What about... value = 10 dayOfTheWeek = ’Sunday’ if dayOfTheWeek == ‘Saturday’ OR dayOfTheWeek == ‘Sunday’: value = value + 50 else: value = 0 print(value)
32
Or... value = 10 dayOfTheWeek = ‘Tuesday’ homework = true if dayOfTheWeek != ‘Saturday’ AND dayOfTheWeek != ‘Sunday’: if homework == true: value = value * 10 else: value = value * 2 else: value = 0 print(value)
33
Try programming Marty using if statements to decide on what his behaviors should be
IF it’s Monday, Wednesday OR Friday then dance ELSE show angry eyes IF it’s sunny outside THEN take 3 steps forwards ELSE IF it is raining THEN take 2 steps backwards ELSE take 1 step to the left IF it’s Monday AND it’s raining outside THEN show angry eyes ELSE IF it’s NOT Monday AND sunny outside THEN dance ELSE take 1 step to the left
34
Functions! Look at the following code and predict the values of the 2 variables multiplier and count
global multiplier = 2 def multiply(count): return count * multiplier count = 3 multiplier = multiplier + 2 count = multiply(count)
35
Create a remote control program where users can type in commands to control what movements Marty makes
36
Lesson 4 – Obstacle Course Challenge
By the end of this lesson you will be able to, Explain what kinds of things we use robots for and the environments they usually work in Program Marty to go around an obstacle course using Python
37
What kinds of things do you think we can use robots for?
38
Try researching 2 kinds of robots and take note of the following in your workbooks
Robot Name What it does Where you would find it Draw a picture of it
39
Repeat statements / Loops
So far we have covered a few different programming concepts – can you think of when you would use each of them? Repeat statements / Loops If Statements Functions
40
1. Design an obstacle course that Marty could go around in your workbook 2. Build your obstacle course in groups 3. Plan out how Marty will tackle the course by using your remote control to walk him around 4. Finally, program him to do it automatically without your input Don’t forget to think about what kind of movements I can make so you can design obstacles that I can go around!
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.