In this project you will design and implement a modified version of a chess game.
Design a program to implement a "COMP 110-Style" chess game. This version of the game goes like this:
Each piece should choose a movement that would be legal under normal chess rules.
Although there will be situations in which there is only one legal move a piece can make, there will be many others where there are multiple legal moves a piece can make. You may handle this in a number of ways: you could randomly choose one of the legal moves, or you could build whatever level of intelligence into your chess pieces that you like. For example, if any of the legal moves include capturing an opponent, you might choose one of those over moves that do not include capturing an opponent. Or you could try to do something more sophisticated to decide whether capturing an opponent is a good choice. (Note, though, that the project must be turned in THIS QUARTER, not in three years, so don't get too fancy!) You will lose points if you do not handle the possibility of multiple moves or if you handle it in a completely mechanical way, such as always making the same move unless that move is blocked and then making the same alternate move.
Your program should create the chessboard and the chess pieces and then run the program step-by-step. Your program should graphically display the state of the chessboard and pieces at the end of each step. (Alternatively you could choose to redisplay after each piece moves.) You should provide a Start/Restart button and also a Stop button. Your program should stop when one of the kings is captured, or when the user clicks on the Stop button. You may also provide a step button or control the steps within the program.
You may use any of the classes in the Grid Package
edu.kzoo.grid.BoundedGrid-- a grid that expects the objects in it to be objects of the
GridObjectclass (or a subclass). You might want to look into the second constructor for the
BoundedGridclass, which can be used to construct a grid that uses eight directions rather than four (including
Direction.SOUTHWEST, etc) when finding the neighboring cells for a particular location.
edu.kzoo.grid.GridObject-- the superclass for all objects that can be put in a grid. You might, for example, create a
ChessPiececlass that extends
GridObject(and maybe a
Rookclass that extends
GridObjectclass includes the
changeLoc(Location newLoc)methods, which are inherited by its subclasses.
edu.kzoo.grid.Direction-- these classes encapsulate information about locations and directions in a grid.
edu.kzoo.grid.display.ScrollableGridDisplay-- used by the graphical user interface (GUI) to display the grid and the objects it contains.
Chess110Controller.java: a controller object that controls the progress of the game through its
stepmethods. (These are mere skeleton or place-holders for the code you will write.)
Chess110GUI.java: a graphical user interface for the Chess110 program. If you uncomment the redefined version of the makeControlPanel, it will make a control panel that has an extra button at the bottom allowing the user (which will be you) to turn debugging on and off. This is very useful during testing.
Chess110App.java: a class with a
mainmethod that merely constructs a controller and then constructs the GUI (telling the GUI about the controller).