teaching machines

CS 148 Lab 1 – Madeup, Homework 0, and Project Euler

September 5, 2019 by . Filed under cs1, cs148, fall 2019, labs.

Welcome to the first lab of CS 148!

In the first half of today’s lab, we’re going to explore a language for making 3D models. We won’t be using this language for anything else in the semester, but it gets us thinking about programming in a visual way. We’ll start with a quick demo.

In the second half, we’ll get into Java, IntelliJ, and your course project on GitLab.

Protocol

Lab is a time intended for you to work on programming exercises in a low-stakes environment and with lots of help at your disposal. Read each of these out loud with your lab partner and check them off to acknowledge your understanding:

Many of these rules were crafted out of failures from earlier offerings of this course. These are designed to maximize the number of passing grades at the end of the semester.

Checkpoint 1

In this first exercise, we’ll use Madeup, the 3D programming language that your instructor demonstrated at the beginning of lab. Here’s the polyring program that we wrote:

This program demonstrates two foundational ideas in computer science:

For your first checkpoint, you will apply these ideas to generate two other models.

Model A

Person A types. Visit Madeup.

Your first task is to create a chain link:

Model B

Person B types. Visit Madeup in a new tab.

Your second task is to create this funny symbol:

This symbol is used in the United Kingdom to mark a mechanic’s shop that can certify that your vehicle passes certain standards required by the government.

Notice the model has rounded corners instead of sharp bends. These were automatically added by appending a named parameter to the dowel command:

dowel maxBend:1

Use only a single yaw command per bend—instead of a sequence of turns like in the chain link—and then let the dowel command smooth it out.

When you have completed your two models, invite your instructor or teaching assistant over to offer feedback and make note of your accomplishment in the gradebook. If your instructor and TA are working with others at the moment, and you are confident that you’ve satisfactorily completed this checkpoint, please move on to the next checkpoint and catch them when they become available.

Checkpoint 2

We now leave Madeup and switch to a language that we will use most of this semester: Java.

In this course, we ask you to use IntelliJ IDEA to write and run Java code. IDEA is one of many possible tools we could use to write Java. Netbeans and Eclipse are also quite popular. There is no single best tool. We choose IDEA because it has an accommodating license and is widely used in industry.

Your code this semester will be stored in a project hosted on GitLab.

To get your project set up, please run through homework 0, which is linked on the course page. (I’m not linking it here because it’s important to me that you know how to navigate this site. Sorry to be a jerk!)

Now let’s create some new code. Start by creating some new packages for our lab work:

Everything’s in place. Let’s solve some problems.

Problem A

Person A types. Visit Project Euler and register to create an account.

Pick one of the problems. Work out an algorithm on paper or markerboard in pseudocode. Then create a new class in lab01 named ProblemA. Translate your pseudocode to Java. Submit your answer to Project Euler. Fix your code until you have solved the problem.

Problem B

Person B types.

Pick a second problem, and solve it with the same process. Write your code in class ProblemB.

Once your solutions are working, show your work to your instructor or teaching assistant. Commit and push your work to GitLab. Then log out and go do something amazing.