CS 422 - MP 2: Java Native Interface

Due: Monday 2/23/2004 at 11:59 pm

For this program, you will are to take the Tic-Tac-Toe program that was written in C++ and replace the command line interface with a Graphical User Interface written in Java using the Swing User Interface elements and the Java Native Interface connection.

You are given the following parts of the Tic-Tac-Toe program in C++

The above files are also available in the home directory of the i422 account on the CS UNIX machines. By typing the following command, you will copy the file TTT.cpp from the home directory of the i422 account to your current directory (assuming you have write permission to that directory).

    cp ~i422/TTT.cpp .

Your program must use the .o file supplied for the AI engine for the Tic-Tac-Toe game. Note that there is a variation (improvement?) on the algorithm used by the AI engine. When grading your program, we should be able to replace the current TTTGame.o file with a new TTTGame.o (assuming both files use the same .h file) with no side effects on your program's compilation or execution.

Note that when using the Java Native Interface, your program will need to target a specific machine. Your program will be tested on the CS Department Computers. You are to set-up your makefile so the .so file used by your program to be in the same directory as your main Java class.

Your program is to submitted electronically via the turnin command on the CS Department Computers using the project name of mp2. You are to submit all needed files to compile and run your program. This includes a makefile. Your program should compile by simply typing the command make in the same directory with the files you submit for grading. Submitting a README file is also a good idea.

Note: a nice feature would be to highlight the winning three positions when a game is won. This feature is not implemented in the command line interface; however, the method isGameWon() gives information that could easily be used to implement such a feature.

To create the shared object on the LINUX machines use the option -shared for the gcc/g++ compiler.