People, people, I have a desperate request: I failed an exam and my only hope to pass it is to do a program that sounds like this:

A ping-pong game using socket TCP/UPD. Initially the two players are established.The ball is launched by one of them. Till it reaches the second player the ball may or may not touch the net. If it passes the net, the ball reaches the second player who sends it back.

When the ball is "a bad one", the game continues with a new ball launched by the right player.

Each game has M=20 balls.Each player servs 5 consecutive balls.


The two players represents clients of a server.

The player that begins the game is chosen aleatory by the machine.

The player sends the ball as a ball mesage together with value indicaing if the ball is good or not:
0-the ball is right
1-the ball is wrong

The net detects the ball end verifies if it can pass or not .If the ball can pass it sends a ball message to the other player.If not the player that servs sends another ball.

The server keeps the evidence of the balls.The net announce the server when a ball in wrong, and the server keeps a table with the number of each player's bad balls.

Finally the server announce the players the result.
The library ncurses helps to build the interface.

Thanks a lot for any help.