Large Problem
Hosting Class Concert Smaller Problem
Guests Smaller Problem
Scenario Smaller Problem
Logistics Lesson 4 Top-Down Design and Variables
What is Top Down Design?
Large Problem
Hosting Class Concert Smaller Problem
Guests Smaller Problem
Scenario Smaller Problem
Logistics Smaller Problem
Who? Smaller Problem
Invites Smaller Problem
Who? Smaller Problem
Numbers Smaller Problem
Time Smaller Problem
Space Lesson 4 Top-Down Design and Variables Lesson 4 Top-Down Design and Variables
Example: Chess Board
Draw a chess board with 8 rows and 8 columns. Use “black” and “light yellow” colors.
Lesson 4 Top-Down Design and Variables
Example: Chess Board
Big Problem: Draw 8 Rows of 8 Squares
Smaller Problem: Draw Row of 8 Squares
Smallest Problem: Draw 1 Square
Lesson 4 Top-Down Design and Variables
Example: Chess Board
Move Turtle to starting position
Lesson 4 Top-Down Design and Variables
Example: Chess Board
Move Turtle to starting position
Draw one black square
Lesson 4 Top-Down Design and Variables
Example: Chess Board
Move Turtle to starting position
Draw an odd row of 8 squares:
Repeat 4 times:
Draw one black square
Move forward
Draw one yellow square
Move forward
Lesson 4 Top-Down Design and Variables
Example: Chess Board
Move Turtle to starting position
Draw an odd row of 8 squares:
Repeat 4 times:
Draw one black square
Move forward
Draw one yellow square
Move forward
Move up to the next row
Lesson 4 Top-Down Design and Variables
Example: Chess Board
Move Turtle to starting position
Repeat 4 times:
Draw an odd row of 8 squares:
Repeat 4 times:
Draw one black square
Move forward
Draw one yellow square
Move forward
Move up to the next row
Draw an even row(same logic)
Move up to the next row
Lesson 4 Top-Down Design and Variables
What is a Variable?
Variables allow us to store information (text or numbers) that can be used and altered in our code.
We can use variables to control many parts of our code, from the distance we move Turtle to the color of it’s trail!
informatics
4-term
week 4
2019-2020
Lesson 4 Top-Down Design and Variables Айнымалылар кодымызда қолдануға және өзгертуге болатын ақпаратты (мәтін немесе сандар) сақтауға мүмкіндік береді.
Біз айнымалы мәндерді біздің кодтың көптеген бөліктерін басқару үшін пайдалана аламыз, біз тасбақаны жылжытатын қашықтықтан оның ізінің түсіне дейін!
Defining a Variable
variable_name = value
Variable name: my_variable
Lesson 4 Top-Down Design and Variables
Assigning and Using Variables
Lesson 4 Top-Down Design and Variables
Changing a Variable’s Value
Lesson 4 Top-Down Design and Variables
Changing a Variable’s Value
Lesson 4 Top-Down Design and Variables
Changing a Variable’s Value
Lesson 4 Top-Down Design and Variables
Changing a Variable’s Value
Lesson 4 Top-Down Design and Variables
Осы сабақта үйренген командалар
Command
Ол не істейді?
Top Down Design
Шешімін табуды жеңілдету үшін үлкен мәселені кішірек, басқарылатын бөліктерге бөледі
variable_name = value
Айнымалыны тағайындайды
Lesson 4 Top-Down Design and Variables
Example: Chess Board
Draw a chess board with 8 rows and 8 columns. Use “black” and “light yellow” colors.
Lesson 4 Top-Down Design and Variables
Exercise #1: Dartboard
Make sure your dartboard:
Consists of 4 concentric circles
Has the center circle placed in the middle of the canvas with a radius of 25
Has three circles surrounding the middle, that each increase in radius by 25 pixels
Lesson 4 Top-Down Design and Variables
Exercise #2: Squares
Write a program that will draw a line of 5 blocks that increase in size.
Follow these guidelines:
The first block should have sides of length 10
Each consecutive block should have its side length increase by 10
There should be a space between each block that is as long as the block’s length before it
(ie: if a block with sides of length 10 was drawn, the space should be 10 pixels wide)