In this project you will design and implement an Archaeological Dig Simulation that behaves a lot like the solitaire computer game MineSweeper.
Design a program to simulate an archaeological dig. The goal is to dig near ancient artifacts buried in the soil to loosen them and make it easy for the archaeologists to extract them manually. If you dig too close to the artifacts, though, you will damage them. The archaeologists have mapped out the dig site as a grid. The chemistry department has come up with a soil test to see whether there are artifacts close by, either in the current grid location or in an adjacent location. Your job is to dig in the grid blocks without artifacts and to leave the blocks with artifacts alone. Since this is such an important project, the archaeological team wants their students to be able to practice this before they get to the dig. You are going to write the simulation that the students can use to practice.
For this project, you will be provided with two classes that will implement
your graphical user interface:
ArchSimGUI
and ArchSimDisplay. The
user interface responds to certain user actions, such as pressing the Restart
button or clicking the mouse within a cell in the grid, but it does not know
what actions to perform when these events occur. It requires a class
with which it can interact that does know what actions to perform.
The ArchSimulation
interface specifies a set of methods that the GUI can invoke. The display
class also has some special requirements; it assumes that the objects in the
grid are not just normal GridObject instances, but that they
are instances of a class that has an isVisible method so that
the display can tell which objects in the display it should show and which
should remain hidden. The skeleton ArchSimGridBlock class
has such a method, although it does not have any other functionality that
you might eventually want for the objects in your grid. Finally, to make
it easier for you to get started and to test your program at every step of
the way, we have provided two classes,
ArchSimApp and
DummyArchSimulation,
that will allow you to compile and "run" the other classes we have
provided. You can download all of these classes at once by downloading
Archaeology.zip. You will also need
to download the Java Archive library for the Grid Package
(grid.jar), since the Archaeology
Simulation program uses that.
In summary, the files being provided to you are:
ArchSimApp -
the main application that starts the graphical user interfaceArchSimGUI.java and
ArchSimDisplay.java -
the class that implements a graphical user interface for the archaeology dig
simulation and the class that displays the grid within that user interfaceArchSimulation -
the interface that specifies the set of methods that the GUI invokes in responding
to user eventsDummyArchSimulation -
a trivial class that provides empty implementations for the methods specified
by the ArchSimulation interfaceArchSimGridBlock -
an extension of GridObject that provides an isVisible method
(actually, this class extends TextCell, so you can use it to
put simple strings in the grid); you could add functionality to this class
or create subclasses that have the functionality you want
ArchSimulation interface and ArchSimGridBlock classes.ArchSimGUI class passes to an ArchSimulation class
considers all eight adjacent
locations around a grid cell (including the ones on diagonals)
to be its neighbors.
Thus, the number of adjacent artifacts may range from 0 to 8. You may wish
to put objects representing (and displaying) the neighboring artifact count in
the grid at the very beginning, before the simulation starts, or you may wish
to insert them as the user clicks on the corresponding cells. Grid cells
that have no adjacent artifacts should be visually distinctive from those that
have adjacent artifacts. Test
your
program so far.ArchSimApp class, which creates
the
"Help" menu. Provide the appropriate information for the
author(s), assistance, and date. Then create a document called
ArchDigHelp.html that contains information for users about what
the program is, how it works, what it does, etc. Save this file in the same folder as your project
file. Run the program and test both menu items in the "Help" menu.grid.jar),
including
edu.kzoo.grid.TextCell -- a class for objects containing
text that can be put in a grid. The current ArchSimGridBlock class
extends TextCell.
edu.kzoo.grid.GridObject -- the more general class for objects
that can be put in a grid. TextCell extends GridObject,
as do the ColorBlock and PictureBlock classes. You
may wish to change ArchSimGridBlock to extend GridObject,
ColorBlock, or PictureBlock, rather
than TextCell if you don't want to use text strings
to represent artifacts and empty blocks.
edu.kzoo.grid.Location - this class represents the
row and column of an object in a grid.edu.kzoo.grid.Grid -- this class is a
two-dimensional data structure you can use to simulate your
simulation grid. It has some methods that should be very useful
for your implementation of the simulation.