Alterna · учебный материал

Block programming

Block programming: sequences, cycles, conditions, events, sprits and transition to a edited Python.

Что в этом материале

Содержание и основные понятия

Blocks remove the syntax problem, but do not cancel algorithmic thinking. Here, each project opens the structure: an event triggers the script, commands change state, condition makes the decision, cycle repeats action. In the studios, blocks turn into a real Python that can be rewritten and started.
GEF · algorithms
7–9 grade
Scratch-like environment
01
What We Learn
Sequence
Commands are run from top to bottom. The change of two blocks can completely change the result.
Cycles and conditions
Repeat reduces the program, and the condition selects the world's action.
Developments
The flag, key, click, and message run different scenarios for the same project.
Data
Coordinates, direction, speed, count and list of objects form the state of the game.
02
One algorithm in two forms
When the flag is pressed
Set x: 60 y: 200
repeat 3 times
Create a crystal
when the key is pressed
change x or y
if it concerns the crystal
Change account to 1
Equivalent code
def init():
return {"x": 60, "y": 200, "score": 0}
def update(state, event, dt):
if event["key"] == "right":
state["x"] += 24
return state
The studio shows both shapes next to each other. Once Python is generated, it remains the usual redactable source.
03
Headway
33.1 Foundation
Blocks and algorithms
Sequence, parameters, cycles, conditions and trajectory.
33.2 Interactivity
Events and Sprays
Status, coordinates, processors and parallel scenarios.
33.3 Project
Block Studio
Visual blocks, Python generation, code editing, and game window.
33.4 · verification
Workshop
Tracking, searching for mistakes, and four project missions.
04
A fair draft rule
It's not just a drag.
The final result should be accompanied by an explanation: what event triggers the scenario, where the state is stored, what condition changes the program and which piece Python corresponds to the selected blocks.

Structural map of textbooks