teaching machines

CS1: Lecture 16 – Logic Continued

Dear students, Today we keep asking questions about data. Let’s start with some blackboxes! Blackbox #1 Blackbox #2 Blackbox #3 Blackbox #4 Blackbox #5 Blackbox #6 Now let’s do some more free-form exercises: Has digit? Does a password contain at least one digit? No attachment? Is the word “attachment” absent from the body of an […]

CS1: Lecture 15 – Logical Operators

Dear students, We’ve seen the arithmetic operators. We’ve seen the relational and equality operators. Today we meet the logical operators &&, ||, and !. These operators have boolean operands and yield boolean values; they are designed for gluing together simple predicates into compound ones. Before we look at them, let’s complete a little warmup exercise. […]

CS1: Lecture 14 – Relational Operators

Dear students, We have seen the Computer as Calculator, a lover of number crunching. We have seen the Computer as Chef, organizing its tasks into self-contained recipes. Now we see the Computer as Philosopher, seeking truth from our data. Truth is communicated in our programs through the boolean data type. Values of type boolean can […]

Terra’s Theme

I’m not exactly sure what Deltaphone is for, but this afternoon, it was for analyzing the structure of Terra’s Theme from Final Fantasy VI. (Thanks to 8-bit of 8-bit Music Theory, who did all the work.) The melodic line consists of a phrase repeated three times, and this phrase is expressed in the prefix function […]

New Geometry

What do you call a portion of the shaded area between two arcs? A sharc. The figure above was created in Twoville, a little language for drawing vector art. Here’s the complete program:

Little Notebooks

The best days are the days in which I write in a little notebook. The things I write are myriad: 20 drafts of a haiku, big goals for a project, a TODO list for the day, an outline for a lecture, a draft of a talk, a humorous thought, a record of a dream, an […]

CS 145 Lab 5 – Logical Expressions

Welcome to lab 5! 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. In this lab, we’ll explore the logical operators […]

Un-safelinks

Several months ago Microsoft started wrapping all URLs in my university email. Now, when I click on a URL, I first go to a web service that checks to see if the page has malicious intent or unsafe content. The problem with this safety feature is that I can no longer read the destination URL. […]

Interpolants in Twoville

Shapes in Twoville are animated across time by interpolating their properties between keyframes. Time is a first-class concept in the language, with assignment statements storing values across a timeline rather than in a static memory cell. Here’s a rectangle that oscillates left and right using this keyframe-sensitive assignment syntax: The animation above uses linear interpolation. […]

CS1: Lecture 13 – Test-driven Development

Dear students, Is there anything like charAt for integers? For instance, given a number and an “index” representing the place, can we get back the digit at that place? Not exactly, but there’s nothing stopping us from writing our own method to accomplish this task! But before we do that, let me share with you […]

1 35 36 37 38 39 204