CSE131 Programming Contest

Announced: Sunday Nov 30
Entry Deadline: Sunday, Dec 7, 6 PM CST

Goals and Benefits: All contestants submitting qualified entries will...
Advice: In this contest, you will add features to your Lab 10 game and put it on the web for the whole world to play. You can submit your game as it is, provided that it works, but if you want to go for prizes and fame, we recommend that you improve your game in ways that will impress the judges. Is it fun to play? What could you add to make it more interesting or more challenging?

Be creative. Feel free to deviate as much as you like from the original assignment, provided that the final result is at least loosely based on Lab 10. Think carefully about your choices. Add features that make the game more attractive and fun. Avoid features that make the game too slow or confusing.

Entries will be judged on both form and function. For form, think about ways to represent the game objects using nifty shapes or images. For function, think about interesting levels or features you could add to the game.


  1. YOPS has a small problem that keeps it from functioning as an Applet. To fix this problem, open YOPS.java (from the yops package) in eclipse. If you look around line 832, you will see a line that resembles:
    and you should change this line to read:
    if (YOPS.getApplet() == null) m.setAccessible(true);
    Explanation (skip this if you like; go ahead: I double-dog dare you): YOPS uses reflection to examine whether a class has methods like mousePressed, mouseReleased, and so on. When it finds such methods, it makes sure it can call them, even if they are declared private, by calling the setAccessible method.

    Naughty YOPS! Applets are not allowed to do that.

    The change recommended above sets the accessibility of a method only if not running as an applet. The methods you supply to YOPS should already be accessible via reflection, so no such call is necessary.

    Be sure to make the above change before proceeding with this extension.
  2. Click on your project name in eclipse, and add a new class called MyApplet. This should be created in the top-level, "default" package. Paste into the new class the following code:
    import javax.swing.JApplet;
    import game.*;
    import yops.*;
    public class MyApplet extends JApplet {
    	//  Applets run this method when they start
    	public void init() {
    The above code tells YOPS to use the Applet to get to resources it needs. The game is then run as usual, from its main method. This will pop up a new window that runs the game.

    If you are curious or want a challenge, then after your game is finished and works the above way, try changing MyApplet so it runs the applet directly in the web page.

  3. Try running your program as an Applet in eclipse, by right-clicking MyApplet (it's in the default package), and mousing down to Run as...Java Applet.
  4. IF all is well so far, then let's try uploading your game as an applet.

    Read on.

  5. You need a place to store your game-as-an-applet so that it can be served to any browser that requests it. CEC provides such a place along with a server to provide your pages and applet on request. However, you have to create the content yourself.

    With the notes added below, follow the CEC web-page-creation instructions.


  6. Your game should have started out in its own eclipse Java Project. Let's suppose that project's name is Game.
  7. Now you need to export the game.jar file referenced from the above HTML file. A jar file is a Java archive file, like a zip file, but specifically for Java classes.

    In the Eclipse Package Explorer right click on the Game project and select Export... from the menu.

    Under Java, choose JAR file and click "next." In the 'JAR Export' dialog box, carefully do the following:

    1. Everything in the Game project should be scheduled for sending to the jar file. This is fine.
    2. Make sure that the "export generated class files and resources" box is checked. The other three export boxes (output folders, source files, and refactorings) should NOT be checked.
    3. In "Select the export destination," browse to your H:/web folder and use the name game.jar, so the destination will be H:/web/game.jar.
    4. Under options, make sure the "add directory entries" box is checked.
    5. Get help from a TA if this is unclear
    6. Click "Finish."
  8. For yops to be able to find your images, they apparently must also be uploaded into your web directory. (RKC: couldn't get YOPS to find them in the jar file)
  9. If you double-click on your index.html file, your browser should load the page, and you should be able to play the game. However, it is not yet accessible on the web. To do that, you need to set the permissions of your .www-docs folder and its contents as follows:
    1. Open an ssh session again to grid.cec.wustl.edu.
    2. At the command prompt, type exactly:
      chmod -R a+rX .www-docs
      chmod a+x .
      The first line makes the .www-docs folder world readable and traversable through the web server, The last line grants any CEC user (including the web server) permission to traverse your home directory, but not see your file names or individual files unless their permissions are set to be publicly accessible.
  10. In your web browser, go to the URL http://students.cec.wustl.edu/~xxx/ replacing the xxx by your CEC login name. The game should start!


Contest Rules:

  1. Only students currently enrolled in CSE131 or CSE131X may enter the contest. Each student may enter at most once.
  2. All contestants must be present at the awards ceremony.
  3. All entries must be based on Lab 10 and be accessible on the web.
  4. All entries must execute properly. If the game doesn't work, the entry will be disqualified.
  5. All entries must contain only "G-rated" material. Judges will disqualify entries containing inappropriate language or media content (even if it is funny). Disqualified entries will not receive any of the benefits listed above.
  6. Stealing other people's code, images, or sounds is illegal and strictly prohibited. All submissions must be your own work, except for the code we have provided for you. Substantial penalties, beyond disqualification from the contest, are involved.
  7. All entries must be received by the due date and time shown at the top of this page.
  8. To submit your entry, send us email using "CSE131 Contest Entry" as the subject of your message. Type your name as you want it to appear in the list of contestants, be sure the URL for your game is correct (test by copying and pasting to your browser), and include the title of your game. Your email message must be in plain text and formatted as in the following example. Be sure to replace the xxx by your cec login so the URL is correct.

    To: cytron@cse.wustl.edu
    cc: walkerburgin@gmail.com
    Subject: CSE131 Contest Entry
    <P> <LI> Your Name Here
    <A HREF="http://students.cec.wustl.edu/~xxx/">
    The Name of Your Game Here</A></LI>
  9. We are not responsible for lost, delayed or misdirected email.
  10. Entries will be judged by a panel of CSE131 TAs on the basis of quality and creativity.
  11. The decisions of the judges are final and will be announced at the awards ceremony in class on Monday, December 8.
Good Luck!

Last modified 12:21:34 CST 30 November 2008 by Ron K. Cytron