CSc 305 Project 2

Due Apr 21 2008 11:59 pm


The goal of this project is to convert your Maxit game into a Greenfoot scenario.

Instead of filling the board with numbers, MaxitWorld will populate the board with Food (yum!).  The picture below shows the board after it is populated with random food.

opening screen

There are five types of food, each having a different value:
The board also displays images for the human and computer player, and the current score for each.

The picture below shows the board after the human has taken her first move, by clicking at position B2.  The banana disappears and her score is updated to 15, and the computer immediately moved to the apple at position D2.

first move

Notice that legal moves are indicated by a colored fruit, and illegal moves show a grayscale fruit.  If the user clicks on an illegal square, their actor is not moved.   Here are the MaxitGrayscaleImages.zip.


Play continues until the game is over and the winning player's score is displayed with a font color of red (see picture below).  In event of a tie, both scores are shown in red.

game over

In addition, the game must support two human player competition.  The second player has a blue actor.  In this mode, the game does not have to ensure that each player is moving in the proper order; we'll trust the participants to follow the proper turn order. 
Also, the game must support board sizes of 4, 5, or 6.

Implementation Requirements

Have the default constructor create a world of size 5.
To create a world of varying size, declare a constructor that has the desired board size as a parameter:
MaxitWorld(int boardsize).
The parameter boardsize specifies the desired number of columns in the world. You may assume
@pre 4 <= boardsize <= 6.
To invoke this constructor at runtime, right-click on the MaxitWorld class in the right-hand panel. The constructor will appear (along with the default constructor) in the drop-down menu.

In order to populate the world with food, MaxitWorld class must have two small methods, create2Player() and createSolitaire().
The first starts a two player game and the second starts a solitaire (human vs computer) game.
These methods should be very small, and each calls a populate()method that does most of the work of filling the board.

Regardless of the board size, the bottom row should contain the scores and the player icons.


Design Goal

The intent of this activity is that you reuse as much code as possible from project 2. 

Try to take advantage of inheritance and eliminate redundant code wherever possible.

Instructional Goal

The purpose of the project is to learn something about object oriented design.  Supposedly one of the benefits of OO design is that it allows us to easily reuse components in new applications.  So in this project you get to discover what you did in project 1 that contributed to the ease of modifying your solution for project 2.

Assignment Submission

  1. Follow the Basic PSP Script. You may use Eclipse or other IDE if you follow the directions in the FAQ.
  2. Make sure your source code passes CheckStyle. (You're allowed 5 violations per 1000 lines of code.)
    Here's a trick - Compile your code in Greenfoot, and then use Checkstyle under BlueJ.
  3. Use handin to submit your source code electronically.
  4. Print your source code using 10 point monospaced font.  You will probably have multiple classes; place the class with the main method in front.  (If it follows the coding standard the @author tag with your name will be near the top).
  5. Write a 2-page (max) written summary of what you learned.  Briefly describe the design issues you had to confront and the ways in which your solution to project 2 contributed or interfered with your success on this project.  You might explain what parts of your project 2 code required the most modifications to be used in project 3 and why.  (I'm not interested in greenfoot specific difficulties).  Staple the writeup on top of the source code.
  6. Staple your PSP forms on top, with the Summary Form on top. (Try the new online PSP form; it does the calculations for you.)
  7. Submit your work to the table in front of the classroom at the next class meeting after the due date.


Handing in Your Source Code Electronically
       handin  graderjd  Project2  Maxit.zip
      




Document Changes