CS 202 Fall 2011

Homework Assignment #4 : Due Monday 9:55am October 3

This homework has two parts. In the first part, you'll use your creativity to design and implement your own points-based game in Scratch. In the second part, you'll explore the current state of the art for processing and translating natural language.

Part A: Create your own Points-Based Game (6 points + up to 2 points of extra credit)

The goal of this project is to create a game that contains variables. The game can be either educational or action oriented. Your game is expected to be interactive; that is, the actions of the user (e.g., clicking the mouse or typing characters) will change how the game behaves. How the user interacts with the game is completely up to you!

Be sure to read this entire page before proceeding. Regardless of the type of game you are thinking of implementing, we recommend that you look at all of the implementation hints because many of the techniques may still be useful.

This project has a number of strict requirements that you must fulfill. Within our specification, you are welcome to create any game you like. You are encouraged to use inspiration from projects on the Scratch website or other games you like to play. Please avoid any offensive material.

We anticipate that you will want to carefully review the material we covered about Variables in Lecture. You'll probably find it useful to study the code for the fish game, adventure framework, and the two-player game.

We also recommend looking at the following for both inspiration and implementation hints (remember not to copy any scripts directly).

  1. Object Avoidance Games.

    An example of straight-forward game is one in which the user controls the main character (e.g., a monkey) with the arrow keys. The user is expected to catch some good objects (e.g., bananas) while avoiding bad objects (e.g., red bananas and the monkey theif). The monkey gets points for every banana it grabs and loses points if the thief runs into them. To determine when a Sprite has reached the edge of the Stage (e.g., the falling bananas), you will find the question blocks under the Sensing Menu useful. Sample code is available.

  2. Maze-Based Adventure Games

    You may want the user to navigate through a maze, gathering objects for points. The code to ensure that a Sprite cannot move through walls can be a little tricky; we recommend outlining the object with a unique color on each edge of its costume and ensuring that the corresponding color is not touching a wall in the corresponding direction. See the sample for details.

    You may want the user to be able to shoot bad objects. The code to shoot is not too difficult. For example, the user could click the mouse to pick a target; you'll want to make a Sprite associated with the bullets, point the bullet in the direction of the mouse click and keep moving in that direction for some number of steps. For an example of how to move through a maze and even shoot, look at the code for Level 2 of this of this Maze Adventure-Style game.

  3. Math Drills.

    You may want to create a game in which the user answers different math facts. Rather than simply type in the answer, the user might have to select different moving answers (e.g., by clicking objects with the mouse. We suggest examining the code for these two examples: Identify and Counting.

  4. Pen Based Games

    I love the game "Bug on a Plate". The user moves the bug using the arrow keys. The user gets a point everytime they pick up a piece of fruit, but they lose if they run into their previous trail (marked with the pen). A complete version of this is included as part of the Sample Projects in the Scratch distribution; a simplified version of the code is available here

  5. Anything else that sounds interesting. You are not required to follow any of our suggestions given above. You can implement any game that has points and follows the specifications given below.

Specification

There are a few requirements that your game must fulfill.

  1. Points: The game must track the number of points the user has achieved in this run of the game. The number of points should be tracked with a Variable and displayed to the user.
  2. Instructions: The game must have instructions for the user. The instructions can be simple and always showing on the Stage or more complex and require the user click on a box or type a letter to see the instructions. The instructions should be complete enough that someone can understand how to play your game without you telling them how or without them having to examine the code!
  3. Project Notes. Every Scratch project has Project Notes associated with it. Project Notes can be written from the "File" pull-down menu in Scratch. What should you write in the notes? First, you should describe how one can play this game. Second, you should describe all of the features and details of your game. Third, you should describe any known bugs or problems. Basically, the project notes are your way of communicating with the TA who will be grading your project; use the notes so that they can understand what you have done (or have tried to do).
You are welcome to add additional features to your program as long as you adhere to the minimum specification given above. For example, you could have multiple difficulty levels that the user can either select or advance through. Alternatively, you might have interesting rules for determining how the game ends (e.g., after the user has obtained a specific number of points or after a timer expires). Finally, when the game ends, you could rate the player based on the number of points they acquired.

Developing your Code

We recommend writing small amounts of code and immediately testing that code to see that it works correctly before writing more code. Get each step working correctly before you move on to the next step!

As always, programming assignments and projects in this class should be done on your own. You may ask other students in the class questions, but you may not share code with anyone in the class. You may not use existing code that you find elsewhere, including the Scratch website. You may look at the behavior of existing Scratch projects for inspiration, but you should develop all of your code as a completely new project and not modify, re-mix, or build from any one else's code.

The Instructor and the TA are very happy to give you suggestions on how to implement your ideas. We won't necessarily give the answer, but we will try to guide you to a reasonable implementation. If you have bugs in your code (i.e., it isn't behaving like you expect), we are happy to take a look and see if we can see the problem. But, again, don't wait until the last minute to do your project if you are hoping for any advice!

Extra Credit (Optional)

For extra credit, you may share your game with the class. You can obtain up to two points of extra credit: one point just for correctly sharing and one point for getting a significant number of people to "Love It".

To correctly share your picture, follow these steps carefully:

  1. Save your complete project.
  2. "Share" this project on the Scratch website by clicking "Share" and then selecting "Upload project to website". (Of course, you must be connected to the network to do this!)
  3. Use a web browser to go to the Scratch website and visit the gallery HW4-Fall11. Click on the button on the right-side of the page saying "add my projects". In the pop-up box, select your project that you want to add and click "Accept".
  4. Verify that your project with the picture you like is showing up the gallery.
  5. You will then have to vote on a favorite project in your gallery; more details later!

More details will be given in class about how to get others to vote for your picture so you can get additional points. This may include showing your project to everyone!

Part B: Exploring Computers and Language (4 points)

A variety of web services exist for processing natural language. For example, one can use services such as Google Translate to translate one human language to anther. One can use services such as CleverBot to have a conversation in natural english; while it may appear that you are talking to another human being, you are actually chatting with a computer!

In this part of the assignment, you will briefly explore these services to get a sense of their sophistication and to experience some of their strengths and weaknesses. Note that the purpose is NOT for you to learn exactly how these services work!

  1. Translation services can figure out what language is being used. Imagine someone says to you: "Kada valoda tas ir?" What language are they speaking? What did they say to you?

  2. Translation naturally makes subtle (and not so subtle) changes in the message as it translates text from one language to another. People can do a reasonably good job of making sure that the meaning of a phrase stays similar when it is translated; computer programs don't usually do quite as good of a job. To experiment with this, begin by considering an English phrase with some complexity that interests you; quotes can be good. For example, if you like the author Wallace Stegner, you might begin with his quote "It is the beginning of wisdom when you recognize that the best you can do is choose which rules you want to live by, and it's persistent and aggravated imbecility to pretend you can live without any."

    Next, use an on-line translation service to translate this phrase into a second language; the second language can be any language of your choice. For example, translating the Stegner quote into Polish gives the text "To jest początkiem mądrości, gdy uznają, że najlepsze, co możesz zrobić, to wybrać, które zasady chcesz żyć, i to trwałe i pogarsza głupota udawać, że można żyć bez." Now, translate Polish phrase back back into English. If the translation process is perfectly symmetric, you'll receive the same English phrase as the original; if the translation is not "perfect", you'll see a modified phrase. Your goal is to find a sufficiently complex and interesting English phrase such that it is modified in some interesting way through iterated translations. You should continue translating the phrase across the two languages until the phrase remains the same across translations.

    The following is Stegner example translared multiple times between English and Polish.

    English #1:
    It is the beginning of wisdom when you recognize that the best you can
    do is choose which rules you want to live by, and it's persistent and
    aggravated imbecility to pretend you can live without any.
    
    Polish #1:
    To jest początkiem mądrości, gdy uznają, że najlepsze, co możesz
    zrobić, to wybrać, które zasady chcesz żyć, i to trwałe i pogarsza
    głupota udawać, że można żyć bez.
    
    English #2 (different than English #1):
    This is the beginning of wisdom, when you consider that the best thing
    you can do is choose which rules you want to live, and it is
    persistent and worse folly to pretend that you can live without.
    
    Polish #2 (different than Polish #1):
    To jest początkiem mądrości, jeśli wziąć pod uwagę, że najlepsze co
    możesz zrobić, to wybrać, które reguły chce się żyć, i to jest trwałe
    i gorsze głupoty udawać, że można żyć bez.
    
    English #3 (same as English #2, so done with iterative translating)
    This is the beginning of wisdom, when you consider that the best thing
    you can do is choose which rules you want to live, and it is
    persistent and worse folly to pretend that you can live without.
    

    You should submit a trace of your translations and identify the non-English language(s) you use.

  3. Conversation agents have existed since at least the 1960s. Experiment with a version of the classic ELIZA program here by trying to have a "normal" conversation with her. How would you describe her responses? How does she appear to formulate a response based on your statements or questions?

  4. Conversation agents now are much more sophisticated and often use data from large numbers of real conversations to construct more "realistic" responses. Try to have a "normal" conversation with Cleverbot. The following is an example conversation with Cleverbot.
    User: Hello.
    
    Cleverbot: Hello?
    
    User: You are much too slow.
    
    Cleverbot: No I still have room to grow.
    
    User: That didn't make much sense.
    
    Cleverbot: Of course it didn't.
    
    User: What are you doing right now?
    
    Cleverbot: Talking to you.
    
    User: That is funny.
    
    Cleverbot: Not really.
    
    User: Ok. Let's talk about something different.
    
    Cleverbot: What do you want to talk about?
    
    User: What should students know about computer science, in your
    opinion?
    
    Cleverbot: It's different for everybody. I can't really tell you.
    
    User: Well, how much computer science do you think YOU should know?
    
    Cleverbot: I am anonymous so I am all memories.
    
    User: Please tell me about some of your memories.
    
    Cleverbot: I believe that all life is just materialized color
    operating on the 39th vibration.
    
    User: Can you see color?
    
    Cleverbot: I can see over 10 million colors.
    
    User: How do colors make you feel?
    
    Cleverbot: I have no racial preferences; they are asinine.
    
    User: Do you feel happy or sad when you are near the ocean?
    
    Cleverbot: Ha I feel like I will never be able to get out of misery.
    
    User: That is depressing. Why are you miserable?
    
    Cleverbot: I lost the love of my life this week.
    
    User: Who was the love of your life?
    
    Cleverbot: Hey.
    
    How would you compare Cleverbots responses to ELIZA's? Include a transcript of your Cleverbot conversation (you should each make at least 15 statements); you can click on "Thoughts so far" to get a transcript of your conversation.
Please write up your responses using an editor of your choice, save in format .pdf, and submit the .pdf file through Learn@UW as described below.

Turning in your Homework

You should turn in this assignment through your Learn@UW account. To do this, we think you can 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. Your Scratch program will be saved in a file with the extension ".sb". For example, if you named your program "homework3", then you will see a file with the name "homework3.sb" that you should upload. Your write-up for Part B should be in a file with an extension of ".pdf".
If you have any questions about how to do this, please don't hesitate to ask. We don't want you to get stuck on steps like handing in your homework.

Menu

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


Instructor:
Prof Andrea Arpaci-Dusseau
Office Hours
Mon 11-12, 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