24.21 (Modifications to the Multithreaded Tic-Tac-Toe Program) The programs in Fig. 24.13 and Fig. 24.15 implemented a multithreaded, client/server version of the game of Tic-Tac-Toe. Our goal in developing this game was to demonstrate a multithreaded server that could process multiple connections from clients at the same time. The server in the example is really a mediator between the two client appletsit makes sure that each move is valid and that each client moves in the proper order. The server does not determine who won or lost or whether there was a draw. Also, there is no capability to allow a new game to be played or to terminate an existing game.

The following is a list of suggested modifications to Fig. 24.13 and Fig. 24.15:

Modify the TicTacToeServer class to test for a win, loss or draw on each move in the game. Send a message to each client applet that indicates the result of the game when the game is over.

Modify the TicTacToeClient class to display a button that when clicked allows the client to play another game. The button should be enabled only when a game completes. Note that both class TicTacToeClient and class TicTacToeServer must be modified to reset the board and all state information. Also, the other TicTacToeClient should be notified that a new game is about to begin so that its board and state can be reset.

Modify the TicTacToeClient class to provide a button that allows a client to terminate the programat any time. When the user clicks the button, the server and the other client should be notified. The server should then wait for a connection from another client so that a new game can begin.

Modify the TicTacToeClient class and the TicTacToeServer class so that the winner of a game can choose game piece X or O for the next game. Remember: X always goes first.
-------------
TicTacToeClient class:
and you can get codes that we wana edit from here:
http://www.cs.fit.edu/~mmahoney/cis5100/examples/ch24/fig24_13_16/TicTacToeClient.java

main for it :
http://www.cs.fit.edu/~mmahoney/cis5100/examples/ch24/fig24_13_16/TicTacToeClientTest.java

TicTacToeServer Class:
http://www.cs.fit.edu/~mmahoney/cis5100/examples/ch24/fig24_13_16/TicTacToeServer.java

Main for it :
http://www.cs.fit.edu/~mmahoney/cis5100/examples/ch24/fig24_13_16/TicTacToeServerTest.java

please help me ..
i wana full solution of this
i worked before 2 weeks on it and i must send the solution next sunday...
please help me :(

Read the forum rules. We only give homework help to those who show effort. Ask specific questions about problems you are having with your code and you will get help. Otherwise, you will not.

please :( i need it ..
i swear i worked longly

LOL, above are exact copies of codes from Java How to Program 6th edition:D

yea man its ..
i swear ..i started working before 2 weeks and unitl now..and i must send it to my doctor on sunday:(
;(

Swearing doesn't help, it is the code modification that counts plus clear description of problem/-s you may have with it.

i did this perfectly :Modify the TicTacToeServer class to test for a win, loss or draw on each move in the game. Send a message to each client applet that indicates the result of the game when the game is over.

just i wana help how to close connection without close server?!!!!

You need to come up with safe solution how to close connection which is instance of Socket with with close() method that is available to this class

yea man i know this method // close()
but when i do it ..the server window is cloesd..
and just i wana to close the client window ....and make server wait another client to connect..please help me

helpppppppppppp :(

Where is that TicTacToe class ? one word of advice never ever put a link back to your userid in your university asking people to do your homework.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.