CS61C Spring 2014 Lab 0 - Number Representation

Goals

Reading

Accounts

You need to have an EECS instructional account (cs61c-*) in order to do your lab work (and submit assignments). Make sure to get an account form from your lab TA.
Most importantly, you will need to log in to this account in order to enroll in the class.
Don't forget to change your password once you have logged in!

Mini-Lecture

The first part of lab will be a mini-lecture given by your TA. Topics to be covered include:

Exercises

Exercise 0: Account Registration

Log in to your instructional account and run the register command, filling out the requested information. If you get an error message telling you to contact your TA for assistance, ssh into star.cs.berkeley.edu and try again (the hive machines have been finicky about registering students in the past). This exercise is of critical importance -- we won't be able to grade many of your assignments unless you are properly registered.

Checkoff:

Run check-register and show the results to your TA.

Exercise 1: Binary Alphabet

Let's take 4-bit numbers. If we stack five 4-bit numbers on top of each other in binary, we can make patterns and pictures! To help visualize this, you can think of 0's and 1's as white and black instead. For example, what does the following bit pattern look like?

0 1 1 0   ■ ■ □
1 0 0 1   □ □ ■
1 1 1 1 -->   ■ ■ ■
1 0 0 1   □ □ ■
1 0 0 1   □ □ ■

Checkoff:

Exercise 2: Cisco Binary Game

Click here to find the game. The object is to match the number on the right with the unsigned binary representation on the left. This requires a combination of clicking and typing. And then there's time pressure to make things more fun!

The game gets progressively faster and more difficult are you progress. See if you can score over 20,000 points and get to Level 5!

Checkoff:

Exercise 3: 1,000 $1 Bills

I hand you a thousand $1 bills and ten envelopes. Your job is to find a way to put various numbers of dollar bills in those ten envelopes so that no matter what amount of money I ask you for (between $1-1000), you can simply hand me some combination of envelopes and always be assured of giving me the correct amount of cash.

Checkoff:

Exercise 4: Pearls Before Swine

This is one version of a very cool game that has a neat solution based on number representation.
Play the game here. First play a few times and see if you can win a few rounds.

After you've tried a few times, give the following Wikipedia article a glance (note that this is the misère version).
With this newfound knowledge in hand, you should be able to beat Juan every time! But it will likely still take some practice. Keep going until you can win consistently!

Checkoff: