CSC 160 Computer Programming for Non-Majors Draft Chapter: The UFO Example Prof. Adam M. Wittenstein

Slides:



Advertisements
Similar presentations
ADMINISTRATION Information Technology for Administrators SPREADSHEETS Click To Continue.
Advertisements

How to represent numbers using “quick hundreds” “quick tens” and “quick ones” Unit 3 Math Expressions.
CSC 160 Computer Programming for Non-Majors Lecture #3a: Stepper, Words, Sentences (continued) Prof. Adam M. Wittenstein
CSC 160 Computer Programming for Non-Majors Lecture #9: Booleans Prof. Adam M. Wittenstein
CSC 160 Computer Programming for Non-Majors Lecture #4: Defining Variables Prof. Adam M. Wittenstein
CSC 160 Computer Programming for Non-Majors Lecture #5c: Functions with Images Prof. Adam M. Wittenstein
CSC 160 Computer Programming for Non-Majors Lecture #8: Animations I Prof. Adam M. Wittenstein
CSC 160 Computer Programming for Non-Majors Lecture #5: Defining Functions Prof. Adam M. Wittenstein
CSC 160 Computer Programming for Non-Majors Chapter 2: Numbers, Expressions, and Simple Programs Prof. Adam M. Wittenstein
CSC 160 Computer Programming for Non-Majors Chapter 6: Structures Prof. Adam M. Wittenstein
CSC 160 Computer Programming for Non-Majors Lecture #11: Conditionals II Prof. Adam M. Wittenstein
CSC 160 Computer Programming for Non-Majors Introduction Prof. Adam M. Wittenstein
CSC 160 Computer Programming for Non-Majors Lecture #3: Calling Functions Prof. Adam M. Wittenstein
CSC 160 Computer Programming for Non-Majors Lecture #3c: Working with Pictures (continued) Prof. Adam M. Wittenstein
Section 1.1: Flying a UFO (continued). Conversion recipe 1)Expand abbreviations 2)Parenthesize all subexpressions that have an operator. Should end up.
Section 1.2: Drawing a UFO (conclusion). Last time… ● Using figure 1, we can now find a UFO’s location (using the X and Y functions). ● And, we can now.
CSC 160 Computer Programming for Non-Majors Section 1.3: Animating the UFOs Flight Prof. Adam M. Wittenstein
CSC 160 Computer Programming for Non-Majors Lecture #10: Conditionals I Prof. Adam M. Wittenstein
CSC 160 Computer Programming for Non-Majors Section 1.2: Drawing a UFO Prof. Adam M. Wittenstein
CSC 160 Computer Programming for Non-Majors Chapter 4: Conditional Expressions and Functions Prof. Adam M. Wittenstein
CSC 160 Computer Programming for Non-Majors Chapter 3: Programs are Functions Plus Variable Definitions Prof. Adam M. Wittenstein
CSC 160 Computer Programming for Non-Majors Lecture #3a: Stepper, Words, Sentences Prof. Adam M. Wittenstein
CSC 160 Computer Programming for Non-Majors Lecture #5a: Defining Functions on Words and Sentences Prof. Adam M. Wittenstein
CSC 160 Computer Programming for Non-Majors Lecture #6: Function Composition Prof. Adam M. Wittenstein
By: Jose Mahendra Aji. First you must click the start button on the bottom left of your screen. Type in “Microsoft office excel” in the search section.
Survey of Mathematical Ideas Math 100 Chapter 1 John Rosson Tuesday January 23, 2007.
Games and Simulations O-O Programming in Java The Walker School
Section 8.3 Absolute Value Functions. 8.3 Lecture Guide: Absolute Value Functions Objective 1: Sketch the graph of an absolute value function.
Lesson 7 Menu Five-Minute Check (over Lesson 6-6) Main Idea and Vocabulary Targeted TEKS Example 1: Draw a Translation Example 2: Translation in the Coordinate.
College Algebra Fifth Edition James Stewart Lothar Redlin Saleem Watson.
LIAL HORNSBY SCHNEIDER
10-2 Graphing Functions Learn to represent linear functions using ordered pairs and graphs.
Lesson 8.1 Translating Points
Chapter 1 Functions and Graphs Copyright © 2014, 2010, 2007 Pearson Education, Inc Graphs and Graphing Utilities.
Algebra 2 (Section 4.9).
Relations & Functions (x,y)y) DR ID 1. Relations & Functions Test administrator: Before administration begins, show students the front of this card and.
Section 1.1 Graphs and Graphing Utilities. Points and Ordered Pairs.
FUNCTIONS AND MODELS 1. In this section, we assume that you have access to a graphing calculator or a computer with graphing software. FUNCTIONS AND MODELS.
Introduction to Arrays. definitions and things to consider… This presentation is designed to give a simple demonstration of array and object visualizations.
6-2: STANDARD NORMAL AND UNIFORM DISTRIBUTIONS. IMPORTANT CHANGE Last chapter, we dealt with discrete probability distributions. This chapter we will.
Chapter 1 - Foundations for Functions
Chapter 2 Frequency Distributions
Copyright © Cengage Learning. All rights reserved. CHAPTER 10 GRAPHS AND TREES.
DERIVATIVES 3. If it were always necessary to compute derivatives directly from the definition, as we did in the Section 3.2, then  Such computations.
College Algebra Fifth Edition James Stewart Lothar Redlin Saleem Watson.
Scientific Communication
© William James Calhoun, : Slope OBJECTIVE: You will be able to find the slope of a line, given the coordinates of two points on the line. Initial.
Check 12-1 HW. Course Graphing Functions 6 th Grade Math HOMEWORK Page 608 #7-20.
Transparency 6 Click the mouse button or press the Space Bar to display the answers.
Chapter 3 Syntax, Errors, and Debugging Fundamentals of Java.
6-2: STANDARD NORMAL AND UNIFORM DISTRIBUTIONS. IMPORTANT CHANGE Last chapter, we dealt with discrete probability distributions. This chapter we will.
Relations And Functions. A relation is a set of ordered pairs {(2,3), (-1,5), (4,-2), (9,9), (0,-6)} This is a relation The domain is the set of all x.
Functional Programming Language 1 Scheme Language: part 2.
Copyright © 2015, 2008, 2011 Pearson Education, Inc. Section 3.2, Slide 1 Chapter 3 Systems of Linear Equations.
Figure 1.1a Evaluating Expressions To evaluate an algebraic expression, we may substitute the values for the variables and evaluate the numeric expression.
Higher Dimensions. x Let's say we use a pencil to mark a point on paper. x is this point. We pick a direction and move the pencil along this direction.
Splash Screen. Lesson Menu Five-Minute Check (over Lesson 6–6) Main Idea and Vocabulary Example 1:Draw a Translation Example 2:Translation in the Coordinate.
(7.7) Geometry and spatial reasoning The student uses coordinate geometry to describe location on a plane. The student is expected to: (B) graph reflections.
Acceleration Your Name Here. Moving Man Game Click HERE to open the Moving Man Game Click HERE to open the Moving Man GameHERE Click and open the file.
Digital Media Dr. Jim Rowan ITEC 2110 Chapter 3. Roll call.
Digital Media Lecture 5: Vector Graphics Georgia Gwinnett College School of Science and Technology Dr. Jim Rowan.
TAKS Tutorial Test-Taking Strategies. Remember that the TAKS test is untimed! That gives you plenty of time to do this first strategy! Look at the ENTIRE.
Finding Limits Graphically and Numerically
Patterns, Equations, and Graphs Section 1-9. Goals Goal To use tables, equations, and graphs to describe relationships. Rubric Level 1 – Know the goals.
Modeling and Equation Solving
For each statement below, write whether the statement is true or false. A set of ordered pairs describe a function if each x-value is paired with only.
Chapter 1 Graphs, Functions, and Models.
Transformation Geometry
Chapter 9 Basic Algebra © 2010 Pearson Education, Inc. All rights reserved.
Presentation transcript:

CSC 160 Computer Programming for Non-Majors Draft Chapter: The UFO Example Prof. Adam M. Wittenstein

A Word on Computers ● Computers were originally used as number crunchers (to perform complex, large-scale calculations). ● We now use them for many other purposes as well. ● Computers cannot do all the wonderful things that we expect without instructions telling them what to do.

What is programming? ● Programming is how we give instructions to the computer. ● First, we represent various things in the world (numbers, words, pictures, etc.) to the computer. ● Then, we can write instructions in Scheme (or any other computer language) to tell the computer what we want it to do.

Programming the UFO ● You need to represent the UFO and the shots to the computer. ● Then you can program the computer to change: – their location (using numbers) and – draw them on the screen (as an image). ● In this chapter, we will see the details on how to do this in Scheme.

Section 1.1: Flying a UFO

Graphing in Scheme ● In math class, the x-coordinate becomes higher when you move to the right. ● This is true in Scheme. ● In math class, the y-coordinate becomes higher when you move up. ● This is FALSE in Scheme. ● The y-coordinate actually increases moving DOWN.

Pixels on the Computer Screen ● Increasing the y-value as you go down is common in computer science. ● To prevent computers from dealing with negatives, the top left corner of the screen is X=0, Y=0. ● Then as you move down or to the right, the numbers get bigger. ● For example, X = 5 is 5 pixels to the right of the screen’s left edge. Also, Y = 30 is 30 pixels down from the top of the screen.

Representing the UFO ● Suppose you are creating a game that shoots UFOs. ● You will play the game on a window within your computer screen. This is called the canvas. ● The location of the UFO (and the shots) can be expressed using two numbers: X, for left-to-right location in the window and Y, for up-and-down location in the window.

A little bit of number stuff… ● Soon we will get to moving UFOs, but first a little math review. ● Suppose the UFO starts out at X = 20. ● It moves 10 pixels to the right every second. t =01234…7 X = …?

Creating a formula (for X) ● We want the computer to know where the UFO is at any time, even t = 342. ● The process of adding 10 and extending the table is very tedious. ● For this purpose, it is better to figure out an algebraic formula that describes what X is for a given value of t. ● Here is the algebraic formula that relates X to t: X = 10 · t + 20

Checking the formula is correct ● In the first exercise, I will ask you to come up with such a formula on your own, generalizing from a table like the one above. In that case, it is good practice to test whether it works properly. ● To test the formula, see if some of the specific examples you know work. For example, the chart says that when t = 0 then X = 20. According to the formula, X = 10 · t + 20 X = 10 · x = = 20

In summary… ● Today we saw the “math” needed for the UFO game. ● We will translate this into writing our first Scheme program. Next time…