Activity 10.1 - Playing 'Spot the Robot'

Topic

This exercise allows you to play the game "Spot the Robot", discussed in the course text.

Materials

In addition to the Solution document, the project for this exercise contains one Java class:

Task

You are to run the applet using both the appletviewer and a browser, to see how this simple game works in each case.

Instructions

  1. First examine the code and then build the project.

    Next, in the Projects window, open the package ex10_1. Right-click on the node SpotTheRobot_1.java and choose Run File.

    Play the game by clicking on the applet window where you think the robot will next appear. When you have successfully guessed its position, you can click the mouse again to start another game.

    Close down the applet window to finish.

  2. In the Files window, in the build folder, right-click on the node SpotTheRobot.html, and select View. (There may be other copies of this html file, so be sure to pick the right one.) This will run the applet in your default browser. It can take a while to start!

    You can set the size of the applet by editing the width and height tags in the HTML file. Dimensions of about 640 x 480 are better than the defaults.
  3. To retain the size of the applet for future runs, copy the HTML file from the build folder to the src/ex10_1 folder.