Scratch programming

47 465 0
Scratch programming

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

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 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: 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 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 ... 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... certain values) Statements In programming, a statement is simply a directive that tells the computer to something Think of it as a command or an instruction In Scratch, any block whose label... 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

Ngày đăng: 07/07/2017, 09:35

Từ khóa liên quan

Mục lục

  • Programming & Scratch

  • Programming

  • Problem-Solving and Project-Design Skills

  • Fundamental Ideas about Computers and Programming

  • Slide 5

  • Statements

  • Slide 7

  • Slide 8

  • Sequence

  • Boolean Expression.

  • Boolean Expression.

  • Boolean Logic

  • Conditions

  • Slide 14

  • Slide 15

  • Slide 16

  • Slide 17

  • Slide 18

  • Slide 19

  • Conditional Statements

Tài liệu cùng người dùng

Tài liệu liên quan