Programming & Scratch.

Slides:



Advertisements
Similar presentations
Sprite-visual object (actor on the stage) Scripts- Tells actors (sprites) what to do.
Advertisements

Introduction to Macromedia Director 8.5 – Lingo
Create a Simple Game in Scratch
My Internet Safety Guide I have used scratch to program a guide to internet safety using QR codes.
Understanding an Apps Architecture ASFA Computer Science: Principles Fall 2013.
Create a Simple Game in Scratch
CHAPTER 5: Repetition Control Structure. Objectives  To develop algorithms that use DOWHILE and REPEAT.. UNTIL structures  Introduce a pseudocode for.
Harry Potter Scratch Game
Intro to Programming Algebra-Geometry. Computer Programming? What is programming? The process of writing, testing, and maintaining the source code of.
CS001 Introduction to Programming Day 3 Sujana Jyothi
Write Your First Computer Game!. Coding: Programming Languages Just like you can speak Chinese to someone who understands Chinese to tell them what to.
Scripts and Flow Control. Scripts So far we have been entering commands directly into the command line But there is a better way Script files (and functions)
Mrs. Chapman. Tabs (Block Categories) Commands Available to use Script Area where you type your code Sprite Stage All sprites in this project.
Mr. Wortzman. Tabs (Block Categories) Available Blocks Script Area Sprite Stage All sprites in this project.
index.php Palmyra Area High School 1.
Scratch the Cat. Object Oriented Programing Writing computer programs Based on Objects Instead of Actions Based on Data Instead of Logic.
INTRODUCTION TO THE SCRATCH PROGRAMMING ENVIRONMENT.
Summer Computing Workshop. Session 4 Loops  At the heart of their functionality, loops enable blocks of code to be executed more than once  Loops represent.
V Avon High School Tech Club Agenda Old Business –Delete Files New Business –Week 16 Topics: Intro to HTML/CSS –Questions? Tech Club Forums.
Study Guide For Test Chapter 5, 6,& 7 Test is Friday, May 15th.
Programming & Scratch. Programming Learning to program is ultimately about learning to think logically and to approach problems methodically. The building.
Programming with App Inventor Computing Institute for K-12 Teachers Summer 2012 Workshop.
Games Development 2 Concurrent Programming CO3301 Week 9.
Scratch Programming Lesson 4 Question asking and answering.
TRIGGERS Triggers tell a script to start executing There are four types of triggers: When green flag is clicked When I am clicked When is pressed When.
GCSE Computing: Programming GCSE Programming Remembering Python.
Controlling Program Flow with Decision Structures.
Scratch for Interactivity Dr. Ben Schafer Department of Computer Science University of Northern Iowa.
Introduction to Scratch We will be using the Scratch Environment today, so please log in to the Scratch website (scratch.mit.edu)
Creating a Simple Game in Scratch Barb Ericson Georgia Tech May 2009.
Scratch Programming Cards
Collision Theory and Logic
Create a Halloween Computer Game in Scratch
August 31 Intro to CS.
Games Programming in Scratch
Scratch for Interactivity
Collision Theory and Logic
Understanding the Geometric Shape Code
Scratch: iteration / repetition / loops
Understanding an App’s Architecture
Unit 2 Getting Started With
Diamond Hunt Mock Programming Project.
Control Structures
Introduction to Events
Iterations Programming Condition Controlled Loops (WHILE Loop)
Scratch for Interactivity
Introduction to Object-Oriented Programming
LESSON 11 – WHILE LOOPS UNIT 5 – 1/10/17.
A Balanced Introduction to Computer Science David Reed, Creighton University ©2005 Pearson Prentice Hall ISBN X Chapter 13 (Reed) - Conditional.
Learning to Program in Python
More Selections BIS1523 – Lecture 9.
Lesson 8: Boolean Expressions and "if" Statements
Learn… Create… Program
Scratch: selection / branching/ if / If…else / compound conditionals / error trapping by Mr. Clausen.
Learn… Create… Program
Algorithm and Ambiguity
Computer Science Core Concepts
ICT Programming Lesson 3:
ICT Gaming Lesson 3.
Flow of Control.
Using Decision Structures
Learn… Create… Program
Learn… Create… Program
Creating a Simple Game in Scratch
A Balanced Introduction to Computer Science David Reed, Creighton University ©2005 Pearson Prentice Hall ISBN X Chapter 13 (Reed) - Conditional.
CSC 221: Introduction to Programming Fall 2018
Problem Solving and Computer Programming
Presentation transcript:

Programming & Scratch

Programming Learning to program is ultimately about learning to think logically and to approach problems methodically. The building blocks out of which a programmer constructs solutions, meanwhile, are relatively simply.

Problem-Solving and Project-Design Skills logical reasoning breaking complex problems into simpler parts debugging problems developing ideas from initial conception to completed project sustained focus and perseverence

Fundamental Ideas about Computers and Programming computer programs tell the computer precisely what to do, step-by-step writing computer programs doesn’t require special expertise, just clear and careful thinking

Programming Common in programming, for instance, are "loops" (whereby a program does something multiple times) and "conditions" (whereby a program only does something under certain circumstances. Also common are "variables" (so that a program, like a mathematician, can remember certain values).

Statements In programming, a statement is simply a directive that tells the computer to do something. Think of it as a command or an instruction. In Scratch, any block whose label reads like a command is a statement.

Statements One such block instructs a sprite to say something:

Statements Another such block instructs a sprite to go to some location:

Sequence To create a program in Scratch, you need to think systematically about the order of steps

Boolean Expression. In programming, a Boolean expression is an expression that is either true or false. In Scratch, any block shaped like an elongated diamond is a Boolean expression. One such block is:

Boolean Expression. Another such block is: After all, it is either true that some number is less than another number or it is false.

Boolean Logic and, or, or not are examples of boolean logic.

Conditions In programming, a condition is something that must be true in order for something to happen. A condition is thus said to "evaluate to true" or "evaluate to false." In Scratch, any block whose label says "if," "when," or "until" is a sort of conditional construct.

Conditions One such block is:

Conditions The previous construct is generally known as an "if construct." With it can we instruct a sprite to say hello only if, say, the user has depressed the mouse button:

Conditions A related construct is the "if-else construct":

Conditions With the previous construct can we instruct a sprite to say hello or goodbye, depending on whether the user has depressed the mouse button:

Conditions Realise that these constructs can be nested to allow, for example, for three different conditions. This construct could be called an "if-else if-else construct".

Conditions Another conditional block is: Yet another such block is:

Conditional Statements if, forever-if, if-else repeat-until and waituntil check for a condition

Loops Sometimes, you want one or more statements to be executed multiple times in a row. To implement this behavior, we turn our attention to loops.

Loops In programming, a loop can induce multiple executions of statements. In Scratch, any block whose label begins with "forever" or "repeat" is a looping construct.

Loops One such block is: This construct allows us, for instance, to instruct a sprite to meow every other second:

Loops Another block allows you to loop a specific number of times: And another block allows you to loop until some condition is true:

Iteration (Looping) forever and repeat can be used for iteration (repeating a series of instructions)

Variables Sometimes, you want execute some statement multiple times, each time varying your behavior ever so slightly. We thus turn our attention to variables.

Variables In programming, a variable is a placeholder for some value. Variables allow us, for instance, to instruct a sprite to count up from 1:

Variables A variable that only takes on a value of true (i.e., 1) or false (i.e., 0), incidentally, is called a Boolean variable.

Variables The Variables category allows you to create a new variable and use it in a program.

Threads In programming, a thread is like a mini-program within a program that can execute at the same time as other threads. One such block is:

Threads It's often helpful to use separate threads for conceptually distinct tasks. For instance, you might want to keep track of whether the user ever presses some key during a program's execution in order to, say, toggle sound on and off:

Threads

Threads Notice how, in the above, the left-hand thread handles meowing, if appropriate, whereas the right-hand thread constantly checks and remembers whether the user has muted or unmuted sound by pressing ’space'.

Threads (Parallel Execution) Launching two stacks at the same time creates two independent threads that execute in parallel.

Events In programming, multiple threads can communicate with each other by signaling events and handling events. An event, then, is like a message from one thread to another. A block that signals an event is:

Events A block that handles an event is:

Events Not only can events be signaled by blocks, they can also be signaled by a user's actions. Clicking Scratch's green flag, for instance, effectively signals an event that is handled by:

Events In Scratch, not only do events enable threads to communicate, they also allow sprites to communicate with each other.

Event Handling when key pressed and when sprite clicked are examples of event handling – responding to events triggered by the user or another part of the program

Synchronisation broadcast can coordinate the actions of multiple sprites. For example, Sprite1 sends the message winner when condition is met:

Synchronisation This script in Sprite2 is triggered when the message is received:

Real-Time Interaction mouse_x, mouse_y, and loudness can be used as dynamic input for real-time interaction

Time Triggering Scratch includes an internal clock that you can access with timer.

Random Numbers The pick random block selects random integers within a given range.

Object-Oriented Programming Each sprite can have its own scripts and data.

User Interface Design You can design interactive user interfaces in Scratch – for example, using clickable sprites to create buttons.

Data Types Different data types (such as numbers and booleans) are represented by different shapes in Scratch