Game.com, the renowned internet game producer is at a remarkable high!
The Brain-Storm Developers have been assigned to create a board game
for students at Washington University. They came up with WASHOPOLY.
However, they need our help to put the game into a language runnable on the
computer, and JAVA is the perfect tool.
Your job is to help create the code for Game, Inc.'s WASHOPOLY
by articulating and implementing a system of objects that models
real-life counterparts (recall that the API of such objects
is the interface, which hides internal implementation).
The Game, Inc. head honchos have already decided on the API, and it's set in
stone. So, you'll have to honor their wishes in your implementation. Their
design involves the following:
- three Player objects.
- twelve Squares that a Player can visit.
- a Happiness level for each Player.
- a Die that is rolled to determine Player's next move.
- a GameBoard that contains the events and graphical displays of Happiness, the die, and the face for a Player.
More on the play of the game
Before we start you in on the design, you need to understand how the game is
This game allows the user to guess whether a Player in the game is an
Athlete, a Brain, or a Remy (Renaissance person).
there are three kinds of Players:
The happiness of each player is a weighted function of
- Athlete (athletic extreme)
- Brain (study extreme)
- Remy (the Renaissance student, or well-rounded student)
Each event the Player attends either positively or negatively effects the
Player's GPA and SI, consequently affecting his or her happiness.
The game proceeds by rolling a 3-sided die and moving around the board.
It takes four full rounds of the board to reach Graduation.
The user of the game
does not know which kind of Player is moving
around the board. The object of the game is to guess which
Player is present, as soon as possible. More points are received the
quicker the correct guess is made. If a wrong guess is made, points are lost and
the game is reset! The user will have the opportunity to guess after each roll.
- GPA (Grade Point Average)
- SI (Social Interaction)
Major caveat #1: One of the goals of this lab is to get you thinking
of how to write internal representations (i.e. choose instance variables). So,
you will find the instance variables missing in most of the files for this lab.
Feel free to choose your own instance variables; part of your grade for
the lab will be how well you choose them and how well they work. Having said
that, the choice of instance variables should be fairly straightforward based
on our design - if it seems like the right answer, it probably is!
Major caveat #2: Another goal of this lab is to get you testing your
classes thoroughly. We require all of your classes to have a method
public String toString( ) that Java uses to
convert your object to a String. You are also required to test your
classes thoroughly in Startup.java by printing some tests to the Terminal,
some of which involve the use of your toString. The test procedures should
be located in the indicated spots in Startup.java.
Some examples are provided; if you have any questions, please ask.
Now, on to the design!
- First, the Players are the main objects of the game. They attend
events and traverse the board by rolling a die. Each Player is
represented by an Emote-face (created in
Lab2) that smiles, frowns, etc. to show
various levels of happiness.
Each Player has
Each kind of Player calculates its HAPPINESS differently:
- a GPA level
- a SI level
- a Happiness level (which is a function of the above)
- a Face (which is implemented with an
from Lab 2)
- a StatDisplay
To display the happiness of a Player, a smile/frown is drawn on the
face image for that Player. From
for the smile is based from 0 - 100.
Since our GPA, SI, and Happiness
will all be capped from 0 - 4.0, we must
remember to SCALE happiness to fit the requirement for the face!
- Athlete --- 25% on GPA and 75% on SI
- Brain --- 75% on GPA and 25% on SI
- Remy --- 50% on GPA and 50% on SI
which is a horizontal bar that
expands and shrinks with the Happiness. The StatDisplay will, therefore, have a
visual representation of Happiness with the StatBar, as well as a numerical display
for the value (0 - 4.0) of Happiness.
- Next, we need to look at the squares that make up the board. 12 squares
make up the board.
They are as follows:
The above should be instances of a main Square Class!
- Year Start/Graduation
- Food --- Everyone needs to eat sometime!!
- Classes --- Those fun-filled learning experiences
- Friend --- Visit, talk to, study with, etc.
- Extra-Curricular --- You may choose a specific one if desired
- Parents Visit --- What more can one say?
- Study --- Necessary at some point in time
- Party --- !!!
- Sport --- Competition at its finest
- Sleep --- The goal of every college student
- Finals --- The last test of knowledge
All the squares have a set positive or negative effect on GPA and SI.
The effect of each square is defined in GameBoard when the squares are constructed.
- Year Start/Graduation which will be the bottom right square on the
board. This is where play is started and finished. Effects of this square:
- The player must START play on this square.
- Each player MUST land on this square EACH round before they can
continue with the next one!!!
- With each landing on this square, the player's year is incremented.
- With each landing on this square, the player's GPA and SI are incremented by 1.
- If the player reaches Graduation without guessing, no points are gained or lost
and play is reset.
- CATASTROPHE!! This event will be placed in the top left square.
It will have the set effect of lowering the Player's GPA and SI by 1.
- The progression of the Player is determined by a die that is rolled.
It is an imaginary (can you make one?) 3-sided die that will randomly choose a value. The graphic
will be an icon called ROLL!
- The GameBoard is what the game is played on, and is therefore a very important
component of the design. The GameBoard will have squares around a square board (in
the same format as Monopoly).
- Each time a player moves, it must update the graphical displays on the
board (StatDisplay, Face of player).
- A move is carried out when the player clicks on the ROLL! icon.
The die icon will be placed in the upper left corner inside the grid of squares.
- If the user guesses correctly as to which Player they have, a score is given
and play is reset with a new, randomly chosen Player. If an incorrect guess is
made, the user's score is lowered and play is also reset.
The JavaDoc for this lab shows a complete and detailed API.
The following classes you will have to implement yourself. Look at the API to see in greater detail what
properties these classes (and all other classes in the game) have.
- Lab3.java and Startup.java will be provided as always.
This class will be given to you. It will create the canvas for the board,
construct an array of squares around the perimeter, initialize a randomly
chosen Player, and orchestrate the progression of the game. The GameBoard, however,
only orchestrates all the gameplay. It is up to your classes to actually make things (other
than a few buttons) appear on the screen and work.
- RollListener.java Listens for clicks on the Roll! rectangle and
StartGuessListener.java listens for clicks on the Guess the player
type button. The appropriate method is called.
- MyGuessListener.java Once the dialog box for player selection is displayed, this listens for clicks
on the three buttons.
- Emote.java and other files will be used from Lab2 to represent the player's Face on the board.
- Square.java -- represents a square on the game board. A player will visit it and his/her happiness will be affected by the visit.
- Player.java -- represents a player traversing the gameboard. He/she will visit Squares and his/her happiness and other
statistics will be displayed with a StatDisplay and Face.
- StatBar.java -- A simple progress-bar used to display the player's happiness.
- StatDisplay.java -- Displays the player's happiness with a StatBar and his/her year in school with a StringComponent
- Face.java -- Also displays the player's happiness, but uses an Emote from Lab 2.