Lab 1: Bits

Before Starting: Partner form

Before you get started on the lab with your partner, please fill out this form to record the names of your team.

Introduction

The purpose of this assignment is to become more familiar with bit-level representations of integers. You'll do this by solving a series of programming "puzzles". Many of these puzzles are quite artificial, but you'll find yourself thinking much more about bits in working your way through them. Note that, at times, your work in the Bits lab may rely on undefined behavior in C/C++. In CS 105 we use a dedicated server called wilkes that has all the libraries and tools you'll need throughout the semester; using it also helps to ensure your code behaves as the testing code expects.

Below we first walk you through some initial setup for working on the lab assignments in CS 105. Afterwards, you'll see more specific information about getting started on the Bits lab.

Connecting to the CS 105 Server (wilkes.cs.hmc.edu)

If you already have an account on the CS department's main shell server, knuth.cs.hmc.edu, then you also have an account on wilkes.cs.hmc.edu. If not, we have created a new account for you.

Get an ssh Client

You'll need to use a Secure Shell (SSH) client to access wilkes. Some options include:

In CS 70 and other courses, you may have used Visual Studio Code as an editor and to connect to remote servers. However, in the spirit of learning new tools and approaches, in CS 105 we encourage you not to use Visual Studio Code for this course. If you really want to use it, you can (see a guide), but all our instructions will assume you're using a terminal or other SSH client.

Logging In

Once you have a terminal or command prompt and have an ssh program installed, you can login to wilkes with the following command in the terminal, but replace "username" with your actual username on the server (e.g., first initial + last name):

  ssh username@wilkes.cs.hmc.edu

After hitting enter, type your password when prompted (note you won't see your password as you type). You've successfully logged in! If this is the first time using your account, you may want to change your initial password.

A Few Other Helpful Commands

When you first log in via ssh, you'll end up in your home directory on wilkes. Here are a few other commands that will probably be helpful:

Editing Files on wilkes

You'll need to use a text editor to modify files on wilkes for most of the lab assignments in this course, sometimes for source code and sometimes for recording your answers to questions. We recommend using the emacs text editor, although you are welcome to use a different one. Check out the help page for a quick introduction to using emacs if you haven't used it before.

Bits Lab Starter Code and Instructions

Like many of the lab assignments in this course, this assignment has:

  1. A handout that gives detailed instructions, as well as
  2. starter code. The starter code for this lab is already available on the server in the directory /cs/cs105/labs/lab1-bits. The first step is to make your own copy of the code to work on. After ssh-ing into wilkes, run the following commands:
      mkdir -p ~/cs105
      cd ~/cs105
      cp -ai /cs/cs105/labs/lab1-bits .
      cd lab1-bits
    
    You can paste them all in at once. Once you've done that, you're ready to start working on the lab! (Don't run this command again later; it will overwrite your work!) See more about the lab in the handout.

Due Date and Submission

This assignment is due September 18th, 1:15pm.

As described in the handout, you can submit your work from the command line on wilkes in your lab assignment directory:

cs105submit -a 01 bits.c