ARTIFICIAL INTELLIGENCE
TOPIC 01 – TIC TAC TOE AI

 

LESSON WORK

 

 

TASK

 

  • You will create an AI agent that will play Tic Tac Toe.  You will be given a basic random AI agent as well as an implementation of Tic Tac Toe.  You will have to make your code work with the existing framework.

 

  • All student AI agents will face off against each other to see which works best.  The student AIs will have to play as both X and O.  The AI with the most points will be declared champion.  The point system used will be:

                Win: 3 points
                Tie: 1 point
                Loss: 0 points

 

  • Mr. Campeau will provide an AI agent as well to participate in the competition.

 

  • A random AI will also participate.

 

IMPLEMENTATION

 

  • The implementation of this Tic Tac Toe game is done using static methods (functions).  The reason for this is that this competition is open to grade 11 students who have not yet learned object oriented programming.

  • Each possible placement on the board is a spot.  Each spot is numbered from 0 to 8 as such:

 

  • While you can study the implementation of the of the Tic Tac Toe game inside TicTacToe.java, you should probably focus only on the public functions (and not the private ones).

 

  • You are also provided with two different (though similar) simple AI agents.  One simply returns a random choice.  The other chooses the middle if its available; otherwise it chooses a random spot.

 

 

FILES

 

You will need the following files:

 

TicTacToe.java – The actual game with the main function.
BlankAI.java – An empty AI agent that you can work with.
CampeauAI.java – A basic AI agent to show you how to proceed.
NOOPDraw.java – Needed to view in GUI – though we will mostly use console.

Click here for a zip file that contains all of the above files.  You will have to drag each one individually into your IDE.