270 likes | 1.39k Views
Part 2! How Do Computers Work? A Gentle Introduction for Kids Dr. Arturo Sanchez University of North Florida E-mail: asanchez@unf.edu Web: http://www.unf.edu/~asanchez This presentation: http://www.unf.edu/~asanchez/public/rawlings C1: c8 <- c6 * c7 C2: c10 <- c8 + c9 C3: Go to C5
E N D
Part 2! How Do Computers Work? A Gentle Introductionfor Kids Dr. Arturo Sanchez University of North Florida E-mail: asanchez@unf.edu Web: http://www.unf.edu/~asanchez This presentation: http://www.unf.edu/~asanchez/public/rawlings
C1: c8 <- c6 * c7 C2: c10 <- c8 + c9 C3: Go to C5 C4: 500 C5: c10 <- c6 * c9 C6: 3 C7: 4 C8: 5 C9: 6 C10: 7 Initial Remember me?? I’m the Homework! ? How Do Computers Work? Part II Dr. A. Sanchez
C1: c8 <- c6 * c7 C2: c10 <- c8 + c9 C3: Go to C5 C4: 500 C5: c10 <- c6 * c9 C6: 3 C7: 4 C8: 5 C9: 6 C10: 7 Computing … How Do Computers Work? Part II Dr. A. Sanchez
C1: c8 <- c6 * c7 C2: c10 <- c8 + c9 C3: Go to C5 C4: 500 C5: c10 <- c6 * c9 C6: 3 C7: 4 C8: 5 C9: 6 C10: 7 Computing … * How Do Computers Work? Part II Dr. A. Sanchez
C1: c8 <- c6 * c7 C2: c10 <- c8 + c9 C3: Go to C5 C4: 500 C5: c10 <- c6 * c9 C6: 3 C7: 4 C8: 5 12 C9: 6 C10: 7 Computing … * How Do Computers Work? Part II Dr. A. Sanchez
C1: c8 <- c6 * c7 C2: c10 <- c8 + c9 C3: Go to C5 C4: 500 C5: c10 <- c6 * c9 C6: 3 C7: 4 C8: 5 12 C9: 6 C10: 7 Computing … + How Do Computers Work? Part II Dr. A. Sanchez
C1: c8 <- c6 * c7 C2: c10 <- c8 + c9 C3: Go to C5 C4: 500 C5: c10 <- c6 * c9 C6: 3 C7: 4 C8: 5 12 C9: 6 C10: 7 18 Computing … + How Do Computers Work? Part II Dr. A. Sanchez
C1: c8 <- c6 * c7 C2: c10 <- c8 + c9 C3: Go to C5 C4: 500 C5: c10 <- c6 * c9 C6: 3 C7: 4 C8: 5 12 C9: 6 C10: 7 18 Computing … How Do Computers Work? Part II Dr. A. Sanchez
C1: c8 <- c6 * c7 C2: c10 <- c8 + c9 C3: Go to C5 C4: 500 C5: c10 <- c6 * c9 C6: 3 C7: 4 C8: 5 12 C9: 6 C10: 7 18 Computing … * How Do Computers Work? Part II Dr. A. Sanchez
C1: c8 <- c6 * c7 C2: c10 <- c8 + c9 C3: Go to C5 C4: 500 C5: c10 <- c6 * c9 C6: 3 C7: 4 C8: 5 12 C9: 6 C10: 7 18 18 Computing … * How Do Computers Work? Part II Dr. A. Sanchez
C1: c8 <- c6 * c7 C2: c10 <- c8 + c9 C3: Go to C5 C4: 500 C5: c10 <- c6 * c9 C6: 3 C7: 4 C8: 12 C9: 6 C10: 18 Final! How Do Computers Work? Part II Dr. A. Sanchez
Evaluation … • Who did it right? • If you did not do it right, do you know why? How Do Computers Work? Part II Dr. A. Sanchez
Surprise treat for all! How Do Computers Work? Part II Dr. A. Sanchez
New Rules! • “if (condition) go to CX”, which means: • If the condition is true, go to cell X. • Otherwise, proceed to the next cell. How Do Computers Work? Part II Dr. A. Sanchez
New Rules! • For example, suppose that we have the following configuration … • C1: if (C3 > C2) go to C5 • C2: 20 • C3: 30 • C4: C2 <- C3 + C2 • C5: … • What would you do?? How Do Computers Work? Part II Dr. A. Sanchez
New Rules! • For example, suppose that we have the following configuration … • C1: if (C3 > C2) go to C5 • C2: 20 • C3: 30 • C4: C2 <- C3 + C2 • C5: … • What would you do?? Just in case you do not remember … this means “if the value in C3 is greater than the value in C2” How Do Computers Work? Part II Dr. A. Sanchez
New Rules! • For example, suppose that we have the following configuration … • C1: if (C3 > C2) go to C5 • C2: 20 • C3: 30 • C4: C2 <- C3 + C2 • C5: … • What would you do?? So … since 30 is greater than 20, we go to C5 … and continue from there … How Do Computers Work? Part II Dr. A. Sanchez
New Rules! • “CX <- value”, which means: • Copy the value in question into cell X • For instance, if • C1: C3 <- 30 • C2: 20 • C3: 5 How Do Computers Work? Part II Dr. A. Sanchez
C1: C3 <- 30 C2: 20 C3: 5 C1: C3 <- 30 C2: 20 C3: 5 30 New Rules! Before After How Do Computers Work? Part II Dr. A. Sanchez
New Rules! • “CX <- CY”, which means: • Copy the value in cell X into cell Y • For instance, if • C1: C3 <- C2 • C2: 20 • C3: 5 How Do Computers Work? Part II Dr. A. Sanchez
C1: C3 <- C2 C2: 20 C3: 5 C1: C3 <- C2 C2: 20 C3: 5 20 New Rules! Before After How Do Computers Work? Part II Dr. A. Sanchez
New Rules! • “end”, which means: • End of the game! How Do Computers Work? Part II Dr. A. Sanchez
Questions Before We Play? How Do Computers Work? Part II Dr. A. Sanchez
Let’s Play! • C1: C8 <- 0 • C2: if (C10 = 0) go to C6 • C3: C8 <- C8 + C9 • C4: C10 <- C10 - 1 • C5: go to C2 • C6: end • C7: 0 • C8: 10 • C9: 2 • C10: 3 How Do Computers Work? Part II Dr. A. Sanchez