To run your program, you will want to use one of the following
TOY simulators.
We recommend that you use the C TOY Simulator as we will be
grading with that one. However, you are free to develop your
code on the Visual X-TOY simulator.
To generate pseudo-random bits, use the program
/u/cs126/files/toy/bits.c.
Compile it with:
gcc126 bits.c
If you are using Unix, rename your executable file via:
mv a.out bits
Test it with the command
bits
You should see 3000 pseudo-random bits whiz by your screen.
If you want to experiment with different bits, change the seed value
by supplying an optional command-line argument.
bits 1234
To connect the output of the pseduo-random bit generator
to the input of the TOY simulator, combine piping with
command line input:
bits | toy option.toy
|
Checking your work and hints
|
Here are some
hints for getting started and
debugging.
Here are the
cumulative profits after each experiment that your final
program should print out. An estimate of the option's expected value
is the last value divided by 100.
Submit the following files:
readme.txt option.toy
Do not use different file names.
Your option.toy program should be amply commented.
It should also be cleaned up so that the only call to standard output
is to print out the 100 successive sums (the ith successive sum is the
cumulative profit obtained in the first i option experiments).
You will lose points if you don't follow these instructions.
The readme.txt file should contain the following
information. Here is a
readme template.
Name, precept number.
High level description of code, any serious problems you
encountered, and whatever outside help that you received.
Include a table indicating what each of the registers
are used for.
Give your estimate of the value of 1 option in dollars
and cents. Use pencil and paper to do the division. (If you feel
adventuresome, feel free to write TOY code to do it.)
Indicate whether you used the C or Java TOY simulator
to develop your code.
Kevin Wayne