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

Ansicht des Beitrags:
Von:
Lutz
Datum:
14.12.2012 12:10:53
Views:
921
Rating: Antwort:
  Ja
Thema:
Monte Carlo Simulation der Martingale Spielstrategie (Roulette)

Hallo Nici,

So sollte es klappen, ich habe noch eine Protokollierung zum Testen eingebaut:


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
Dim rg As Range
 ' 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
ueber = Array("Runde", "Farbe", "Einsatz", "Gewinn", "Restgeld")
UsedRange.Clear
Range("A1:E1").Value = ueber
Set rg = Range("A3:E3")
Do While Ini_Money >= i And b <= Max_Plays And tp <= Stop_Profit
    rd = Int(2 * Rnd()) 'Gives 0 or 1
    
    Ini_Money = Ini_Money - i 'we bet
    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
    Ini_Money = Ini_Money + p 'if we win our initial money increases by the profit made in this round
    tp = tp + p - i ' the total profit will be the cumulative profit of all previous bets plus the profit obtained the current bet
    
    zeile = Array(b, IIf(rd = 0, "schwarz", "rot"), i, tp, Ini_Money)
    rg.Value = zeile
    Set rg = rg.Offset(1, 0)
    
    b = b + 1 'the cumulative number of bets is obtained by adding 1 after each bet(one further bet)
    
    If rd = 0 Then
        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:
        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
Loop
 
Profit = tp
 
End Function

Public Sub TestProfit()
    Profit 127, 50, 50
End Sub

Grüße Lutz


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
05.12.2012 18:02:44 Nici
NotSolved
Blau Monte Carlo Simulation der Martingale Spielstrategie (Roulette)
14.12.2012 12:10:53 Lutz
NotSolved