/* * TicTacToeModel.java * * Created on December 5, 2002, 2:11 AM */ package TicTacToe; import CollabUtils.*; import java.util.GregorianCalendar; import java.util.Iterator; import java.util.List; /** See the documentation for ITicTacToeModel and IApplicationIdentification. */ public class TicTacToeModel implements ITicTacToeModel, IApplicationIdentification { /** Creates a new instance of TicTacToeModel */ public TicTacToeModel() { } /** Return a (short) string identifying the authors of the program. * NOTE FOR CSE143 PROJECT 4: DO NOT GIVE PERSONAL INFORMATION UNLESS YOU * ARE COMFORTABLE WITH THE WHOLE WORLD SEEING IT! A code name or nickname * is sufficient. */ public String getApplicationAuthor() { } /** return a string (as long as desired) identifying the authors of the program. */ public String getApplicationAuthorDetails() { } /** return the date of creation or update */ public GregorianCalendar getApplicationDate() { } /** return a (short) description of the application. */ public String getApplicationDescription() { } /** return a string (as long as desired) describing the application */ public String getApplicationDescriptionDetails() { } /** return a string (as long as desired) giving any details of * usage or applicability which the author wishes to convey to * a user or a client. */ public String getUsageInformation() { } /** Answer, has A won? * If A has won, that implies that B has not won. * However, if A has not won, that does not imply that B has won. It might * be that no one has won. * Pre: none * @return true iff the game is stopped and A is the winner. * */ public boolean AhasWon() { } /** Answer, has B won? * Pre: none * @return true iff the game is stopped and B is the winner. */ public boolean BhasWon() { } public String getPlayerAName() { } public String getPlayerBName() { } /** Answer, what mark is on the board position indicated? * Pre: the state is "started"; row and col are valid * @return one of the character values 'X', 'O', or ' ' (case-sensitive) */ public char getPositionMark(int row, int col) { } /** Answer, is the game in the stopped state? */ public boolean isGameOver() { } public boolean isGameStarted() { } public boolean isGameTerminated() { } /** Process a move by a player. * Pre: the game is started and not stopped, and it is the player's turn. * Post: the game board reflects the change. If the move causes one player * to win, the status changes to "stopped". If the move is legal, the move count * in increased by 1 * * This method is the only place in the model where the move count * is increased. It is also the only place (except the constructor) where * the marks on the gameboard are changed. * * @return true if the move is carried out, false if the move is not * carried out (probably because it was to a space already marked). * @throws IllegalArgumentExeception if any argument value is illegal, * or if it is not the player's turn. */ public boolean makeMove(char player, int row, int col) { } public void setPlayerAName(String name) { } public void setPlayerBName(String name) { } /** Signal that the game is starting. * Precondition: the game has not been started * Postcondition: the game is in the started state, with a blank gameboard. */ public void startGame() { } /** Signal the the game is to stop. * Precondition: the game has been started, but is not yet stopped * Postcondition: the game is in the stopped state */ public void stopGame() { } /** Signal that the application is finished. After a finish, the model * is not required to maintain board or player state. Any viewers or * listeners are free to wrap up or terminate. * The Controller should call this method before terminating its own * execution. Viewers should not call this method, except to signal * some extraordinary condition which requires immediate termination. * Precondition: none * Postcondition: regardless of previous state, the game is placed in * the started and stopped states. * */ public void terminateGame() { } }