In this project you will design and implement a modified version of 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.
Since we have not yet talked in class about how to develop graphical user
interfaces, we are providing two classes,
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. Therefore,
we have created an interface, ArchSimulation
,
that 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. We have provided a skeleton ArchSimGridBlock
class
that has such a method as well as a method that indicates whether the
object is an artifact (each method has stub functionality).
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.
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 implement 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
interface; you should leave this
class as it is and create a new class that implements 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 wantgrid.jar
- the Java archive library for the Grid Package, containing classes
such as
BoundedGrid
, GridObject
, TextCell
,
etc.
Class documentation for all classes in the Grid
Package can be found
here.
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. (Again, you probably want all objects in the grid to be
visible for this testing.)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 the .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 does the ColorBlock
class you saw in the GridPlotter project. You
may wish to change ArchSimGridBlock
to extend GridObject
or
ColorBlock
rather than TextCell
if you don't want to use text strings
to represent artifacts and empty blocks.
edu.kzoo.grid.Location
- this class is
exactly the same as the class you are used to from the Marine
Biology Simulation case study.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.