Assigned Date: Tuesday, Jan. 31, 2006
Due Date: Tuesday, Feb. 7, 2006
Due Time: 11:55pm
Last modified on February 06, 2006, at 10:02 AM (see updates)
This assignment focuses on Unit Testing. You are expected to work in isolation (without access to any resources other than the class textbook, class notes, and the instructor).
Below you will find an OO design of Java classes for the game Tic-Tac-Toe.
Implement a test suite for diagnosing bugs in the future system implementation.
In the spirit of test-first development, do not implement the Tic-Tac-Toe game at this time.
Your program stub should be implemented using BlueJ. Create a project called, what else,
TicTacToe. In that project create the following classes and stub methods:
Rules– encapsulates all rules of the game
public boolean isGameOver(Board board)- checks if the game is over
public boolean isWin(Board board)- checks if we have a winner
public boolean isDraw(Board board)- checks if we have a draw
public boolean isValid(int move, Board board)- checks if the proposed move is valid (it does not make the move)
HumanPlayer– encapsulates the human player
public void makeMove(Board board, Rules rules)- asks the end-user for a move and, if valid, puts it on the board
ComputerPlayer– encapsulates the computer player
public void makeMove(Board board, Rules rules)- uses artificial intelligence techniques to make a valid move (this functionality will be provided)
Board– encapsulates the game board
public Board()- builds a board of nine squares
public Board(int numOfSquares)- builds a board of
public void clear()– initializes the board to empty squares
public char getSquare(int position)
public void setSquare(int position, char value)
public String toString()- returns a printable representation of the board
public char getValue()
public void setValue(char value)
public String toString()-- returns a printable representation of the square
TicTacToe– the system driver
public static void main(String args)- declares instances of above classes and uses their methods to implement the game (again, this should be a stub for now)
Your test methods should be documented via javadoc. One should look at your javadoc API to determine the extent of your test suite.
.jarfile is correct, by using the '
jar xvf file.jar' command, where
file.jaris your archive. Your
.jarfile should contain:
Readme.txt(see Widget for a sample).
In other words, I should be able to unzip your submission and run it without modifications or additions.
.jarfile to email@example.com, by the due date and time.