Exploring Computer Science Lesson 4-8

Slides:



Advertisements
Similar presentations
Careers WORKSHOP #2 COMPUTER SKILLS BUILDING A PRESENTATION.
Advertisements

Code Club Session 3 Shark Eats Fish. Picture of finished product here.
Write Your First Computer Game!. Coding: Programming Languages Just like you can speak Chinese to someone who understands Chinese to tell them what to.
Racing Car Game Using the keys to control a sprite.
Execution Control with If/Else and Boolean Functions Example: Single Condition Alice.
Meet Me on Mars Lesson 7 Variables and Messages. Events and Variables 1. Click the _________ button 2. When ________ clicked, set ______ to ____ 3. Now,
Programming 3/16/15 3/16 Looping, Arrays, Objects 3/17 Object-Oriented Design and Becoming a better Programmer 3/18 Introduction of Conditionals 3/19 Introduction.
CATCH SCRATCH! Programming from Scratch. Remember Scratch?
Execution Control with If/Else and Boolean Functions Sec 52 Web Design.
Execution Control with If/Else and Boolean Questions Part 1 Alice.
PowerPoint Computer Solutions 1. Multimedia A powerful blend of text, graphics, sound, animation, and video on your computer.  Multimedia is an effective.
Timers Exploring Computer Science Lesson Objectives The students will be able to: Create a timer.
Exploring Computer Science 2/23/15 2/23 Develop a Scratch story project -Brainstorming 2/24 Develop a Scratch story project –Developing 2/25 Develop a.
Exploring Computer Science 2/16/15
My Scratch Story Exploring Computer Science Lesson 4-7.
Exploring Computer Science 2/9/15 2/9Moving Scratch 2/10Moving Scratch worksheet 2/11 Scratch Baseball Game 2/12Scratch Alphabet Learning Game 2/13Game.
2015 CSE/EGR Summer Camps 1 Computer Science Concepts 1. What is an algorithm? 2. Binary information coding 3. Programming concepts via Scratch Designed.
Exploring Computer Science 2/2/15 2/2No School 2/3Scratch creating a program- Name 2/4 Scratch creating a program Dialogue 2/5 Scratch creating a dialogue.
Moving Sprites in Scratch Exploring Computer Science – Lesson 4-4.
Scratch Dialogues Exploring Computer Science – Lesson 4-3.
PowerPoint Lesson 4 Part A - Slide Transitions Save this to your computer folder. Go to the Animations ribbon. Choose a transition to this slide.
How to create a basic game in Scratch. The Scratch Stage The Scratch stage is 480 pixels wide and 360 pixels high x increasesx decreases.
Moving Sprites in Scratch Exploring Computer Science – Lesson 4-4.
Introduction to Programming with Scratch Exploring Computer Science – Lesson 4-1.
Randomness Exploring Computer Science Lesson 4-10 – Part 2.
Phase 3: Game Creation. Phase 3: Game Creation Outcomes (Slide 1) I can create a flowchart to solve a problem, for example to make a cup of tea. I can.
Event Driven Programs Exploring Computer Science – Lesson 4-5.
DAY 4. MAKING SOMETHING ‘JUMP’ Simple! Move it a certain amount ‘up’ Glide back to your original spot.
Movement Game Design (Scratch).
Customise & Explain your game
Commands in Scratch.mit.edu
Scratch for Interactivity
How to create a custom movie in Windows Movie Maker
Madlib-Input, Strings, and Lists in Scratch
Scratch 7B IT1.
Exploring Computer Science Lesson 4-7
Spanish Mad libs with Scratch
Execution Control with If/Else and Boolean Functions
Exploring Computer Science – Lesson 4-5
Exploring Computer Science Lesson 4-13
Exploring Computer Science Lesson 4-14
Exploring Computer Science Lesson 4-10 – Part 1
Games Programming in Scratch
Scratch Programming Intro
Broadcasting Exploring Computer Science Lesson 4-6.
EXPLORING COMPUTER SCIENCE
Programming Final Project
Broadcasting Exploring Computer Science Lesson 4-6.
And and or…and RANDOMNESS
Moving Sprites in Scratch
Exploring Computer Science Lesson 4-13
Exploring Computer Science – Lesson 4-5
Exploring Computer Science – Lesson 4-3
Conditionals Exploring Computer Science Lesson 4-9.
Programming Final Project
Exploring Computer Science Lesson 4-7
Code to Enhance Learning
Game Over Module 4 Lesson 2.
Exploring Computer Science Lesson 4-12
Windows Movie Maker Tutorial
Exploring Computer Science Lesson 4-10 – Part 2
Exploring Computer Science Lesson 4-14
Exploring Computer Science Lesson 4-13
Creating a Simple Game in Scratch
Lesson Ten Lists.
Lesson Nine Variables.
PowerPoint Lesson 4 Slide Transitions & Custom Animation
Exploring Computer Science Lesson 4-12
Exploring Computer Science Lesson 4-8
Exploring Computer Science Lesson 4-10 – Part 1
Presentation transcript:

Exploring Computer Science Lesson 4-8 Variables Exploring Computer Science Lesson 4-8

Objectives The students will be able to: Explain the concept of variables. Create examples of variables. Explain the concept of iteration. Create examples of iteration.

Discussion What does the word variable mean in both mathematical and English terms?

Variables Look at this example: x + 3 = 5 Look at this example: 2x= 12 What is the variable? What is the value of x? Look at this example: 2x= 12 Why isn’t “x” the same in both cases?

Variables in Programming A variable is a name that represents a value that can be changed.

Open Scratch! You are going to build the beginning of a Scratch game. The program will reward you with points when you choose a good food and take points away when you choose a bad food.

Add Text and Sprites Create a solid color background. Add the text “Click on a food to eat it” to the background. Add sprites for bananas and cheesy-puffs.

Adding a Variable Click on “Variables”. Click on “Make a Variable”. Name the variable “Good Nutrition Points” and set it for all sprites.

Adding Nutrition Points I want to add a point when the Banana sprite is clicked. With the Banana sprite selected, add this block: Adding 1 to a variable is called iteration.

Subtracting Nutrition Points I want to subtract a point when the Cheesy-puffs sprite is clicked. With the Cheesy-puffs sprite selected, add this block:

Initializing the Variable We want the Nutrition Points to be set to zero when the game starts. Add this block to any sprite:

Customize Your Program! Add a food that is worth 2 points when clicked. Add a food that is -3 points when clicked. Show me your program when you’re done. For extra credit, separate your 1-scene program into 3 scenes with different backgrounds: title, instructions and game itself.

The Good Nutrition 1 Program Rubric Do you… Points Possible What Do You Think? Have a background with text instructions? 5   Have two food sprites, one healthy and one unhealthy? Have a variable with the name ‘Good Nutrition Points’? Have an event block with an iteration block for sprite one? 15 Have an event block with an iteration block for sprite two? Have an reinitializing event block with reinitializing iteration block? Have a 2nd healthy food sprite that iterates by +2? 20 Have a 2nd unhealthy food sprite that iterates by -3? EXTRA CREDIT Separate your 1-scene program into 3 with different backgrounds: Game title, instructions and game-playing scenes. TOTAL: 100

Conditionals Exploring Computer Science Lesson 4-9

Objectives The students will be able to: Explain the concept of conditionals. Enhance a variable program with conditionals.

Discussion How would you finish a knock-knock joke when the third line begins with “If”? What are some ways we use the word “if” in English?

If Statements in Computing If you have started to think about building animations like simulations and video games, then to build those more advanced programs, you will need to write code that involves decisions: If (some condition), then (do this).

Examples When you exit Microsoft Word, it asks you if you want to save your file. If you click “Yes”, the file is saved. If you click “No”, your changes are discarded. In a car-race simulation, the driver steers the car around curves and past mile-markers. If the car stays on the road, the score increases. If the car goes off the road into the stands, the car crashes. If the driver gets the car over the finish-line, the time is posted and the driver wins!

Scratch “if” Block The Scratch “if” block looks like this: Note that only a hexagon shaped block will fit.

Example What does this program do?

Expand the Program Currently, it only does the first condition. Your task is to finish the program so that the cat will tell you the rest: If you are older than 2, “You don't need diapers." If you are older than 15, “You can drive." If you are older than 16, “You can see an R-rated movie." If you are older than 17, “You can vote." If you are older than 20, “You can gamble." If you are older than 24, “You can rent a car." If you are older than 49, “You can retire.“ Finally add: If the age is less than 3, "Sorry. You are not old enough for anything yet!"

Age Program Rubric Do you… Points Possible What Do You Think? Have an age variable with slider? 10   Have a sprite saying when you don’t need diapers? (greater than 2) Have a sprite saying when you can drive? (greater than 15) Have a sprite saying when you can see an R-rated movie? (greater than 16) Have a sprite saying when you can vote? (greater than 17) Have a sprite saying when you can gamble? (greater than 20) Have a sprite saying when you can rent a car? (greater than 24) Have a sprite saying when you can retire? (greater than 49) Have a sprite saying when you’re not old enough for anything yet? (less than 3) Have proper grammar, spelling, punctuation, capitalization, etc.? EXTRA CREDIT Separate your 1-scene program into 3 with different backgrounds: Program title, instructions and age-sliding scenes. 15 TOTAL: 100

Enhance Your Nutrition Program Enhance your Nutrition program by: Adding a message about being nutritious if the number of points becomes greater than 9. Adding a message about eating healthier food if the number of points becomes less than -4. A sprite can say these messages or you can use broadcast to change the sprites/stage to convey the messages. For extra credit, use both broadcast AND a sprite to convey the messages.

The Good Nutrition 2 Program Rubric Do you… Points Possible What Do You Think? Have a message about being nutritious if the number of points becomes greater than 9? 30   Have a message about eating healthier food if the number of points becomes less than -4? Have a sprite saying these messages OR Have broadcast changing the stage/backdrop in order to convey these messages? (FOOD SPRITES MUST HIDE!) Have proper grammar, punctuation, spelling, capitalization, etc.? 10 EXTRA CREDIT Use both broadcast with changing stages AND a sprite to convey the messages. 15 TOTAL: 100