CS 491: Lecture 3 – Peggle
Dear students: Last time we started working on a game of Peggle. The real thing is full of glitz. We’ll keep working on ours today, but it won’t quite match the professionals: I’ve expanded our controller a bit so it has both a push button switch to fire and a potentiometer to aim the cannon. […]
CS 330: Lecture 7 – Lexing, Really
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 318: Lab 5 – Hello, CSS
Dear students, Today we begin integrating cascading style sheets (CSS) into our pages. When we use an editor like Microsoft Word or Adobe InDesign, we are often thinking about two things at once: the information we wish to communicate and its presentation. For several reasons, mixing these is a bad idea: We get hung up […]
Another Integer Triangle Wave
I’ve across another way to generate a triangular wave. So exciting! Recall from last time that I want to generate a pattern that looks like this: In this example, the period is 10. As before, we can generate a sawtooth wave with some help from modulus: $$y = \textrm{mod}(x, \textrm{period})$$ We can also generate a […]
Playing Telephone with Google Translate
A friend was playing with the Google Translate API and wrote a game of Telephone. He started with a message in English, translated it to language X, translated it to language Y, and so on, and finally translated it back to English. Sometimes the end result was incredibly faithful to the original message, but not […]
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 […]