Presentation is loading. Please wait.

Presentation is loading. Please wait.

Graph Paper Programming

Similar presentations


Presentation on theme: "Graph Paper Programming"— Presentation transcript:

1 Graph Paper Programming
Code.org: Stage 4

2 Understand how “Coding” works
Main Goal Understand how “Coding” works

3 Objectives Understand the difficulty of translating real problems into programs Learn that ideas may feel clear to you and still be misinterpreted by a computer Remember the “Monster Activity? Interpretation is key! Realize the need for formal programming structures like loops and functions

4 Vocabulary Algorithm Coding Debugging Function Parameters
A series of instructions on how to accomplish a task Coding Transforming actions into a symbolic language Debugging Finding and fixing problems in code Function A piece of code that can be called over and over Parameters Extra bits of information that you can pass into a function to customize it

5 What is a robot? Does a robot really “understand” what people say?
Robots operate off of “instructions”, specific sets of things that they have been preprogrammed to do. In order to accomplish a task, a robot needs to have a series of instructions (algorithm) that it can run.

6 Programming key Programming language made of lines and arrows
Move One Square Forward (move forward) Move One Square Backward (move backward) Move One Square Up Move One Square Down (next line) Fill-In Square with Color (fill-in) Change to Next Color In this instance the symbols on the right are the “program” and the words on the left are the “algorithm” piece. This means that we could write the algorithm: “Move One Square Forward, Move One Square Forward, Fill In Square With Color” And that would correspond to the program:

7 How can you simplify????? SAMPLE ALGORITHM PROGRAM:
ALGORITHM: “step forward, fill-in, step forward, next row, back, back, fill-in, step forward, step forward, fill-in, next row, step forward, fill-in, step forward” How can you simplify?????

8 Simplify Move right to left, then back again:
Remove unnecessary symbols: (back, back) from both lines (Return to previous slide, use ink to remove)

9 It is true that there is a bit of redundancy, but it can be extremely confusing to code without it. Until a programmer is experienced, it is helpful to code in the most understandable way to make sure it works, then ABSTRACT (remove) unneeded steps later.

10 Functions And parameters
Best demonstrated with larger, more complicated drawings Look for things that repeat often What could the symbol look like to replace often repeated code like: back, back, back, back, back, back?

11 Back, back, back, back, back, back can be replaced with 6

12 Functions and parameters
You have just discovered FUNCTIONS!!! A simple representation for a complex grouping of actions How about the number? It has a name also…. That number is called a PARAMETER!!! The parameter lets the function know how many times to move backward Look at these “functions.” What do you think they do? ( ) ( )

13 Example on Board (2 volunteers)
Step forward, fill-in, step forward, step forward, step forward, step forward, fill-in, step forward next line. (can use function to step forward 4 times… ) Back, back, back, back, back, back… (can use function to go backward 6 times… ) Fill-in, step forward, fill-in, step forward, fill-in, step forward, step forward, fill-in step forward, fill-in, step forward fill-in, next line…(can use function to { }, and { } Back, back, back, back, back, back…(can use function to )

14 ASSIGNMENT PART 1: Write your name and color at the top of the page with the blank “5 x 5” grids Choose image from image pack of “5 x 5” image grids Write out algorithm to draw that image Convert algorithm into a program using symbols Trade programs with another student and draw their image PART 2: Draw a more complex image on “6 x 6” or “7 x 7” grid (shade squares to create image) Write an algorithm and program for that more complex image (you may use color) Add “functions” and “parameters” to make program more simple (min. 2) Trade your complex program and draw again

15 Programming key Programming language made of lines and arrows
Move One Square Forward Move One Square Backward Move One Square Up Move One Square Down Fill-In Square with Color Change to Next Color


Download ppt "Graph Paper Programming"

Similar presentations


Ads by Google