YOUR CART

The diagram to the left shows a face divided into its basic proportions. Not everyone's face is exactly like this but this picture is useful for learning about the relationships between images we draw on the screen.

Pseudocode is used to describe the steps a program will take to complete a task,unrelated to the actual code used to write the program.

In programming, there are symbols for math manipulations

+ means to add two numbers

- means to subtract

* means to multiply

/ means to divide​

Let's start with some pseudocode (in yellow, below) for the eyes on a face, like the one at the left.

1. set the height of the face to 600 //This 600 could be any number. It is just an initial size for the face. All the other numbers will relate to this one.

2. set the width of the face equal to the height of the head * 5 / 7//The width of the head now DEPENDS on the height of the face. If the height changes, so will the width, automatically. It is now easy to SCALE the size of this face.

Variables store values that are used later in a program.

A var stores a number.

The programmer (you) makes up the name of the variable for the computer to use (this is called declaring).

The programmer tells the computer what value to store there (this is called initializing).

CHALLENGES(Be careful to "Save As" with a new name, for each challenge so that you don't overwrite the original program.)1. Can you make the head half as big? How many things need to change in your program? (call this one Tiny Head)2. Can you double its size? How many things need to change in your program?(call this one Big Head)

Adding Eyes - Pesudocode

3. set the width of each eye equal to the width of the head / 5// Divide the width of the face by 5 and that is the width of each eye

4. set the height of each eye equal to the width of an eye / 2//eyes are 1/2 as tall as they are wide.

5. set the position of the eyes along the y-axis equal to the height of the head / 2//This puts the eyes in the center of the face on the y axis (height)

6. set the x position of the eyes 1 eye width apart and center them on the face//This is how to center them on the face, along the x axis (width)