Lab 6

The instructor has created a framework for graphical solitaire games such as Collapse.
GridGameFramework provides the graphical framework for games that are based on a two dimensional grid.
Developers create extensions or "plugins" for this framework that provide the game logic for a specific game.

View sample screenshots.

Framework Design

UML Class Diagram
Javadocs to the Grid Game Framework
Jar file with classes for the framework.


The main class is GridGameLoader who dynamically loads the plugin and initializes all the other components.
GridGUI is the graphical interface class that has a Swing Frame and components for the menu and board.
GridGUI will manage the placement of buttons, status panel, and the board.
GridGUI will create a grayscale background image from the background specified.
GridGUI will implement the behavior for displaying a scores list.

Creating a plugin

Each game ("plugin") will provide:

For each Button, the plugin specifies the label and the associated behavior. Buttons may be invisible in which case they are invoked via the key shortcut (E.g, "Alt-A" for "About").  (A plugin could have no buttons).

Each plugin is identified to the framework by a unique string identifier, for example "Hangman".  All the classes your provide must begin with this identifier (E.g., HangmanBoard, HangmanGame, etc.).

Game configuration options are stored in a file named "preferences.ini" that uses Windows ini file format.
Board background images are stored in Backgrounds/bkgd.jpg.

You must create a folder with the name of the plugin to store the resources the plugin needs:
In tree format, the needed directory hierarchy is:
GridGame (directory)
   + GridGameFramework.jar
   + ini4j.jar
   + Hangman*.class
   + Hangman (directory)
        + HighScores.txt
        + preferences.ini
        + Backgrounds (directory)
        |     + bkgd.jpg
        + PieceImages (directory)
              + *.jpg


Square Off

Your assignment is to implement a simple game called "Square Off" to run as a plugin Grid Game.
Read the rules of the game and obtain the source code from this article. For this lab, you do not need to implement the countdown timer, extra levels, or sound effects. You do not need to use a Preferences file. The source code uses Swing; you will modify it to use the GridGame Framework.

The status panel displays the number of moves made.
The game begins with a randomly selected board.


Resources

Required ini4j.jar file to read the preferences file:  [ini4j] - Java API for handling Windows ini file format

Green Square
Black Square

To run your plugin:
(Windows)  java -cp GGFramework.jar;ini4j.jar;. GridGameLoader Squares
(Unix)             java -cp GGFramework.jar:ini4j.jar:. GridGameLoader Squares

Here is a sample preferences.ini file you can use.

#Sample GridGame Properties File (for Minesweeper)

[Board Size]
small = 3
medium = 4
large = 5



Demonstrate your completed program to the instructor.