CS 106 Winter 2016
Lab 00: Orientation
Summary
The goal of this lab is mostly just to make sure you're ready to use Processing and the other technologies that will power the labs and assignments in this course. We'll ask you to visit a few websites, read through some information, and make a few very simple changes or additions to sketches.
Question 1 Login
Log in to one of the Macs in MC 3003 or MC 3027. That's it, just make sure you can access your account. If you plan on using your own laptop consistently throughout the term you might be able to skip this step, though it's not a bad idea just to check that you have access.
Question 2 Processing
Launch Processing and make sure it runs smoothly. Please make an effort to run the latest version of Processing (which is currently 3.0.1). The sketches should probably work under version 2.2.1, but I'd rather we be up to date.
Question 3 Course web page
You must have seen at least part of the course web page if you're reading these lab instructions, but go back to the main page and have a look around, just to familiarize yourself with the layout. We'll be putting a minimal amount of information on LEARN in this course—unless there's a specific reason to keep information private, it will be visible on this page.
Question 4 Piazza
Visit the Piazza page for this course. You should already be enrolled in the course, or have received an invitation to do so. Either way, make sure you're enrolled now. Piazza will be our primary means of answering questions and issuing timely announcements, so be sure to check it frequently.
You'll notice that there's already a post with the subject "Welcome to CS 106!". Please read that post and add your answer to the Student Answer as appropriate.
Question 5 Clickers
As a former CS 105 (115X) student, you should already have a clicker. If you don't, you should buy one ASAP. You will then need to register your Clicker ID with this course, as you did last term. To do so, please visit the registration page and follow the instructions there.
Question 6 LEARN
We will use LEARN mainly to collect electronic assignment and lab submissions, and to provide feedback on those submissions. Please make sure that you can see this course (under the name "CS 116X (011) - Winter 2016") in your LEARN account. (The LEARN page for this course is now set up, but has no course-related information in it. Don't worry, we'll get it online soon.)
Question 7 Starter code
For many labs and assignments, we'll be providing starter code
that you can use as a point of departure for your work.
Please download the file L00.zip
and unzip it, ideally into a folder set aside for this course. You'll
see that it includes subfolders for a few different Processing sketches.
Question 8 Academic integrity
We take Academic Integrity very seriously, and we want to make sure that you're aware of your responsibilities for lab and assignment submissions. Last term, you were asked to read Policy 71 and to complete the online Academic Integrity Tutorial and Quiz. If you are unfamiliar with those documents, or need a refresher, please go over them again now.
We have provided a sketch titled AcademicIntegrity
with our own text about requirements for code submission.
Open the sketch in Processing. You will find that the text is not
in the code itself, but in an accompanying data file
lines.txt
. Find the file by selecting
Sketch → Show Sketch Folder from Processing's
menu, then navigating into the data
subfolder.
Read the text in that file. Indicate that you have read it
by changing the second and third lines of the file to your
name and Student ID number, as indicated there. Save the modified
file and run the sketch, just for fun.
Question 9 Basic declarations
Open the sketch called Declarations
. You'll find that
the sketch is initially empty. You'll add a few simple declarations
to the sketch as a first programming exercise.
- Declare a variable called
num_cats
, which will hold a whole number (not a fraction or a decimal). Do not initialize the variable to a value. Choose an appropriate type and use full, correct syntax. - Declare a variable called
cat_name
, which holds the name of a cat. Initialize the variable to hold the value"princess cuddlekins"
(or some other nauseating cat name of your choice). - Declare a function called
add_pi
, which takes any number as input (not necessarily an integer) and returns the number with the mathematical constant π added to it. The function should not print anything as output: it gives the new value back to the caller using areturn
statement. Indeed, the return statement is the only thing you need in the function. You should use Processing's built-in constant for π (you may have to look up the name of the constant in Processing). - Declare a class called
MyClass
containing the following:- A
boolean
field with the nameis_awesome
- A method called
makeMoreAwesome
that has no parameters and does not return a value
- A
You do not need to include any comments. This code doesn't do anything, but it should be at least possible to run the sketch to verify that your syntax is correct.
Question 10 Drawing dots
Open the sketch called ArrayDots
. The sketch contains
a long array of x and y coordinates that describe
the locations of a set of points. In the sketch's draw
function, you must add code to loop over these points and draw
them as circles with diameters of 10 pixels. You should be able
to do this with a single three-line for
loop. Please see the
comment labeled TODO
in the sketch for more details.
You'll know your code is correct because the dots will spell out a
secret message.
Question 11 Extra! Extra!
Congratulations, you're ready for CS 106. Let's celebrate with a
front-page headline. The sketch ExtraExtra
simulates
a spinning newspaper front page, which was a common special effect
in old movies. The implementation of the effect is provided for you
as a toy. All you need to do is customize it as follows:
- Add your name where indicated in the source code
- Put a photo of yourself in the sketch's data folder
(which can be found as in the
AcademicIntegrity
sketch), and make sure the image file name correctly loads that photo in the source code
As before, look for comments labeled TODO
for the places
where you need to modify code. You're welcome to study the rest of the
code or play around with it, if you're interested, but no further
changes are required.
Submission
When you're done, please zip up the entire L00
folder into a single file, and submit that file to LEARN
(as of Monday, the dropbox for this lab is not set up; please stand
by). Do not submit
multiple individual files! However, feel free to re-submit
the complete zip file as many times as you like; we will mark
the final pre-deadline submission. Please consult the full
How To Submit document
for additional information.