Skip to main content
added 3 characters in body
Source Link
dabd
  • 839
  • 4
  • 13

I made a notebook with the following code, but for some reason when I evaluate it it keeps replaying repeatedly. What is causing this?

Thanks.

RandomWalk[n_, roi_, bi_, 
  rake_] := (pwin = bi (1 + roi)/(2 (bi - rake)); 
  NestWhileList[# + 
     RandomChoice[{pwin, 1 - pwin} -> {1 - 2 rake/bi, -1}] &, 
   0, # True &, 0, n])

Manipulate[(data = RandomWalk[nrTournaments, roi, bi, rake]; 
  dollarWon = biWon bi; biWon = Last[data]; 
  ListPlot[data, Joined -> True]), {{nrTournaments, 10000, 
   "tournaments"}, 0, 100000, 100}, {{roi, 0.015, "ROI"}, 0, 20, 
  0.001}, {{bi, 60, "BI ($)"}, 0, 10000, 
  1}, {{rake, 1.26, "rake ($)"}, 0, 500, 0.01}, 
 Panel[Grid[{{Dynamic[
      Row[{"BI won: ", ToString[biWon], " (", 
        Style["$" <> ToString[dollarWon], 
         If[dollarWon >= 0, Darker[Green], Red]], ")"}]]}}, 
   Alignment -> Left]], SaveDefinitions -> True]

I made a notebook with the following code, but for some reason when I evaluate it it keeps replaying repeatedly. What is causing this?

Thanks.

RandomWalk[n_, roi_, bi_, 
  rake_] := (pwin = bi (1 + roi)/(2 (bi - rake)); 
  NestWhileList[# + 
     RandomChoice[{pwin, 1 - pwin} -> {1 - 2 rake/bi, -1}] &, 
   0, # True, n])

Manipulate[(data = RandomWalk[nrTournaments, roi, bi, rake]; 
  dollarWon = biWon bi; biWon = Last[data]; 
  ListPlot[data, Joined -> True]), {{nrTournaments, 10000, 
   "tournaments"}, 0, 100000, 100}, {{roi, 0.015, "ROI"}, 0, 20, 
  0.001}, {{bi, 60, "BI ($)"}, 0, 10000, 
  1}, {{rake, 1.26, "rake ($)"}, 0, 500, 0.01}, 
 Panel[Grid[{{Dynamic[
      Row[{"BI won: ", ToString[biWon], " (", 
        Style["$" <> ToString[dollarWon], 
         If[dollarWon >= 0, Darker[Green], Red]], ")"}]]}}, 
   Alignment -> Left]], SaveDefinitions -> True]

I made a notebook with the following code, but for some reason when I evaluate it it keeps replaying repeatedly. What is causing this?

Thanks.

RandomWalk[n_, roi_, bi_, 
  rake_] := (pwin = bi (1 + roi)/(2 (bi - rake)); 
  NestWhileList[# + 
     RandomChoice[{pwin, 1 - pwin} -> {1 - 2 rake/bi, -1}] &, 
   0, True &, 0, n])

Manipulate[(data = RandomWalk[nrTournaments, roi, bi, rake]; 
  dollarWon = biWon bi; biWon = Last[data]; 
  ListPlot[data, Joined -> True]), {{nrTournaments, 10000, 
   "tournaments"}, 0, 100000, 100}, {{roi, 0.015, "ROI"}, 0, 20, 
  0.001}, {{bi, 60, "BI ($)"}, 0, 10000, 
  1}, {{rake, 1.26, "rake ($)"}, 0, 500, 0.01}, 
 Panel[Grid[{{Dynamic[
      Row[{"BI won: ", ToString[biWon], " (", 
        Style["$" <> ToString[dollarWon], 
         If[dollarWon >= 0, Darker[Green], Red]], ")"}]]}}, 
   Alignment -> Left]], SaveDefinitions -> True]
Source Link
dabd
  • 839
  • 4
  • 13

Manipulate keeps replaying the animation non-stop

I made a notebook with the following code, but for some reason when I evaluate it it keeps replaying repeatedly. What is causing this?

Thanks.

RandomWalk[n_, roi_, bi_, 
  rake_] := (pwin = bi (1 + roi)/(2 (bi - rake)); 
  NestWhileList[# + 
     RandomChoice[{pwin, 1 - pwin} -> {1 - 2 rake/bi, -1}] &, 
   0, # True, n])

Manipulate[(data = RandomWalk[nrTournaments, roi, bi, rake]; 
  dollarWon = biWon bi; biWon = Last[data]; 
  ListPlot[data, Joined -> True]), {{nrTournaments, 10000, 
   "tournaments"}, 0, 100000, 100}, {{roi, 0.015, "ROI"}, 0, 20, 
  0.001}, {{bi, 60, "BI ($)"}, 0, 10000, 
  1}, {{rake, 1.26, "rake ($)"}, 0, 500, 0.01}, 
 Panel[Grid[{{Dynamic[
      Row[{"BI won: ", ToString[biWon], " (", 
        Style["$" <> ToString[dollarWon], 
         If[dollarWon >= 0, Darker[Green], Red]], ")"}]]}}, 
   Alignment -> Left]], SaveDefinitions -> True]