Make sure to review the procedures for submitting homework. For example, remember that you must use LyX (on CSIF in my Pub directory) or straight LaTeX to submit your mathematical work. So, the ONLY files you submit should have types .java (or .c++) or .latex or .lyx. And remember to show your work!
Suppose each bit being transmitted has probability p of being received in error, with the bits' accuracies being independent of each other.
A. In n transmitted bits, what is the probability that exactly k bits are incorrectly received? Your answer must be an expression in p, n and k. [Answer in the special case of n = 4, k = 1, p = 0.01: 0.0388.]
B. In n transmitted bits, suppose exactly k are incorrectly received (k > 0). What is the probability that the k errors all occurred at the beginning of the transmission, i.e. in the first k bits? Your answer must be an expression in p, n and k. [Answer in the special case of n = 4, k = 1: 1/4.]
Suppose errors are correlated between bits, in the following way. If a bit is received correctly, the probability that the following bit is received in error is p; if a bit is received in error, the probability that the following bit is received in error is q. Suppose also that the probability the first bit is in error is p. Thus for example the probability that the first 3 bits are in error is pq2.
Let N denote the number of errors in a 4-bit message. Find P(N = 2) and E(N). Your answers must be expressions in p and q.
Note: If you wish to check your answers to Problems I and II, you may wish to modify my sample simulation program. This would just be for verification purposes; do not submit it with your homework.
Here you will write a pair of programs to play 5-in-a-row, a game like tic-tac-toe but requiring 5 Xs or Os to win. The board will consist of a 10-row, 20-column grid. The client will play X and have the first move. The game continues until either someone wins or the board is filled.
The server, named fiveinarowd, will run constantly. When it first comes up, it waits for a "call" from a client. When that call comes, the server plays that game, and then returns to waiting for another call, etc.
The user invokes the client, named fiveinarow, specifying the Internet address of the server on the command line. The server will send back a welcome message, which the client will display to the user, along with drawing the empty board. The user will then type in his/her move at the keyboard, expressed as row and column numbers, after which the server responds with its move and the client draws the new board setting for the user to see. (It does the latter just as ASCII text, using Xs and Os, with hyphens for the blank squares.)
The server will choose its moves according to an algorithm of your choice. (It will NOT read from the keyboard.) It certainly does not need to be optimal, but try to make it somewhat reasonable.
Have both the client and server programs specify a port number on the command line. Keep in mind the need for uniqueness here, e.g. the remark in our printed lecture notes pointing out that the same port cannot be reused within a few seconds.
Note: The Java versions of the wps and svr programs are on my Java Web page, to which our class Web page has a link.