Assignment 3 - Due Tuesday February 2 midnight by e-mail

Objects in

This assignment is due Tuesday February 2 midnight by e-mail.

Your analysis is due Thursday before the lecture by e-mail to your instructor or on paper in class.

Details of the assignment: Prototype and CandyLand demos.

Please let us know if you can't see the demos!

Aplets have been tested in the computers in the basement of Lindley and they work there so we should be OK in UITS maintained computer rooms. But older version of Netscape (3.x, 4.05) do report various security violations, probably due to messageBox so the best we can do is to use a recent version of Netscape, 4.5 or higher and please let us know if you can't see them.
Candy Land is a common board game for young children that only requires knowledge of colors to play. So kids who don't know how to read or count are able to enjoy the game. Players move their gingerbread man tokens by matching colors on cards with spaces on the board. The first player to reach the candy castle wins the game.

Write an application that plays a genuine multi-player version of this game. The board is a sequence of colored squares. Two of the squares contain candy: one has a gumdrop and one has a candy cane. The players' tokens are initially on the first square. Here's how the play of the game goes:

The board will be represented as an array of colors, each element corresponding to a square on the board. We don't need to use Java Color objects in the board array, just Strings, like "yellow" and "green". Your program should use the BreezyGUI package to create an interface as in this example. Notice that the board is displayed with the starting square at the bottom, and that alll of the players in the same square are listed on the same line.

Each time the user hits the Go button the current player draws a card and one play of the game is performed. The game ends when one player reaches the candy castle, and then the program prints the winner's name.

You should create a file that contains the definition of a Player class in addition to the class that gives the name to the file and contains the main() method. All objects that participate in this game are instances of the same type (Player). The definition of this class should include: two instance variables for the name of the player and the position in the array. Check lab notes for lab 2 for examples of arrays of objects (the examples with Ben Johnson and Carl Lewis should be especially helpful).

It is recommended that you develop this in at least two stages.

  1. In stage one you could implement a simpler game in which all players advance one square when their turn comes. This way you can check that your output routine is working fine since the players' advancement should present no problems.

  2. When this code is running fine you could then implement the real movement of the game, which is based on randomly drawing a card with a color for each player in turn and then moving to the square that displays that particular color as described above.

    We will post some code to get you started some time on Tuesday evening.

    Here it is: assignment 3 jumpstart

    You can assume that from game to game the board is unchanged, and that the number of players is fixed, as in the examples presented above, which displays 4 players always.

    The text of this assignment was somewhat adapted from last year's A201 modified, one-player version of the game. The logo is not ours but looks good. If you have any questions please let us know.