teaching machines

Plotting samples with GNU Octave

Suppose we have a plain text file of samples named samples.txt, with each intensity on its own line: We can visualize these results in GNU Octave with: If we write this code in a script named plot_samples.m, we can simply run plot_samples at the Octave command-line.

CS 491 Lecture 24 – Trivia competition

Agenda ask 100 questions give out prizes Haiku  

Levenshtein distance

We’re looking at methods for comparing the distance between two sequences of text. A fairly simple one is Levenshtein distance, which calculates how many edits it takes to go from one string to another. I wrote a little calculator to demonstrate its results. Enter two words and calculate their distance. Cell (i, j) reports the minimum […]

CS 145 Lecture 25 – Sound

Agenda how’d it go? generating sound (frequencies, WAV standard) binary I/O little endian vs. big endian Code LEDataOutputStream Haiku

CS 145 Lecture 24 – Growable arrays

Agenda identity per instance instance vs. static a growable String array Code … Haiku  

CS 491 Lecture 23 – BThwack

Agenda BThwack We were going to talk about incorporating a two-player Bluetooth mode into Bluecheckers, but it was getting out of hand. Instead, I looked back at the last of apps you folks expressed interest in back at the beginning of the semester. And there is was. Whack-a-mole. But not just any Whack-a-mole, Bluetooth-enabled Whack-a-mole. […]

CS 491 Lecture 22 – Bluecheckers

Agenda case study of making a NDK/OpenGL powered game Bluecheckers A couple of weeks ago I got the latest issue of Make magazine in the mail. On page 56, Charles Platt describes a 2-player Chinese Checkers game. I thought, “That’d be fun on a mobile device.” We don’t have time to code it all from scratch, but […]

CS 145 Lecture 23 – Composing with objects

Agenda static vs. non-static designing a Flashlight design a room for a text adventure Code Stopwatch.java package lecture; public class Stopwatch { /** Time at which stopwatch is started */ private long startTime; /** Time at which stopwatch is stopped */ private long stopTime; /** * Starts stopwatch. */ public void start() { startTime = […]

CS 145 Homework 4 – due before 12/15

See the PDF. When you download speccheck_hw4.jar, make sure the filename ends in “.jar”.

CS 145 Lecture 22 – Designing objects

Agenda writing a Stopwatch objects hide information managing a “dungeon” with objects writing a flashlight Code Stopwatch.java package lecture; public class Stopwatch { /** Time at which stopwatch is started */ private long startTime; /** Time at which stopwatch is stopped */ private long stopTime; /** * Starts stopwatch. */ public void start() { startTime […]