This assignment will be our first step toward a working game later in the semester. It is a simple game called Pousse. Read a little bit about the game now. If you have any questions, let me know.
We will start with the most important part of any application: the "model", the objects that represent and perform the behavior of the program. We won't worry about creating an entire game yet, only a network of squares from the board.
We also won't create any user interface yet. Later, of course, we will be able to build a GUI similar to the one you see in the description of the game. For now, we will interact with our squares via Dr. Java's interactions panel or via JUnit tests.
Our goal for this assignment is to implement a set of objects that work together to model Pousse -- though we will write only one class!
Your cell should provide these behaviors:
For now, we will use Java chars to represent tokens and directions.
You do not need to write any other classes to implement these behaviors. According the game description, making moves and determining whether a straight exists can be implemented only by one cell talking to its neighbor.
You may find it helpful to use a data structure like a Java Vector or a JavaHashTable to hold a Cell's neighbors.
You can use these tests to learn more about the interface and behavior of Cells, and to test your implementation:
You should plan to write your own tests to ensure that you have covered all possibilities.
Implement the Cell's behavior without using any if statements to check for null references to a Cell's neighbor.
To do this, you will probably need to write another class, and probably an interface, too! Of course, you must satisfy the interface for Cells as defined for the main homework task.
By the due date and time, submit the files
For your hardcopy, submit only your Cell.java file.
Be sure that your submission follows all homework submission requirements. (Yes, this includes submitting hardcopy!)