teaching machines

CS 491 Meeting 8

Dear students, We are in the working phase of developing our games, so most of our time will be spent giving weekly progress reports. Here are some questions we will probably ask you: What’s the riskiest part left to investigate in your endeavor? What three or more specific things will you accomplish before we meet […]

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 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 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 […]

CS 352 Lecture 20 – Assembler

Dear students, In homework, you’ve been working on chapters 1, 2, and 3 of our textbook. Your next homework will be chapter 5, which involves tying everything you’ve built into a complete computer, albeit in HDL form. In lecture, we’ve hit upon chapter 4, which covers assembly for this computer. Today we discuss chapter 6, […]

CS 145 Lecture 18 – If Ladders

Dear students, Let’s start today by writing a little game modeled after an exercise that my kids do at school. It’s called Math Mountain. A number appears at the peak, and another small number appears at mountain’s left foot. The left and right foot are to sum up to the peak. The student must supply […]

CS 352 Lecture 19 – Jumping

Dear students, We now jump into jumps. Normally, the flow of control goes from top to bottom in a sequence of code. But that’s not how it works in our high-level code, where we have loops and conditionals. At the assembly level, there is no such thing as if. Nor is there while or for. […]

1 42 43 44 45 46 110