CSCI 136 - Fall 2019

Data Structures & Advanced Programming

Home | Bill's Lectures | Sam's Lectures | Labs | Handouts & Problem Sets | Links | CS@Williams

Lab 1: Unix, Workflow, and Coinstrip

In this lab, we will explore tools, techniques, and workflows used by many programmers. We will adopt some of these best practices and use them for managing our written and lab assignments, collaborating, and exchanging feedback.

The skills developed in this lab will help us on multiple fronts. The tools that we explore (Terminal.app, the Atom text editor) and the workflow we use (checkpointing our progress using the Git version control system) will help us to work efficiently, safely, and flexibly throughout the semester.

We will also write a program to play the Silver Dollar Game found at the end of Bailey Chapter 3 (page 67). In addition to gaining experience writing, compiling, and running programs from scratch, this lab will help us to think about how we can efficiently represent data and break our logic into reusable methods. Careful planning will help tremendously, so take the time to write a well-though-out design document before arriving to lab.

PRE-LAB Step 0: Version Control Systems and GitHub

Please complete PRE-LAB Step 0 by Monday at 4pm. This part is worth 2 basis points of your Lab 1 grade.

PRE-LAB Step 1: Testing Your CS Mac Lab Account

PRE-LAB Step 2: Design Documents

Step 1: The Mac Lab Environment

Step 2: Cloning

By the start of Lab, you will have a private repository in your GitHub account, named cs136lab1-USERNAME, where USERNAME is replaced with your GitHub ID. Clone the repository to your local disk using the following steps:

Step 3: Text Editors

There are many good text editors. Traditionally, we have used the Emacs text editor in CSCI 136. Emacs is a very powerful editor, and being proficient in Emacs is worth the time investment and the steep learning curve. However, this semester we will start by using the Atom text editor, and revisit Emacs after Spring break.

Step 4: First Program

In this step, we will write, compile, and run a Java program under Unix that prints the first ten odd numbers. Call it Odd.java. You will turn in your source code for Odd.java by committing it to your local git repository, and pushing that commit to your private repository on github.com. You should complete this step by the end of lab on Wednesday. The instructors and TAs are around to give as much assistance as we can on this step, so do not hesitate to ask questions! We want you to successfully complete this step so that you can move on to the main lab assignment. This is the simplest program we will write all semester, but it is often the hardest to complete. Ask questions early and often!

Step 5: Main Lab Program (Coinstrip.java)

This week, we will write the Silver Dollar Game at the end of Bailey Chapter 3 (page 67). As you think about the design of your game, you should first decide on an internal representation of the coin strip. Make sure your representation supports all of the operations necessary such as:

You should think about alternative designs and be able to justify your decisions. (Do you want a data structure that stores the spaces on the game board? Do you want a data structure that stores the coins? Think about the tradeoffs: which operations become easier to implement if you choose one representation over another?) You may read ahead a little to Vectors if you like, but the lab can be implemented just as efficiently with arrays.

Once you have decided on a representation, write down the set of operations supported by your data structure. In other words, what are the public methods of CoinStrip, what parameters do they take, what do they return, and what do they do? We will briefly discuss this initial design with a partner. Bring a physical copy of your design to lab for discussion. We will check design documents at the beginning of lab.

The lab’s description of how to generate a game is somewhat vague. At a high level, you should generate games that are "interesting". This roughly means:

Make sure your game enforces all rules described in the textbook. You may want to test your CoinStrip game (or show off your hard work) by playing against a friend.

Lab Deliverables

When you are finished with your CoinStrip program, answer the thought questions at the end of the lab, and put your answers in a separate file called PROBLEMS.md. Commit and push PROBLEMS.md along with your other lab files as part of your repository. Your repository should have the files:

	cs136lab1-USERNAME/
               Odd.java
               CoinStrip.java
               README.md
               PROBLEMS.md
      

Submitting Your Lab (Due: Sunday, Sept. 15, by 10:00 pm)

As you complete various milestones, you should commit your changes and push them. Commit early and often. When the deadline arrives, we will retrieve the latest version of your code. If you are confident that you are done, please include "Lab 1 Submission" as the commit message for your final commit. If you later decide that you have more edits to make, it is OK. We will look at the latest commit before the deadline.

We will know that the files are yours because they are in your git repository. Do not include identifying information in the code that you submit. Our goal is to grade the programs anonymously to avoid any bias. However, in your README.md file, please cite any sources of inspiration or collaboration (e.g., conversations with classmates). We take the honor code very seriously, and so should you. Please include the statement "I am the sole author of the work in this repository." In the comments at the top your Java files.