CS 202 Fall 2010

Homework #3 Due Friday 9/24 Before Class : Interactive Stories and Decision Trees

Questions?: Mail cs202-tas@cs.wisc.edu

The purpose of this homework assignment is to extend an existing "interactive story". An interactive story is an animated story in which the reader controls the future action, much like a Choose Your Own Adventure.

In this assignment, you will learn how to download code from the Scratch website, reverse engineer a decision tree (or flowchart) from an existing program, and extend an interactive story with new scenes and characters.

This assignment has four steps:

  1. Download the assigned interactive story, called mystery.
  2. Draw the decision tree that corresponds to this interactive story and answer a few questions about the resulting decision tree.
  3. Expand the interactive story by adding to both the decision tree and to the Scratch project.
  4. Turn in your work.
These four steps are described in more detail below.

Step 1: Download the story

The first step is to use a web browser to visit the Scratch project at the following URL: http://scratch.mit.edu/projects/dusseau/1300123.

Near the top right of the web page, you will see a link that allows you to download the Scratch project named "mystery".

After you've clicked on the link, you will find a file called "mystey.sb" on your local computer (perhaps in your Downloads directory). Open "mystery.sb" in Scratch and you should see an interactive story that looks like this:

Step 2: Create the decision tree

Your main task is to create a decision tree (or call it a flowchart) that corresponds to the mystery code. You will create this decision tree both by running the program (and giving it all of the different possible inputs) and by examining the code.

One benefit of a decision tree is that someone can look at and quickly understand the basic behavior and structure of the Scratch program. We can use this to see if you understand the structure of the program.

You must follow a few conventions when constructing your decision tree.

  • Your decision tree should begin with a box (or node) showing the Initial State of the story.
  • Each individual script in the program should correspond to one node in the decision tree.
  • Each node of the decision tree should have a descriptive name matching the name of the message used to activate the script.
  • Text within each node should briefly summarize the appearance and action of each character in that scene as well as the Background.
  • Lines with arrows (or "edges") should be used to show how nodes are connected to one another.
  • In some cases, there will be only one edge going out of a node; this indicates that the user does not control what happens next.
  • In other cases, there will be multiple edges going out of a node; this indicates that the controls what happens next. Here, the edges must be labelled with the input the user gives for this action.
  • It is possible for different sequences of input to lead to the same node of the decision tree. In this case, a node will have multiple incoming edges.
To construct the decision tree, we expect that you will interact with the story numerous times and carefully examine the source code while taking notes for yourself.

We expect that you will create a very neatly drawn decision tree. You may draw the decision tree either by hand or with any software of your choice (e.g., Microsoft Word and Powerpoint both contain basic functionality to draw boxes with text and arrows). If your draw by hand, you will probably need to make numerous copies to make sure the final tree fits on a single page and that nodes are laid out in a reasonable fashion. (In other words, if we get a headache trying to read your decision tree, we will take points off.)

After you have completed your decision tree, answer the following questions:

  1. How many different outcomes are in the story (that is, how many unique leaf nodes are there in the decision tree)?
  2. What is the series of answers a person must give to reach the scene in which they die?
  3. What is the series of answers a person must give to reach the "To be continued" scene?
  4. How many different possible paths are there through the decision tree to the leaf nodes? In other words, how many different sequences of answers can a person give? Explain how you obtained your answer or enumerate the possibilities.

Extending the Interactive Story

This part of the homework is your opportunity to be creative. Here, you will extend the existing interactive story both in the decision tree and in the Scratch program.

You should begin by extending the decision tree you already drew, continuing the story where it left off at the "To be continued" scene. Your extensions must have the following properties:

  • Add (at least) three new decisions (or questions) that have two answers each. Each answer should lead to a unique new state that has its own scripts.
  • Introduce at least two new backgrounds (including changing the "To be continued" background).
  • Add at least one new character (that does more than simply "show" itself).
  • All other scenes before "To be continued" should be left unmodified. You may not change any other nodes of the story.
For the drawing you turn in, you may either extend the previous tree into one complete tree or make a new (small) tree showing just the change starting at the "To be continued" scene.

After you are happy with the action described in your decision tree, you should extend the Scratch program "mystery.sb" to implement your additions.

When implementing, keep the following requirements in mind:

  • Your additions to the Scratch program must exactly match the extended decision tree you created.
  • The names of the messages must match names of states in the decision tree.
  • Make sure you don't modify any of the existing code (other than changing the "To be continued" message and/or script).
  • Make sure to specify the Initial State of the new character you've added.

If you have any questions about how to do this homework, please don't hesitate to ask. We want everyone in the course to master these steps!

Turning in your Homework

You must turn in both your modified Scratch program as well as your decision trees and answers.

You must turn in the Scratch program through your Learn@UW account. You must name your modified Scratch program "FirstnameLastName_hw3.sb", for example, "HengGuo_hw3.sb". Follow the steps below for using Learn@UW.

Your decision trees and short answers can either be turned in at lecture the day it is due (e.g., if you drew it by hand) or submitted through Learn@UW as a PDF file (e.g., if you drew it using Word or scanned in your drawing). If you submit through Learn@UW, use the naming convention "FirstnameLastName_tree-1.pdf" and "FirstnameLastName_tree-2.pdf" for your decision trees. (If you have only a single decision tree containing the full interactive story, that is fine.) Your files must be PDF files (and not Word or Powerpoint); again, ask for help if needed!

To use Learn@UW, follow these steps:

  1. Login into LearnUW : "learnuw.wisc.edu" using UW NetID and password.
  2. Click on the link "compsci202:Introduction to Computation" under student tab.
  3. Click the Dropbox option which is on Top-Left of your web page.
  4. Click the link to the corresponding HomeWork you need to upload. It directs you to a page where you can upload files.
  5. Upload the desired files and submit them.

Menu

Fall 2010
Time: MWF 9:55-10:45
Room: 105 Psychology
Lab: 1370 CS (1st floor)


Instructor:
Prof Andrea Arpaci-Dusseau
Office Hours Tue 2:30-3:30, Wed 11-12
Office: 7375 Computer Sciences
Email: dusseau "at" cs.wisc.edu

  • CS202 Home
  • TAs and Lab Hours
  • Lecture Schedule w/ Slides
  • Grading
  • Homeworks
  • Projects
  • Exams
  • Scratch Examples
  • Readings
  • Computing Resources
  • Outreach Opportunity

  • Interesting Links
  • Scratch
  • UW Computer Sciences Dept