Project Phase 1

This is the archived website of SI 413 from the Fall 2012 semester. Feel free to browse around; you may also find more recent offerings at my teaching page.

Overview

The first part of your project will start with a working implementation of the "99 bottles of beer" program in your language. You will then need to modify this program according to the specifications below. Which modifications you need to make depend on your programming language, and are listed on the page for that language. So you probably won't need to make every modification listed below.

A link to the 99 bottles of beer program that I think is "best" for your programming language is also available on each language's web page. Here are the links to those pages, for your convenience:

Brainfuck, Piet, Smalltalk, Objective C, Erlang, go, Prolog, Haskell, emacs Lisp, Clojure, bash, Ruby, BASIC

Grading

Phase 1 counts as 20% of your total project grade. The goal is to "get your feet wet" with the basics of the language and the development environment (compiler, interpreter, IDE, whatever). With this goal in mind, I recommend taking the time to make sure you actually understand what you're doing. You might be able to get away with just some minor edits to the existing code, producing a working program without still having any comprehension of it. This will not prepare you well for Phase 2, which will be more difficult, and more independent.

To encourage you to take this advice seriously, coding style will count for 50% of your grade for this part of the project, and the actual correctness for the other 50%. This means that you need to do things like:

The Modifications

Remember, which of these you need to do is specified on that language's page. They are referred to there by their letters here.

  1. Count up from 1 instead of down from 99. After this, your program should output something like
    1 bottle of beer on the wall, 1 bottle of beer.
    Take one down, pass it around, 2 bottles of beer on the wall.
    
    2 bottles of beer on the wall, 2 bottles of beer.
    Take one down, pass it around, 3 bottles of beer on the wall.
    
    ...
    
    99 bottles of beer on the wall, 99 bottles of beer.
    Take one down, pass it around, 100 bottles of beer on the wall.
      
  2. Of course that doesn't make much sense. So change the lyrics to look like:
    1 line of text on the screen, 1 line of text.
    Print it out, stand up and shout, 2 lines of text on the screen.
    
    2 lines of text on the screen, 2 lines of text.
    Print it out, stand up and shout, 3 lines of text on the screen.
    
    ...
    
    99 lines of text on the screen, 99 lines of text.
    Print it out, stand up and should, 100 lines of text on the screen.
      
    Actually, you can change the lyrics to whatever you like, as long as it follows this general pattern (should be counting up something in the lyrics from 1 to 100). Nothing you'd be embarrassed to sing though...
  3. Instead of counting up by 1 every time, choose a random number between 1 and 10 and increment by that. Since it's random, I should get a different output every time I run your program.
  4. Display a prompt like "How many lines? " and read an integer from the terminal. Then stop the song when you hit that number (instead of 100).
  5. Like (D), but instead of reading the number of lines from the terminal, pop up a dialog box with the prompt and an input box for the number.
  6. Pause 1 second between printing out each stanza to the screen, for dramatic effect.
  7. Print each number fully factored into its prime factors. For instance, 1 should print as () - an empty pair of parentheses, 2 will print as (2), 24 as (2*2*2*3), etc.
  8. Open a file called "out.txt" in the current directory and output both to the screen and to that file. The lyrics in the file should be slightly different, like "lines of text in the file" or whatever you like (within reason).
  9. Print to to the screen and write to out.txt concurrently, in separate processes or threads within your program. Have each thread announce when it finishes, by writing a message to stderr like "Screen finished" or "File finished". Note that you should not pause between writing lines to the file, even if you did (F).