CSci 2101 Lab 14. June 23rd

Due at the end of the lab

30 points

The lab is done in pairs.

Implementing a game of Tic-Tac-Toe as a Java GUI

Use Java GUI to implement a game of 3-by-3 Tic-Tac-Toe: the user clicks on squares, the computer responds with a random move. Squares must be marked in some way to indicate if they are taken by the player or the computer or still empty. Ideally when someone wins, there should be some message displayed. Illegal moves (clicking on a square already taken) should not be allowed. Ideally an error message should be displayed.

Use this code as a sample. Consult the Swing API and Swing tutorial.

Use 2-dimensional array to keep track of which squares have marks on them.

As a minimum, your GUI should compile, run, and implement the basic functionality. Feel free to add extra features (images or other interesting ways of marking squares, sounds(?), or a strategy for computer moves) - be creative. Extra features may count as extra credit if all of the basic functionality is working.

Submit the java file with all your testing code by e-mail to me. The subject of the message must be 2101 Lab 14. Make sure to CC your group partner.


CSci 2101 course web site.

The views and opinions expressed in this page are strictly those of the page author. The contents of this page have not been reviewed or approved by the University of Minnesota.