I've been thinking I want to try a web based Tic Tac Toe game with a small chat on the side.
Now I need some ideas for the concept of both.
For the Tic Tac Toe it'll be two player game and using Ajax for the user interface so that when a user clicks it sends a request to a Servlet to put a X or O picture on the web page based on the ID of the player and his permission to play (his turn). My idea of the board in the code so far is a two dimension array of classes representing X or Os.
My question is how is this 2D array going to be shared between 2 clients, so where shall I save this data I don't want to use a database or a file, and how when a user places X for example the other user's page is refreshed to show it ?? Also for the chat I'll be using Ajax but I have no idea where data will be saved also. Suggestions please I need to know best practices.
You can set a timer to periodically fire off an Ajax call to see if the game data has changed.
In order for the game data to be available for both sessions, it needs to be stored on the server. As it doesn't need to be permanent (except perhaps tracking high scores), you can just keep it in memory. For servlet-powered apps, the application context could be used.