Input Repeat until Concatenation

Slides:



Advertisements
Similar presentations
Harry Potter Scratch Game
Advertisements

1 An intro to programming concepts with Scratch Session 3 of 10 sessions Repetition and variations.
1 An introduction to programming concepts with Scratch.
1 An introduction to programming concepts with Scratch (in 5 hours + homework)
ITEC Winter An intro to programming concepts with Scratch Quick intro for college citizens. George Stockman MSU CSE.
Fish Chomp. The screen where you can see what happens when you play your game is called the STAGE. The SCRIPT BANK is where the types of instructions.
Meet Me on Mars Lesson 7 Variables and Messages. Events and Variables 1. Click the _________ button 2. When ________ clicked, set ______ to ____ 3. Now,
Code Club Session 2 Dance Party. What will we learn ?  How to change the background  How to create animations  How to make objects talk to each other.
 Make sure you are subscribed to announcements on Moodle.  Activity 4 will be due 48hrs after your lab ends.
Objects and Methods in Scratch 1. 2 Scratch environment Stage is at upper right (where actors act and information is displayed) Sprite is another name.
Learning the skills for programming Advanced Visual Programming.
Scratch Programming Lesson 4 Question asking and answering.
 There are times when you will want blocks to repeat. Instead of duplicating blocks and ending up with a long script that might be confusing, there.
Fish Chomp. The screen where you can see what happens when you play your game is called the STAGE. The SCRIPT BANK is where the types of instructions.
Computer Programming Modeling a Passive Solar Home.
Marble Racer. The screen where you can see what happens when you play your game is called the STAGE. The SCRIPT BANK is where the types of instructions.
Introduction to Computer Programming - Project 2 Intro to Digital Technology.
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.
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.
Creating a Simple Game in Scratch Barb Ericson Georgia Tech May 2009.
Introducing Scratch Learning resources for the implementation of the scenario
Objective of the lesson Use Blockly to make a dice for Snakes and Ladders All of you will: – Make an image which displays when you press a button Most.
BEGINNER PROGRAMMING LESSON
Scratch Programming Cards
Create a Halloween Computer Game in Scratch
Customise & Explain your game
Broadcasting (Adding a new level)
Games Programming in Scratch
Scratch for Interactivity
Making coffee Start or stop Process Decision Input/output Start
Madlib-Input, Strings, and Lists in Scratch
Mission: design a Virtual interactive tour guide with scratch
Scratch 7B IT1.
Spanish Mad libs with Scratch
ECS 9/7/17.
Intro to CS Monday, August 29
Intro to CS Monday, August 24
Cosmic Chorus Green Book, Ch 5.
Scratch I - Overview.
CLICK HERE TO BEGIN THE GAME!!
Introduction to Object-Oriented Programming
Scratch Programming Intro
Dance Cards Dance Cards
Creating Variables Output Logic flow Operators (More) Basic blocks
Module 5 Lesson 3 Extreme Scratch Cards
Dance Cards Dance Cards
Dance Cards Dance Cards
Cosmic Chorus.
Dance Cards Dance Cards
Dance Cards Dance Cards
Lesson 1 Introduction to Scratch Basic blocks
Introduction to TouchDevelop
Learning about Conditional Selection
(More) Basic blocks Broadcasting messages
Go to =>
An intro to programming concepts with Scratch
Exploring Computer Science – Lesson 4-5
Chapter 3: Selection Structures: Making Decisions
Variables & getting info from the user
Exploring Computer Science Lesson 4-12
Chapter 3: Selection Structures: Making Decisions
Sensing and Variables.
Hint idea 2 Split into shorter tasks like this.
Creating a Simple Game in Scratch
CSC 221: Introduction to Programming Fall 2018
Basic program gives only one quess and then the program ends.
Exploring Computer Science Lesson 4-12
Presentation transcript:

Input Repeat until Concatenation Lesson 4 Input Repeat until Concatenation

Recall… Variables Events Looks Use: store the value of something Directly give a value to the variable Adding/subtracting a number from the value of the variable Events Looks

Recall… Control blocks Operators

Input (sensing) Ask a question and allow the user to input the answer Input value stored

Repeat until (control) Repeat the following commands until (something) is correct. E.g. You deposit $500 in a bank at an interest rate of 5% p.a. compounded yearly. You will take the money out when the amount is greater than $1000.

Concatenation join the words together You need to use this when you want to join words stored in different variables/typed text. E.g. Name = Mary Compare the output of these two blocks: My name isMary My name is Mary.

Exercise 4 (開口中) How to play: The player has to guess a number from 1 to 100. The range of guessing will be narrowed down based on the number guessed by the player. The game continues until the player guesses the number.

Exercise 4 Example: The secret number is 35. The FLOWCHART of the program can be found in the pdf file. Example: The secret number is 35. (starting range: 1 – 100; lower bound=1, upper bound=100) 1st time: If the player guessed 50, then the player is asked to guess again from 1 to 50. (Guiding question: when the number guessed is greater than the secret number, is the lower bound/upper bound changed?) 2nd time: If the player guessed 20, then the player is asked to guess again from 20 to 50. (Guiding question: when the number guessed is less than the secret number, is the lower bound/upper bound changed?)

Exercise 4 Hint: asking the player to guess again between 2 numbers: Your task: The computer randomly picks a number from 1 to 100. Then one sprite (grizz) will ask the player to guess the secret number. (Hey. Guess the secret number between 1 and 100.) Check if the number is correct or not. If not, ask the player to guess again from a correct range. Hint: asking the player to guess again between 2 numbers: Join “The secret number is between ” (lower bound) “ and ” (upper bound) “. Guess again!” Words to be typed: “xxx”; Variables: (xxx) The game continues until the player input the correct number.

Exercise 4 Features to be included: You may need to use this: to stop the music playing when game ends. Features to be included: Background music (We Bare Bears-Intro HD.mp3) (stop music when the game ends) Change backdrop when starting a new game. Grizz (with costume “grizz”) moves front and back during the game. When the player got the correct answer, play drum roll (play drum 1) and then a crash cymbal (play drum 4). Change the costume of Grizz to “grizz_excited”, then say “You got it!” (add this block), and play “yeah”. [Hint: use broadcast]

Exercise 4 Bonus Features: The other sprite (ice bear) represents the player, saying the answer input. Ice bear “thinks” while waiting for the input. If the player (ice bear) got the correct answer within 5 times, ice bear says “Ice bear meant to do that.” and play sound “meant to do that” at the same time. Grizz grumbles (play sound “grunt”) when the no. of trials is a multiple of 3. Replay button (must be on click) If the answer input is not within the range, Grizz should warn the player. (The no. of trials does not increase by 1.)