Welcome to the README file for the CSE207 Secret Assignment by Dimitrije Zdrale.
This project is a Tic Tac Toe game implemented using network programming techniques. It allows multiple clients to connect to a server and play the game over a network. The server manages the game state and facilitates communication between the clients. Each client takes turns making moves by selecting a position on the game board. The game continues until there is a winner or a draw. The project demonstrates how to establish network connections, handle client-server interactions, and maintain game state in a multiplayer setting.
To compile the program, follow these steps:
- Navigate to the directory containing
server1.c
,client1.c
, andMakefile
. - Open a terminal and run the following command:
make
To reverse the operation and clean the build files, use the following command:
make clean
To initialize the server, use the following command:
./server1 <port number (greater than 1023)>
To connect the clients, follow these steps:
- Open a terminal.
- Use the following command:
./client <ip address> <port number>
Note: Replace <ip address>
with the desired IP address (e.g., 127.0.0.1) and <port number>
with the same port used for server initialization.
Once the clients are connected, the game proceeds as follows:
- You will be greeted with a welcome message. The server automatically receives a "Hello" message for testing purposes.
- After two clients have connected, the board state will be displayed each turn, along with a prompt to play.
- To make a move, enter an integer between 0 and 2 (inclusive) in the terminal for the column and row, respectively.
- The game will continue until there is a winner or the game ends in a draw.
- Once the game is over, you will be informed of the winner or if the game ended in a draw.
- If you wish to play again, repeat from Step 3.
Feel free to explore the code and enjoy playing the game, and thanks for reading!