Thema Datum  Von Nutzer Rating
Antwort
27.11.2012 19:30:47 Nici
NotSolved
28.11.2012 11:23:12 Holger
NotSolved
Rot Monte Carlo Simulation der Martingale Spielstrategie (Roulette)
05.12.2012 18:02:44 Nici
NotSolved
14.12.2012 12:10:53 Lutz
NotSolved

Ansicht des Beitrags:
Von:
Nici
Datum:
05.12.2012 18:02:44
Views:
888
Rating: Antwort:
  Ja
Thema:
Monte Carlo Simulation der Martingale Spielstrategie (Roulette)
So ich hab jetzt mal versucht den Code aufzustellen. Leider klappt es noch nicht ganz. Vielleicht sieht jemand den Fehler.

Vielen Dank fuer eure Hilfe!

Viele Gruesse
Nici

...........................
Option Explicit


Function Profit(ByVal Ini_Money As Long, ByVal Max_Plays As Long, Stop_Profit As Long) As Long

Dim i As Long, b As Long, p As Long, tp As Long, r As Double, rd As Long ' i,b,p,tp,rd as long as these must be integer values

 ' i is the money invested in each round
 ' b number of bets
 ' p profit obtained in one bet/round
 ' tp total profit obtained with all bets/rounds
 ' r is a random number
 ' rd is either 0 or 1 depending on the value of r; we set 1= colour picked 0=other colour
 
i = 1 ' every game starts with an initial investment of 1$
b = 1 ' the game starts with b=1 meaning that it represents the first bet/round
tp = 0 ' total profit at the start of the game

Do While Ini_Money >= i And b <= Max_Plays And tp <= Stop_Profit

r = Rnd() 'the rnd function gives a random number between 0 and 1
If r >= 0.513513513513513 Then
rd = 1
Else
rd = 0
End If

p = 2 * i * rd 'the profit we obtain during one bet is either 2$ in case our colour wins or 0$ if our colour looses
 
  If rd = 0 Then
  Ini_Money = Ini_Money - i 'if we loose our initial money decreases by the investment made in this round
  i = i * 2
                'in case we loose we have to invest the double amount of money in the next round
 Else 'there is only one other case which will be rd=1 meaning that our colour wins. In this case the following applies:
  Ini_Money = Ini_Money + p 'if we win our initial money increases by the profit made in this round
  i = 1 'if we win we will continue to invest 1$ for the next round
End If

If i > Ini_Money Then
 WorksheetFunction.Sum (i) - Ini_Money
 End If
 
b = b + 1 'the cumulative number of bets is obtained by adding 1 after each bet(one further bet)
 
tp = tp + p ' the total profit will be the cumulative profit of all previous bets plus the profit obtained the current bet
Loop

 Profit = tp
 
End Function

 


Ihre Antwort
  • Bitte beschreiben Sie Ihr Problem möglichst ausführlich. (Wichtige Info z.B.: Office Version, Betriebssystem, Wo genau kommen Sie nicht weiter)
  • Bitte helfen Sie ebenfalls wenn Ihnen geholfen werden konnte und markieren Sie Ihre Anfrage als erledigt (Klick auf Häckchen)
  • Bei Crossposting, entsprechende Links auf andere Forenbeiträge beifügen / nachtragen
  • Codeschnipsel am besten über den Code-Button im Text-Editor einfügen
  • Die Angabe der Emailadresse ist freiwillig und wird nur verwendet, um Sie bei Antworten auf Ihren Beitrag zu benachrichtigen
Thema: Name: Email:



  • Bitte beschreiben Sie Ihr Problem möglichst ausführlich. (Wichtige Info z.B.: Office Version, Betriebssystem, Wo genau kommen Sie nicht weiter)
  • Bitte helfen Sie ebenfalls wenn Ihnen geholfen werden konnte und markieren Sie Ihre Anfrage als erledigt (Klick auf Häckchen)
  • Bei Crossposting, entsprechende Links auf andere Forenbeiträge beifügen / nachtragen
  • Codeschnipsel am besten über den Code-Button im Text-Editor einfügen
  • Die Angabe der Emailadresse ist freiwillig und wird nur verwendet, um Sie bei Antworten auf Ihren Beitrag zu benachrichtigen

Thema Datum  Von Nutzer Rating
Antwort
27.11.2012 19:30:47 Nici
NotSolved
28.11.2012 11:23:12 Holger
NotSolved
Rot Monte Carlo Simulation der Martingale Spielstrategie (Roulette)
05.12.2012 18:02:44 Nici
NotSolved
14.12.2012 12:10:53 Lutz
NotSolved