Project 0, The Story Game

Due: Tuesday, September 17, 11:59pm


  1. To make sure that each student is able to submit projects using shared directories.
  2. To provide some experience with version control systems.


Utilities such as CVS, SVN and GIT are important and necessary tools when you work in a large software projects with multiple programmers. These utilities facilitate collaboration and version control. However, these are not desirable features in a system used to manage project submission in a course like ours, since, for example, we do not want students to collaborate on their programming assignments. Thus, we will not be using CVS or SVN or GIT for project submission this semester.

Instead, we will practice using CVS just for Project 0. Each section of the course will participate in a collaborative effort to write a story. This is the familiar "story game" in which each person adds one or two sentences to a story --- except we will do this in Java.


  1. First, read the Project Submission page and set up your GL account with the shared directory for this class.

  2. If you skipped the first step, just log into GL and type
    ln -s /afs/ ~/cs341proj
    where userid should be replaced by your username. This assumes you do not already have a file or directory named cs341proj.

  3. Next, checkout the current version of the story from your section's CVS repository. In your home directory, type in one of the following (depending on your section):
    cvs -d /afs/ checkout -d myproj0 .
    cvs -d /afs/ checkout -d myproj0 .
    cvs -d /afs/ checkout -d myproj0 .
    cvs -d /afs/ checkout -d myproj0 .
    Note that the period '.' at the end is necessary. This copies the files in the CVS repository to a directory named myproj0 in your home directory.

  4. Compile and run the current version of the program.
    cd myproj0
    ant run
    The Java program should print out the beginning of the story plus any lines that other students in your section added.

    The stories for the sections begins with:

    Section 1:
    It was a dark a stormy night. The ninja approached his target carefully. 
    Section 2:
    They say that everything must start somewhere. That is, unless you have a time machine, 
    then it gets all wibbly wobbly. 
    Section 3:
    Long long time ago, in a galaxy far far away, a dragon woke from a long slumber.
    SOMEONE took the saying "Don't poke the bear" too literally and did not understand 
    that it refers to more than just bears.
    Section 4:
    Once upon a time in a farwawy castle lived a robot. 
    The robot had a special task --- if only he could remember what that task was. 

  5. Add another sentence or two to the story. First, go to the directory with the source code and look at the Java files.
    cd src/story

    You should see files named,, ... Each file, of course, contains the code for the corresponding Java class. Each StoryXX class prints out one or two sentences of the story in its printStoryLine() method. The Story(i+1) class literally extends the Storyi class. The previous lines of the story are printed by invoking:

    super.printStoryLine() ;

    Add another sentence to the story by creating a new StoryXX class that extends the last StoryXX class. You will also need to modify the main program in to make it invoke printStoryLine() in your StoryXX class (and not the previous one).

  6. Check your program. Go back to the top level of the project, compile and run your program. Make sure that your addition gets printed:
    cd ../..
    ant run

  7. Check in your changes to the story to the CVS repository:
    cvs add src/story/
    cvs commit -m "Submitted by John Doe." 
    Of course, replace the XX in with the real name of the file you added and "John Doe" with your own name.

  8. CVS might say that you have a conflict. That means another student in your section added the next sentence to the story while you were busy thinking up something clever to say. To fix this, you have to:
    • Rename your file something else temporarily.
    • Update the program from the CVS repository:
      cvs update
      cvs update
      (Yes, do it twice, the first time CVS will complain that your file disappeared.)
    • Re-compile and run the latest version of the story.
    • Rewrite your sentence to fit with this latest version.
    • Rename your file. Modify it so that it extends the right class.
    • Modify again.
    • Check-in your changes to the CVS repository again:
      cd ~/myproj0
      cvs add src/story/
      cvs commit -m "Submitted by John Doe." 
      Remember to use the new file name for
    • Cross your fingers and hope that there is no conflict this time. Otherwise, you have to repeat this step again.

  9. Submit your program for grading. (Recall that we are NOT using CVS for project submission.) Copy your files to the shared directory for Project 0:
    cd ~/myproj0
    cp -r build.xml src ~/cs341proj/proj0/

  10. Check your submission. Go to the shared directory for Project 0 and make sure that your program runs correctly there:
    cd ~/cs341proj/proj0
    ant run

  11. Clean up your submission:
    ant clean 

  12. That's it. You're done. You can check the progress of the story at any time by:
    cd ~/myproj0
    cvs update
    ant run

Implementation Notes