Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save trycf/7cfdef0870e1ef8959d63b901b9f86fe to your computer and use it in GitHub Desktop.
Save trycf/7cfdef0870e1ef8959d63b901b9f86fe to your computer and use it in GitHub Desktop.
TryCF Gist
<cfset startingBalance = 4053.00>
<cfset numDays = 30>
<cfset maxDoubles = 8>
<cfset winsPerDay = 70>
<cfset balance1 = startingBalance>
<cfset totalWins1 = 0>
<cfoutput>
<strong>Starting Balance:</strong> $#NumberFormat(startingBalance, ",0.00")#<br>
<strong>Wins Per Day:</strong> #winsPerDay#<br>
<strong>Total Days:</strong> #numDays#<br>
<strong>Max Bets with doubling:</strong> #maxDoubles#<br><br>
</cfoutput>
<!--- Loop through 30 days --->
<cfloop index="day" from="1" to="#numDays#">
<cfset dayStartBalance1 = balance1>
<!--- First bet of the day BEFORE any wins --->
<cfset firstBet1 = Floor(startingBalance / (2^maxDoubles - 1) * 100) / 100>
<cfset firstBet1 = val(numberFormat(firstBet1 - 0.01, "0.00"))>
<!--- Simulate winsPerDay wins for each scenario --->
<cfloop index="i" from="1" to="#winsPerDay#">
<!--- compounding bets throughout the day --->
<cfset initialBet1 = Floor(startingBalance / (2^maxDoubles - 1) * 100) / 100>
<cfset initialBet1 = val(numberFormat(initialBet1 - 0.01, "0.00"))>
<cfset initialBet1 = firstBet1>
<cfset balance1 += initialBet1>
<cfset totalWins1++>
</cfloop>
<!--- Daily Summary --->
<cfset dayProfit1 = balance1 - dayStartBalance1>
<cfset dayProfitPct1 = (dayProfit1 / dayStartBalance1) * 100>
<cfoutput>
<b>End of Day #day#</b>:
First Bet: $#NumberFormat(firstBet1, ",0.00")# |
Profit: $#NumberFormat(dayProfit1, ",0.00")# |
Balance: $#NumberFormat(balance1, ",0.00")# |
Max Bets with doubling: #maxDoublesToday#
&nbsp;&nbsp;&nbsp;+#NumberFormat(dayProfitPct1, "0")#%
<br>
</cfoutput>
</cfloop>
<cfoutput>
<br><strong>Final Totals after #numDays# days:</strong><br>
Wins: #totalWins1# | Final Balance: $#NumberFormat(balance1, ",0.00")#<br>
</cfoutput>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment