A. Before You Start
Now is a good time to make sure you've turned in what you think you turned in.
- Use the [Scores] tab of the course website to check that you have submissions for everything at the times you expect.
To make sure that your local machine has all tags in the central repository, run:
git fetch origin
To see what tags you have, run:
If you have a tag (say
hw1-2), then the command
git 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 [Scores] submissions by date.
- Note: Run
git statusto see which files are ones you created and never bothered to track, listed under "Untracked files". These files aren't being tracked by git yet, and thus aren't part of ANY submission.
After making sure that you've committed all current work in your local repository, you can check out any tagged submission (say,
git checkout hw1-2
It will tell you that you are in "detached head state". Despite sounding sinister, that's actually quite normal. Detached head means that your git repository is no longer at the latest commit, or "head", of your master branch (or any branch, for that matter).
Checking out a tag will allow you to see the exact files you submitted for that tag. Open any file, and you can see the state of that file for that specific submission.
IMPORTANT: When you're finished looking around in "detached head" state, you can run
git checkout master
to go back to the master branch.
This is important because if you start modifying, adding, and committing files while your head is detached, you'll end up with a very messy git repo that will need some cleaning up.
Let's clean up any untracked files that we don't care about. Run
If you don't see a section called "Untracked files", skip this step. Otherwise, look through the list of untracked files. You may notice files
outunder some of your lab and homework directories. There are some files that you don't need to submit to the autograder for labs, homeworks, and projects, but show up in your repository anyways. As the semester continues, this list of "Untracked files" that we don't care about may get longer, and this makes running
git statusa bit annoying. Let's clean that up now.
In the root of your git repository, ie. the repo folder, open the
.gitignorefile if it exists, and create it if it doesn't with
As the name implies, this file contains the names of files that we want git to ignore. Add the untracked files that you don't want git to keep track of in this file, one per line. For example, any
.DS_Storefile or file ending with
.imlcan be safely added to the
.gitignore, along with any
.ideafolders. You may have other files that you want git to ignore too -- feel free to add them, or ask a lab assistant/TA if you're unsure.
.gitignoreallows you to pattern match files. This is helpful if you have lots of similarly-named files that you want to ignore. For example,
*.imltells git to ignore all files that end with
.iml, in all subdirectories.
When you're done, add and commit this
.gitignorefile just like any other file, that we DO want git to keep track of.
B. Some Review
We'll start by reviewing pointers, arrays, and OOP. Complete these four interactive exercises:
C. Project 0
Hopefully you've made some good progress on Project 0, which is due Monday, September 18. The rest of the lab is for you to work on the project. A couple of pointers:
Suppose this is the layout of the board, and we move the grid to the left:
Make sure you know what the next board should look like, after collapsing the tiles appropriately. If you're unsure, reread the game specifications and ask your neighbors.
- When shifting the tiles for a particular column/row, think about when tiles should be merged together, and when they shouldn't. This is one of the trickiest part of the project.
- Understand what
setVtiledo. They'll be quite helpful because they allow
tiltto be implemented as if the specified
Sideis facing North.
- Similar to the previous point, think about why we have the
colmethods for the
Sideclass. How do these methods (in conjunction with
vtile) help prevent the need for duplicate code? What would the code look like if we didn't use these methods?
- Update the score and max score according to the project spec. The way we update score and max score may be different from other versions of 2048 that you might have played.
- Keep an eye on the Project 0 Curated Post on Piazza for frequently asked questions
- Code with good style! In IntelliJ's left panel, right click on a .java file and click "Check Style" to check your file for style issues.
There is nothing to tag or submit for this lab. Good luck with the project!