← All lessons

Lesson 15 of 17Build the program1 min read

Replay a few prices

Run the same input twice and compare the decisions.

The idea

A replay feeds stored observations into the program in order.

You control the input, so you can check exactly what should happen.

A small example

Replay 10, 11, 12, 9 through our three-price rule.

New price Expected state
10 Not enough data
11 Not enough data
12 Average 11; above average
9 Average about 10.67; below average

Save one log row for each input.

Try it

Reset the program and run the same sequence again. Compare the two logs.

Then add a missing value and decide whether the program should reject it or wait for another valid price.

Check your work

The two unchanged runs should agree. Any difference needs an explanation.

Keep replay decisions based on the supplied observations, not on what time you happen to press Run. Fix the small example before trying a larger file.