Class Notes (806,449)
Canada (492,253)
CMPT 166 (9)

All CMPT 166 Notes.docx

21 Pages
Unlock Document

Simon Fraser University
Computing Science
CMPT 166
Toby Donaldson

CMPT 166 Index Notes Function List Notes on Syntax Possible Exam Questions Website: Grade book: Processing API: Assignments: Assignment 1 (due Wednesday Sept. 21 at midnight) SUBMITTED 19.5/20 Assignment 2 (due Wednesday Oct. 5 at midnight) SUBMITTED 20/18 Assignment 3 (due Wednesday Nov. 2 at midnight) SUBMITTED 23.5/21 Assignment 4 (due Wednesday Nov. 16 at midnight) SUBMITTED 19/17 Assignment 5 (due Wednesday Nov. 30 at midnight) SUBMITTED FINAL ROOM - 3190 Notes Week 1 Lecture 1 About Processing: Processing is a dialect of Java, ie. its Java with extra stuff (which is what we use) Processing calls setup() once, draw() again and again, 60 times a second (roughly), until the program is stopped Lecture 2 About Computers: Computers have 3 main parts: a Central Processing Unit (CPU), Random Access Memory (RAM) and Input and Output Devices (I/O) The most common computers are embedded computers, or computers used to run toasters, cars, airplanes, phones, etc. o Embedded computers dont necessarily have I/O devices, but can Computers can remember things temporarily using RAM, but RAM is deleted when the computer turns off 4GB RAM ~ 4000 colour images At the lowest level, memory is stored in bits. Bits can occupy one of two states, 0 and 1. 8 bits together = 1 byte In a 32 bit computer, the CPU and memory talk to each other using 32 bits at a time Each of those times is a tick on the computers internal clock Speed of those ticks measured in Hertz (Hz) A computer that runs at 1 GHz does 1 billion lower level processes (operations) a second o Processes: stuff like adding numbers Computers havent gotten too much faster than 2.5 GHz, but definitely possible Origin of the name (according to prof): Computers were originally people who computed and wrote huge tables of numbers for the military, to help people position artillery o Usually young women Programming Languages: Programming languages are formal there is no ambiguity. What you say is what you mean. 2 main kinds: o Assembly/Machine Language: directly controls the CPU Fastest Hard to read (for people, anyways) gets long and complicated quickly for simple operations write for device drivers its dissimilarity to human languages makes writing it very error prone o High Level Programming Language: converted to assembly later Easier to write and read (for people) Slower Doesnt get as long as assembly code (can write Hello world in one line in Python, rather than 20) Obviously, Java (and therefor processing) are examples of High Level Languages Other High Level Languages: o FORTAN Formal translator, mostly just used in science now o C and its lineage C is very similar to assembly line, so its quite fast, but a bit confusing to write Java, C++, C# and others draw their syntax from C Has operator ++ that adds one to x, so C++ is C plus 1 o Java Designed for applications Runs slow on Windows (but not Unix?) Does not care about white space Highly typed language Processing has horrible error messages o Python Designed for applications and scripting White space super important EXTREMELY readable language, easy to learn :> Perl and others are similar Lecture 3 Mysteriously absent from notes Week 2 Lecture 1 We write void in front of functions like setup() and draw() as a way of type casting. What were saying is that these functions dont return any values. If we want them to return values, we have to cast them differently, examples being Boolean, int, float, etc mouseX and mouseY are variables that are automatically set The ellipse() function draws an ellipse based on the four parameters (x, y, width, height) Ellipses are measured from the centre, but we can change that using ellipseMode(CORNER) or some other function Most other things, like rect, which creates a rectangle, are measured from the top left corner automatically Function format: type name(parameters) { o body } The top line is the head of the function, defines it, not what it does (which is the body) The open brace { begins the body of a section of code, and } ends it Processing is case sensitive Flow chart of how Processing works: (on test, probably) (Must include arrow to show that this is where we start setup() (called once) draw() (called again and again and again Known as the Animation Loop) Infinite loops are not universally accepted in CS o Cause of lots of errors/can be an error in themselves Expect on tests to see a piece of code, describe what it does and/or change it to make it work Functions like fill() apply to all following lines of code if in draw(); if in setup, apply to all Why Java only runs on one core! have to execute lines of code in order, or else THE UNIVERSE EXPLODES why Minecraft doesnt work well on computers with multiple cores! (Yay, 8 cores!) Numbers can be either int (integers) or float (floating point numbers, ie, decimal numbers). We tend to type cast things as float, however, I guess to account for it in case a decimal number (non-Discrete number) is passed in
More Less

Related notes for CMPT 166

Log In


Don't have an account?

Join OneClass

Access over 10 million pages of study
documents for 1.3 million courses.

Sign up

Join to view


By registering, I agree to the Terms and Privacy Policies
Already have an account?
Just a few more details

So we can recommend you notes for your school.

Reset Password

Please enter below the email address you registered with and we will send you a link to reset your password.

Add your courses

Get notes from the top students in your class.