teaching machines

CS1: Lecture 30 – 2D Arrays and ArrayList

Dear students, Today we will complete a whirlwind tour through a couple of concepts that really deserve a couple of conversations each. These concepts are two-dimensional arrays and ArrayList. Two-dimensional Arrays Let’s consider a famous statistical problem. Suppose birthdays are uniformly distributed across the calendar year. What’s the probability that we in this room all […]

CS 145 Lab 9 – Arrays

Welcome to lab 9! If you have checkpoints from the last lab to show your instructor or TA, do so immediately. No credit will be given if you have not already completed the work, nor will credit be given after the first 10 minutes of this lab. In this lab you will work with data […]

CS1: Lecture 29 – Bundled Data

Dear students, Last time we used arrays as a means to map integers to values. We associated our data with 0, 1, 2, 3, and so on. When we got a new piece of data in, we use its index to reach inside our array directly. Today we shine the spotlight on arrays as a […]

CS 148 Lab 9 – Spinner

Welcome to lab 9! Our goal in this lab is to continue our discussion of loops, but also get some more practice with images and the GifSequenceWriter that you are using in homework 4. Because we’re going to use some code that I’ve provided to you in the homework 4 SpecChecker, you’ll need to complete […]

CS1: Lecture 28 – Indexed Data

Dear students, We officially close out our discussion of the Computer as a Pilot, during which we made the computer navigate this way and that way and back again through our code using conditional statements and loops. But, like always, these ideas of branching and repetition will never leave us. Computers make a lot of […]

CS1: Lecture 27 – BufferedImage

Dear students, In homeworks 4 and 5, we work with images. Loops are a natural companion to images, which are large collections of indexed data that we are not even tempted to process without loops. The general pattern of visiting all pixels of an image is this: for (int r = 0; r < image.getHeight(); […]

CS 145 Lab 8 – Spinner

Welcome to lab 8! Our goal in this lab is to continue our discussion of loops, but also get some more practice with images and the GifSequenceWriter that you are using in homework 4. Because we’re going to use some code that I’ve provided to you in the homework 4 SpecChecker, you’ll need to complete […]

CS1: Lecture 26 – Looping Patterns

Dear students, So far we’ve used loops to traverse 1D spaces: the number line, files, and a sequence of random events like coin flipping. Today we bust out into 2D spaces, traversing images and other Cartesian grids. Nesting Loops To transition to our next concept, let’s write a program to mimic the activity we see […]

CS1: Lecture 25 – Loops Continued

Dear students, You know that trope in movies where someone invents a new technology? At first it seems to be doing going good, but then it starts to get out of control. That’s where we are in the semester. Our software up until this point was very mild and had a limited reach. Now we […]

CS 148 Lab 8 – Loops

Welcome to lab 8! If you have checkpoints from the last lab to show your instructor or TA, do so immediately. No credit will be given if you have not already completed the work, nor will credit be given after the first 10 minutes of this lab. In this lab, we’ll explore loops, which let […]

1 2 3 171