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

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 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: move one square forward, fill-in, move one square forward, move one square down Move one square backward, move one square backward fill-in, move one square forward, move one square forward, fill-in, move one square down, Move one square backward, move one square backward, Move one square forward, fill-in, move one square forward How can you simplify?????

8 Simplify Move right to left, then back again:
Remove unnecessary symbols: (move one square backward, move one square backward) from line 2 and line 4 (See next slide to see “simplified” program)

9 SAMPLE ALGORITHM ALGORITHM: move one square forward, fill-in, move one square forward, move one square down Move one square backward, move one square backward fill-in, move one square forward, move one square forward, fill-in, move one square down, Move one square backward, move one square backward, Move one square forward, fill-in, move one square forward PROGRAM: Row 2 and Row 4 “abstracted”. Will now start AUTOMATICALLY where you are, instead of left to right.

10 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.

11 move one square backward,
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: move one square backward, move one square backward, move one square backward, move one square backward, move one square backward, move one square backward

12 move ONE SQUARE BackWARD, move ONE SQUARE BackWARD, move ONE SQUARE BackWARD, move ONE SQUARE BackWARD, move ONE SQUARE BackWARD, move ONE SQUARE BackWARD can be replaced with the function

13 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? ( ) ( )

14 Code 7 x 7 Grid: Example on Board Use Written Algorithm From Slide volunteers: * one to translate algorithm to code * one to shade grid after coding complete

15 Row 1: Move one square forward, Fill-in, (Move one square forward, Move one square forward, Move one square forward, Move one square forward), Fill-in, Move one square forward, Move one square down (can use function to move one square forward 4 times): , , ( ) , , ,

16 Example: Row 2 Row 2: Move one square backward, Move one square backward, Move one square backward, Move one square backward, Move one square backward, Move one square backward .. (can use function to go backward 6 times)… Fill-in, Move one square forward, Fill-in, Move one square forward, Fill-in, Move one square forward (can use function to fill in and move forward 3 times)… Move one square forward… Fill-in, Move one square forward, Fill-in, Move one square forward, Fill-in, Move one square forward (can use function to fill in and move forward 3 times)... move one square down ( ) , ( ), , ( ) ,

17 Example: row 3 Row 3: Remember, start from where you are!
Fill in, Move one square backward, Fill in, Move one square backward, Fill in, Move one square backward, Fill in, Move one square backward, Fill in, Move one square backward, Fill in, Move one square backward…, Fill in…, Move one square down (can use function to fill-in and move backward 6 times: ( ) , ,

18 Row 4 Row 4:. Fill in, Move one square forward, Fill in, Move one square forward, Fill in, Move one square forward, Fill in, Move one square forward, Fill in, Move one square forward, Fill in, Move one square forward, Fill in, Move one square down (can use function to fill-in and move forward 6 times: ( ), ,

19 ROW 5 Row 5: (Move backward one square, Fill in, Move backward one square, Fill in, Move backward one square, Fill in, Move backward one square, Fill in, Move backward one square, Fill in, ) Move backward one square, Move one square down (can use function to move backward, fill-in 5 times: ( ) , ,

20 Row 6 Row 6: Move one square forward, Move one square forward, (Fill in, Move one square forward, Fill in, Move one square forward, Fill in, Move one square forward), Move one square Forward, Move one square down. , , ( ) , ,

21 Row 7 Row 7: (Move one square backward, Move one square backward, Move one square backward), Fill in, (Move one square backward, Move one square backward, Move one square backward) (can use functions to move backward three squares): ( ), , ( )

22 Symbol CodE for example on board Row 1: , , ( ) , , , Row 2: ( ), ( ), , ( ), ROW 3: ( ), , ROW 4: ( ), , Row 5: ( ), , Row 6: , , ( ), , row 7: ( ), , ( )

23 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 COMPLETE algorithm to draw that image (no shortcuts!) Convert algorithm into a program using symbols Swap programs with another student and draw their image ON THE CORRECT GRID PART 2: Draw an original 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 ) Swap your complex program and draw image ON THE CORRECT GRID

24 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