Lecture 8: In-class Exercise:   A Model for Tic Tac Toe
1 A Model for Tic Tac Toe
2 Testing
3 Notes to Keep in Mind
4 To Turn In
6.3

Lecture 8: In-class Exercise: A Model for Tic Tac Toe

Due: Ideally by the end of class, but not later than the next day after your section meeting time.

1 A Model for Tic Tac Toe

The purpose of this exercise is to give you practice with implementing the Model component of the Model-View-Controller design pattern.

In the starter code, you are given an interface representing a game of Tic Tac Toe, along with an enum representing the players (X and O). Your task is to implement the TicTacToe interface.

You may work freely with other students on this exercise!

You will need one class: a public class named TicTacToeModel, with a single public constructor that takes no arguments. The class definition, with a toString() implementation to help with debugging, are provided to you in the starter code. You will fill in the fields and remaining method definitions as appropriate. You may also define other classes at your option as needed.

The game grid cells are numbered by row and column starting from 0. For example, the upper left position is row 0, column 0 (or [0][0] in the 2D array returned by getBoard()), the upper middle position is row 0, column 1 ([0][1]), the lower right is [2][2].

2 Testing

We have supplied you with some basic JUnit tests as part of the starter code. Use these to verify that your implementation is correct, and write additional tests of your own.

3 Notes to Keep in Mind

4 To Turn In

Submit your zip containing only your src and test directories to In-class Exercise 2 on the handin server. There is no self-evalulation for this exercise. Your grade will be determined by code style (70%) and JUnit correctness (30%). We will not be doing manual grading, but if you would like feedback on your design, contact a member of the course staff and we will review it.