This project is an implementation of TCP server to play chess across two terminals on the same network. This is done by running a server to which two clients connect to. Then, the server shows the board to the clients and they input their moves. The server takes cares of all the checking and logic related to the game, and the users only have to input the pieces they want to move.
To compile the server executable file
make server
To run this server file
./server
To compile the client executable file
make client
To run this client file and connect to the server
./cleint [ip-address-of-server-computer]
Below is an image of a client playing:
And this other image if what the server will print when two people (Nabih & Oscar) are playing (there is a commented line in code for if the server wants to also see the board being printed as moves occur)
We used outside resources to understand and implement a lot of the server and chess code. These are those resources that helped us the most.
Resources on networking using sockets:
- For starting we created a one server-one client network, which was mostly done using this GeeksandGeeks link.
- After getting this one working, we moved on to working with this other GeeksandGeeks link to implement multiple clients.
- Finally, over the whole process, this third GeeksandGeeks link helped a lot for conceptual understanding and debugging.
Basically, for the networking with sockets, GeeksandGeeks was extremely useful.
Resources for chess implementation:
- For the Board implementation, some inspiration was taken from this ASCII implementation of a Chess Game.
- To do move checking and the actual updating and movement of the pieces, we did this implementation ourselves.