+ Reply to Thread
Results 1 to 3 of 3

Monte Carlo - Stop simulation/Vary iterations?

  1. #1
    Registered User
    Join Date
    06-24-2017
    Location
    England
    MS-Off Ver
    MS Excel 2016
    Posts
    2

    Monte Carlo - Stop simulation/Vary iterations?

    Hi everyone

    I've just started a little project of a monte carlo simulation for Roulette just for fun. So I've currently got it set up to play through 1000 spins and then simulate that 1000 spin game 5000 times.

    What I'd like to know is if I could have a cell where I can input the number of spins the game will contain? So I could change a cell to 100, and then instead of doing the 1000 I've set it to, it would just do 100 spins instead. So a variable amount of plays depending on what a cell is set to.

    Also in Roulette, you can lose all your money and so you can't play any more. Currently to factor this in I've got it to be IF the previous cell was 0, then every result from then on would be 0, but it's still processing that until the 1000 spins is over. Seems like a waste? Is there a way for it to just stop the spinning if the current bankroll becomes 0?

    Thanks in advance for any helpful answers! It's the first time i've ever played round with monte carlo simulation.

  2. #2
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,850

    Re: Monte Carlo - Stop simulation/Vary iterations?

    What I'd like to know is if I could have a cell where I can input the number of spins the game will contain?
    Short but useless answer -- yes, I'm sure it is possible. However, I'm not sure much else can be said without some knowledge of how you have implemented the Monte Carlo simulation.

    If you are using worksheet functions in an arrangement similar to my Monty Hall problem spreadsheet, (https://www.excelforum.com/tips-and-...l-problem.html ) where you simulate a single spin in a row, then copy that row as many times as you want, then you would simply need to add IF() functions to your formulas to test if the current iteration is more than the max iterations indicated in your desired cell. Of course, this approach will "suffer" from the same "problem" as you observe in the second half -- you will need to have more (possibly many more copies) of the formulas that end up performing the "If more than desired iterations return 0/empty string" step.

    If you are performing the simulation in VBA (or similar programming language), then you would modify your loop code to use an appropriate counter variable and perform the loop the desired number of times. If you are really concerned about the second part (unnecessarily testing for 0), I think a VBA/other programming language with a suitable loop structure is the only way to avoid these multiple unnecessary checks.

    Not knowing how you have implemented your simulation, I'm not sure much more can be said.
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  3. #3
    Registered User
    Join Date
    06-24-2017
    Location
    England
    MS-Off Ver
    MS Excel 2016
    Posts
    2

    Re: Monte Carlo - Stop simulation/Vary iterations?

    Thanks a lot for the response! That's pretty much how I set it up, one IF() function and then copied it 1000 times. And as you say, I was trying to avoid having unnecessary checks to see if a condition is met. Sometimes it may be checking 10,000 times when it could have been over after 10!

    So basically if I'm just using excel and not VBA or any other programming language, I can't really get around the unnecessary checks?

    Was just that I didn't want refreshing to take longer than it needed to by having pointless checks.

    Thanks for your answer, I'll play around with just copying the spin more times than it's needed, and if it's too slow I'll look at doing something with VBA.

    Edit: I'll also check out your Monty Hall simulation and see how it's done by an expert!
    Last edited by batmantrippin; 06-24-2017 at 09:55 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Average Across 100 Iterations (Monte Carlo)
    By jajuvipul in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-03-2015, 06:54 PM
  2. Monte Carlo simulation
    By Mag River in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 11-08-2013, 10:32 AM
  3. Help doing a Monte Carlo Simulation
    By farnood in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 04-23-2013, 07:53 PM
  4. Monte Carlo simulation
    By ASP__DEVELOPER in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 10-31-2012, 07:17 AM
  5. Monte Carlo Simulation
    By iamnamja in forum Excel General
    Replies: 4
    Last Post: 08-24-2011, 02:39 PM
  6. Monte Carlo Simulation
    By Phedwards in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-27-2007, 07:30 PM
  7. monte carlo simulation
    By unique in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-16-2005, 10:05 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1