run_trial function

Simulate a single trial