CS 1713 Introduction to Computer Science:
Tic Tac Toe Application - take 2


In this activity you will write a Tic Tac Toe Application that is similar to the TelephoneKaypadApplication from Case Study 17.

This will be a team programming exercise.
Two students will work together, each creating a separate project.
At certain points you will stop and make sure your partner has gotten up to that point.
If not, you must help your partner reach that point before continuing on.

  1. Get a copy of ttt1.zip and load it into eclipse.
    You can find it on the Y: drive in the zips directory.
  2. Look this over and make sure you understand it.
  3. Make sure this runs and produces a frame.
  4. Add code to initialize to call inform and setId.
  5. Add code the the constructor of TicTacToePanel to make the buttons.
    Initialize each button to contain the $ symbols for testing.
  6. Test the program to make sure it displays the buttons.
    Stop and make sure your partner has reached this point before continuing.
  7. Each button should add a new TicTacToeButtonListener as an action listener.
  8. Fill in the code for the constructor of TicTacToeButtonListener.
    Have it save the parameters in attributes.
  9. Have the actionPerformed write a line using System.out.println that contains the row and column.
  10. Test the program to make suer the buttons work.
    Stop and make sure your partner has reached this point before continuing.
  11. Have the actionPerformed call TTTPanelTest.move with the appropriate parameters.
  12. Have move check to see if the parameters are valid and call inform with an appropriate message if not.
  13. Test the program.
    Stop and make sure your partner has reached this point before continuing.
  14. Have initialize create a board that is a two dimensional array of char. Initialize it to contain blanks.
  15. Have move fill in the board with an 'X' if the move is valid.
    Then call boardChanged.
  16. Write code for boardChanged so that it sets the button labels.
  17. Test the program.
    Stop and make sure your partner has reached this point before continuing.
  18. Modify move so that it will not allow a move if that move has already been made. In this case send an appropriate message to inform.
  19. Modify the program so that it keeps track of whose move it is next.
    Fill in the board with either 'X' or 'O' depending on whose move it is.
    After each move, call setId so the frame shows whose move it is.
  20. Test the program.
    Stop and make sure your partner has reached this point before continuing.