teaching machines

CS 330: Lecture 6 – Lexing

Dear students, Okay, with regexes and the notion of state machines tucked away in our brains, we’re now on a quest to design our own programming language. Usually you’re supposed to start this kind of learning by writing a calculator. I couldn’t bring us to do that. Instead we’re going to design a language for […]

CS 330: Lecture 5 – Lookaround Assertions and Numeric Ranges

Dear students, To start things off, we’re going to play some Regex Bingo. Find a partner and make a 4×4 grid of randomly generated strings. Include uppercase and lowercase letters, numbers, whitespace, and punctuation. Keep the strings short. There’s no free space. I will call out the following regex, one at a time. Cross out […]

CS 318: Lab 4 – Structuring Elements

Dear students, Today we will branch out from our 1-page sites. To connect our pages to other pages, we will make extensive use of the anchor element, whose tag is a. Its href attribute contains a URL to another page, much like img‘s src attribute contains a URL to an image. Consider this example: There's […]

CS 491: Lecture 2 – Potentiometer

Dear students: Last time we used a push button to make a game where we reversed the spin of a planet. Today we implement a crude game of Peggle. We’ll discuss potentiometers and physics. We’ll use the potentiometer to aim the cannon. Potentiometers are rotary sensors that are useful for gathering inputs that fall into […]

CS 330: Lecture 4 – Find and Replace

Dear students, Last week we started examining regex, a language for recognizing languages. We examined their syntax and theoretical background. I want to spend two more days discussing them. Today we look at several applications of them inspired by real-life needs that I’ve encountered: Extract the URLs from all img elements. If you alter this […]

CS 318: Lab 3 – More Core

Dear students, Let’s start with a quick informal reading quiz: Question 1 What’s a phrase element? Question 2 What happens to whitespace in our HTML files? Question 3 What kind of list elements are available? When I think about my favorite and most memorable learning experiences, my high school Spanish classes immediately come to mind. […]

CS 318: Project Proposal – due on February 14

In this class, you are asked to apply what you’re learning by building a website for a client. The project is broken down into a series of milestones. The first milestone is to find a client and formally propose your project. Complete the following tasks to achieve this milestone. Task 1: Choose a Client Find […]

CS 330: Lecture 3 – State Machines and More Regex

Dear students, Before diving into code, let’s be computer scientists for a minute. We’re going to consider a model of computation called a deterministic finite automaton (DFA). A DFA is a special case of a state machine. Here’s a state machine used to model an avatar’s state in a game: Thanks, Bob Nystrom. And one […]