Please report any errors directly to us: cs61b@eecs.berkeley.edu
Navigation
A. Before You Start
We're going to start enforcing deadlines, so now is a good time to make sure you've turned in what you think.
- Use
glookup -t
to check that you have submissions for everything at the times you expect. - Use
git fetch origin
to make sure you have all the tags work in the central repository. - Use
git tag
to see what tags you have. If you have a tag (say
hw1-2
), then the commandgit log -1 hw1-2 # That's a one, not an ell
will print the log message for that tag, which has a date and time.
- You can match up tags with glookup submissions by date.
After making sure that all current work in your local repository, you can check out any selected submission (say,
hw1-2
) withgit checkout hw1-2
(It will tell you that you are in "detached head state", but that's normal. This will allow you to see what we received from you. Make sure you do
git status
to make sure that the files you are looking at have all been added to the repository, and aren't just files you created and never bothered to track.- When finished looking, you can use 'git checkout' on the branch you came from to get back (be sure you do this, or you will commit and submit something random next time!)
- Use
- On your home machine or laptop make sure you have the latest version of
cs61b-software
(do not do this on your instructional account; there should not be acs61b-software
directory there. Just go intocs61b-software
and use the commandgit pull --rebase
to get any updates we might have made.
B. Some Review
We'll start with some review exercises on the subjects of pointers and OOP:
C. Project 0
Take a look at the Mini Project 0 specification.
Set up your working directory with its files in the usual way (see the
instructions in the specification)
if you're not sure how. Take particular care about the
git push -u origin ...
step, so that you don't end up trying to push to
our repository instead of yours.
In the directory miniproj0
, run make
to compile the Java files. If you run java -ea cube.Main
in miniproj0
directory, you will see a (broken) GUI open, which will be updated as you make progresses in your project. To see an example, run the following to see a working version.
staff-cube
Take some time to toy around with the example.
To give you a glimpse of a typical workflow for projects, do the following steps:
- Go to instructions in the specification, and follow the first 5 instructions, reading the code as instructed. When reading a java File, do not try to digest the whole problem from top to bottom. Instead, first read the name of the class and defined methods to understand a big picture of what it is and what it does. Then, move onto learning what each method does. If you find some keywords that you do not understand (e.g. framework-specific classes and method calls), do not hesitate to look up Java documentation to figure out and make a note to yourself for a future reference by adding explanatory comments.
- Execute
make check
to run the JUnit tests on your current code. All tests should fail now, but you will conquer each of them one by one. - For
CubeModel.java
, figure out what kinds of instance variables are required. There is no hard and fast rules to this step, but you should be able to infer most of them by understanding theinitialize
method. Based on your analysis, declare the instance variables that
CubeModel
requires. Then, immediately add and commit the changes you just made.git add CubeModel.java git commit -m "[Proj0] Add instance variables to CubeModel."
- Implement the default constructor (without any parameters) in CubeModel.java, initializing the necessary instance variables. Then, immediately add and commit the changes with a helpful and readable commit message.
- Repeat step 5 for
side
,cubeRow
,cubeCol
,moves
,isPaintedSquare
, andisPaintedFace
. Make sure to add and commit the changes immedately for each method you implement. - Run
make check
again to see if you pass any of the tests.checkCons0
andcheckinit4
should pass. If not, make necessary changes until you pass those two tests. After the fix, remember to add and commit the changes. git push
to save your work to the central repository.
There is nothing to submit for this lab.