cmpt165

Spring 2007

CMPT 165-D2 @ Surrey Assignments

Due Date:

Friday, March 16th by 11:59pm (submit via WebCT and the course web server, see below).

In this assignment you will use JavaScript to create a Mad Lib generator on the web. A Mad Lib is a silly party game where the words of a story are replaced with humourous alternatives. Those playing the game do not see the story before it is complete, instead during the game the presenter asks them to provide words without knowing anything about the topic (such as, "give me a noun, now give me a verb, now give me something round" etc). The presenter then plugs in the words in their appropriate places in the story, and reads the story aloud.

For example:

"The sun was ING-verb as man's name grabbed his something square and set out for his job noun."

After asking the players for the words in bold, those words are then plugged into the story. The result might be something like:

"The sun was melting as Bob grabbed his ice cube and set out for his job potato."

Part 1: Interactive Web Page

Create an introductory web page called intro.html. On this page you must provide the instructions for the Mad Lib game, and a link to start the game when the player is ready. This link will start the mad lib game, and on its completion the new, hilarious story will be displayed for the player to enjoy.

(Note that if you are caught copying existing web content, you will receive zero for this assignment).

Specific requirements:

  1. You must write your own, original story.
  2. Your story must be at least two paragraphs long.
  3. You must have at least 8 missing words in your mad lib (that is, you must ask your player for eight different words)
  4. At least one of the missing words in the story should be used more than once in the story. For example, if you ask for a person's name, then you might use that same name later in the story (without asking the player for the name again).
  5. The title page and the madlib page must be well-formatted and use the practices of good web design that we have discussed in class.

Part 2: The Mad Lib Generator

You must write a JavaScript program, called "madlib.js", that asks the player for the necessary words, and then saves those words to output them at the end, when the full story is displayed. At the time of this assignment going out, you have already been prepared with some of the tools needed to complete your mad lib generator. We will be covering the remaining tools in the next week or so. For now, note that you can write information to a web page using the document.writeln("content to write to web page"); line -- note that the information inside the parentheses can also be a variable.

Submission

When you're done the assignment, make sure that you have saved all of your files in a single directory. You must add one more file to this directory that you must call "readme.txt". You can create this file using Notepad on a PC (or TextEdit on a Mac). In this file you will put your full name, student number and the URL of your assignment (e.g. "http://cmpt165.cs.sfu.ca/~kvoll/assign2_page1.html" -- note that you must check to make sure that all of your necessary files were uploaded correctly).

Once you have created the README file and saved it to your directory, you can then zip that directory. To do so, right-click on the file and select "Add to filename.zip" (note, if this option does not appear you do not have WinZip installed on your computer -- click on this link to download and install it). This will create a new file called "filename.zip", where "filename" is the name of your directory. If you are a Mac user, you will right-click and select "Create Archive of filename", which will do the same thing. Once you are done zipping the file, you can submit your assignment via the Assignments section of WebCT (there you will see an assignment called 'Assignment 3').

**NOTE**You should give your zip file a name indicating the assignment number, as well as your user ID (since this is unique to you). For example, if I was creating a zip file to submit for this assignment I would call my file "assign3_kvoll.zip".

Do not email your assignment to anyone, not even the submission email address -- thanks!