Lab 1: Bits
First Things First!
Your Availability
Head to the
to record when you're free to work outside of the lab sessions.
Partners
For most labs you will be working with a partner; use the spreadsheet below to find one and/or indicate your partner.
(When you have a pair, move one name from Person 1 to the Person 2 column; you can use the hex codes in the availability form to help find someone with similar availability.)
Getting Set Up to Work
We use Piazza for announcements, help requests, and so on. It's checked regularly by the course grutors and professor(s). Make sure you can access the Piazza site for CS 105.
We use Gradescope for various things (quizzes, exams, some homework).
Most of your work will be done on the CS 105 server, wilkes.cs.hmc.edu. Click the button below to
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.
Due Date
Due: Friday, February 6 at 11:59 PM
Do not submit code after the deadline unless you are using one of your late days.
Grading
Grading will be done with the same autograding tools we provide for you.
Your score will be computed out of a maximum of 69 points, divided as follows:
Correctness Points: 36
The fourteen puzzles you must solve have been given a difficulty
rating between one and four, such that their weighted sum totals
to 36. We will evaluate your functions using the btest program,
which is described in the next subsection. You will get full credit
for a puzzle if it passes all of the tests performed by btest, and
no credit otherwise.
Performance Points: 28
Our main concern at this point in the course is that you can get the right answer. However, we want to instill in you a sense of keeping things as short and simple as you can. Furthermore, some of the puzzles can be solved by brute force, but we want you to be more clever. Thus, for each function we've established a maximum number of operators that you are allowed to use for each function. This limit is very generous and is designed only to catch egregiously inefficient solutions. You will receive two points for each correct function that satisfies the operator limit.
Style Points: 5
Finally, we've reserved 5 points for a subjective evaluation of the style of your solutions and your commenting. Your solutions should be as clean and straightforward as possible. Your comments should be informative, but they need not be extensive.
Advice and Notes
-
Don't include the
<stdio.h>header file in yourbits.cfile, as it confusesdlcand results in some non-intuitive error messages. You will still be able to useprintfin yourbits.cfile for debugging without including the<stdio.h>header, althoughgccwill print a warning that you can ignore. Be sure to remove anyprintfstatements before runningdriver.pl. -
Variable declarations: the
dlcprogram enforces a stricter form of C declarations than is the case for C/C++ or that is enforced bygcc. In particular, any and all declarations must appear in a block (what you enclose in curly braces) before any statement that is not a declaration. For example, it will complain about the following code:
int foo(int x)
{
int a = x;
a *= 3; /* A statement that is not a declaration */
int b = a; /* ERROR: Declaration of b not allowed here */
}
- Be sure that your code compiles and runs correctly on
wilkes!
Steps
Once you have a partner, are set up on Gradescope, and can access the course's Piazza site and the CS 105 server (from above), you're ready to get started on the assignment proper!
(When logged in, completion status appears here.)