Created
May 6, 2025 20:14
-
-
Save trycf/778e33c89bedbe8e37af4ec472498e6d to your computer and use it in GitHub Desktop.
TryCF Gist
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cfset startingBalance = 3400.00> | |
<cfset numDays = 50> | |
<cfset pctToBet = .004> | |
<cfset pctToBet = .0059> | |
<cfset pctToBet = .0070> | |
<cfset winsPerDay = 30> | |
<cfset balance1 = startingBalance> | |
<cfset totalWins1 = 0> | |
<!--- Calculate max number of times you can double your bet ---> | |
<cfset maxDoubles = Floor( Log(1 / pctToBet) / Log(2) )> | |
<cfoutput> | |
<strong>Starting Balance:</strong> $#NumberFormat(startingBalance, ",0.00")#<br> | |
<strong>% to bet:</strong> #pctToBet#<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 = balance1 * pctToBet> | |
<cfset firstBet1 = val(numberFormat(firstBet1, "0.00"))> | |
<!--- Calculate max doubles today in case you want to show it per day ---> | |
<cfset maxDoublesToday = Floor( Log(dayStartBalance1 / firstBet1) / Log(2) )> | |
<!--- Simulate winsPerDay wins for each scenario ---> | |
<cfloop index="i" from="1" to="#winsPerDay#"> | |
<!--- compounding bets throughout the day ---> | |
<cfset initialBet1 = balance1 * pctToBet> | |
<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# | |
+#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