/* * sim.cpp * * Created on: Sep 25, 2010 * Author: Michael J. Fischer * for use in Yale course CPSC 427a, Fall 2010 */ #include "sim.hpp" void Simulator::experiment() { for (int i = 0; i < num_rounds_; i++) { crapsGame_->playRound(); } } void Simulator::printResults(ostream& out) const { out << "After " << num_rounds_ << " rounds using seed " << seed_ << ":" << endl; out << "Wins: " << crapsGame_->numWins() << endl; out << "Probability of win: " << (double) crapsGame_->numWins()/ num_rounds_ << endl; out << "Expected number of rolls: " << (double) crapsGame_->numRolls() / num_rounds_ << endl; }