teaching machines

CS 145 Lecture 22 – Images

Dear students, We start today by revisiting memory tracing, but this time in programs with loops. Here we go! Memory Tracing #1 public static String trace1(char c, int n) { String s = ""; for (int i = 0; i < n; ++i) { s += c; } return s; } public static void main(String[] […]

CS 352 Lecture 22 – Hello, ARM

Dear students, I want to take a few minutes to explore the next homework assignment, which was inspired by the game Human Resource Machine. But let’s do that at the end of class, rather than the beginning. At this point in the semester, we leave our textbook behind and jump into an industry-grade architecture: ARM. […]

CS 145 Lecture 21 – Loops Cont’d

Dear students, Let’s start with a little Program This: Write a method indexOf that accepts a String and a char as parameters. Without using the builtin String.indexOf method, it returns the index at which the given character resides in the String. If no such character can be found, return -1. Then, let’s seem some more […]

CS 352 Homework 4 – Bleak – due before November 15

See the PDF.

The Thrilling Adventures of Lovelace and Babbage

This is my third post in a series of reviews on technology-related graphic novels. I had hoped to participate in a special session on such novels at SIGCSE 2017, but the the special session was not accepted by the reviewers. *sniff* The Thrilling Adventures of Lovelace and Babbage is subtitled “the (mostly) true story of […]

CS 145 Lab 7 – Loops

Welcome to lab 7! 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. You must work with a partner that you […]

CS 145 Lecture 20 – For

Dear students, Hey. Check out this while loop: int i = 0; while (i < 5) { System.out.println(i); ++i; } Let’s abstract this out a bit into its four parts and pieces: init while (condition) { body; update; } Loops are powerful, but any time you put a motor in something, it gets away from […]

CS 352 Lecture 21 – Assembler Cont’d

Dear students, Today we continue work on our assembler. In short, this is our development checklist: strip out the cruft (unnecessary whitespace, comments) identify addresses for all code labels resolve all symbols to addresses convert text instructions to binary We accomplished steps 1 and 2 last time, but didn’t test it. Let’s write a quick […]

CS 352 Homework 4 – Computer – not due ever

See the PDF.

CS 145 Lecture 19 – While

Dear students, Let’s start by analyzing this piece of code: public static boolean isIsosceles(double sideA, double sideB, double sideC) { if (sideA == sideB) { if (sideB == sideC) { return true; } else { return false; } } else { return false; } } Sniff it. Kick it. Pounce on it. Does it hold […]

1 2 3 4