def Root2(r,verbose=True):
    '''
        simple wrapper routine for solver. returns the energy level for a given R=r.
        the solver can use this method to minimise the energy by varying r as necessary.
    '''
    if r <= 0:
        return 1e99
    else:
        e = MonteCarloEngine(moduleName='MonteCarloHeadsTailsExample', className='SimpleHeadTailModel')
        losers = e.start(args={'wager_multiplier':r})
        if verbose: print 'solving for r: ', r
        return losers

        simple wrapper routine for solver. returns the energy level for a given R=r.
        the solver can use this method to minimise the energy by varying r as necessary.
    
recipes/Python/578869_Monte_Carlo_Engine__How_find_optimised_wager/recipe-578869.py