Homework Assignment 6

A Model for Pousse


CS 2530
Intermediate Computing


Due: Friday, October 19, at 5:00 PM


Introduction

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!



Tasks

  1. Write a class named Cell that implements one square on a Pousse board.

    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.



Extra Credit

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.



Deliverables

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!)



Eugene Wallingford ..... wallingf@cs.uni.edu ..... October 17, 2012