Noisy Channel Simulation

Hi all!

Can anyone help me with my code?

I need to simulate a noisy channel. The program would get bits from an input. These bits would then be "processed," or would go through the noisy channel. Then, the program would output the resulting bits. The program must be accessible through the command prompt. Specifically, the usage or syntax in the command prompt should be:

transmit.exe test.txt | noisychannel.exe [user defined value] | receive.exe output.txt

where transmit.exe reads a file in binary mode (in this case, test.txt) and transmits the file bit by bit; receive.exe reads an input bit by bit and creates a file with the recived bits (in this case, output.txt). Thus, if the usage was:

transmit.exe test.txt | receive.exe output.txt

the effect would be a created file named output.txt with contents similar to test.txt (just like Copy). In other words, the output of transmit.exe is used as the input of receive.exe.

However, now there should be a noisychannel program between them. In effect, the noisychannel program gets its input from transmit.exe, and outputs its results to receive.exe. The [user defined value] argument in the noisychannel program is the value of the probability of error. In the noisychannel program, a random number is generated between 0 and 1 of type double/float. Each time a bit is processed by the noisychannel program, this random number is generated. If the random number generated is greater than the user defined value for error, the bit being processed by the program would be inverted (for example, user defined value is 0.50; random number generated is 0.51; since random number generated is greater than the user defined value, an error would occur; thus, if the input bit got by noisychannel from transmit.exe is 1, it would invert it and output a 0, and vice-versa, to receive.exe; if the random number generated is less than the user defined value for error, for example 0.49, then the noisychannel program would simply output that bit to receive.exe).

Please note that the noisychannel program gets the input from transmit.exe bit by bit, generates a random number, compares this generated random number to the user defined value for error, inverts the input bit if the generated number is greater than the value for error or leaves it as is if not, outputs this bit to receive.exe, gets the next input bit, generates a new random number, so on and so forth.

The programs transmit.exe and receive.exe are already done. I just need the code for noisychannel.exe.

Questions and clarifications about the specifications of the noisychannel program are very welcome. Just please, please, please help me. I need the code by February 18, 2008. Thanks to all those who would help!
Last edited on
Topic archived. No new replies allowed.