Python Program
PROGRAM DESCRIPTION:
In this assignment, you will write two complete python programs that will allow two
players to play the game of network tic-tac-toe. It will include two programs, a server
and a client. The server will allow two clients to connect and then will begin the game.
The client programs accept input from the player and transmits the command to the
server which will execute the commands and send a reply back to the client programs.
The client and server programs are to communicate via the Internet (network) using
TCP sockets. Your server should be able to handle commands from either client in any
order. Your clients should be able to handle responses from the server or the player.
(hint: use select)
The game is for two players on a 3x3 grid. The player who moves first uses X marks.
The second player uses O marks. Each player takes turns placing their mark (X/O) on
an empty spot on the grid. The game ends when all spots have a mark or either player
has 3 marks in a row.
REQUIREMENTS:
· Your code should be well documented in terms of comments. comments for each variable, and commented blocks of code.
· Your server should be named “minor5server.py”, without the quotes.
· Your client should be named “minor5client.py”, without the quotes.
General:
· The server should accept connections from two clients then begin the game.
· The following commands should be implemented:
· M<R><C> - Player places a mark on row R column C.
· Rows are the letters A, B or C
· Columns are numbers 1, 2 or 3
· R – Resign
· ? – Display Help
Server:
· Your server should be named “minor5server.py”, without the quotes.
· Should take a port number as a command line parameter.
· Display commands received from clients.
· Display responses sent back to the clients.
· After each valid move the board should be sent to both clients and a message to
the other player that it is their turn.
· The board should have legends for rows and columns (see sample games
below).
· The server should prevent players from going out of turn.
· When the game ends. The server should send the board and notify each player
of the results. (i.e. who won, or tie, resigned, See sample games below).
Client:
· Your client should be named “minor5client.py”, without the quotes.
· Should take a hostname and a port number as command line parameters
· Display a message “Connecting to Server”
· Be able to process commands from the user and messages from the server in
any order.
· The server can send messages at any time that that should be displayed
when received.
· The player can enter commands at any time which should be sent to the
server when entered.