Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Blog
tst
//Rextester.Program.Main is the entry point for your code. Don't change it. //Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5 using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; namespace Rextester { public class Program { public static void Main(string[] args) { int winner = 0; int bankrupt = 0; Random r = new Random(); for(int j = 0; j < 100; j++) { int run = 0; float stake = 1; float bankroll = 100; float odds = 1.5f; float target = 2 * bankroll; for(int i = 0; true; i++) { float f = (float) r.NextDouble(); run++; bankroll -= stake; if(f <= (1f/odds)) { bankroll += (stake * (odds-1*0.04f)); // Console.WriteLine("WON:{0}/{1} ({2})",f, 1f/odds, bankroll); } else { // Console.WriteLine("LOST:{0}/{1} ({2})",f, 1f/odds, bankroll); } if(bankroll < stake) { // Console.WriteLine("BANKRUPT"); bankrupt++; break; } if(bankroll > target) { //Console.WriteLine("WINNER"); winner++; break; } } //Your code goes here //Console.WriteLine("Runs: {0}:{1}", run, bankroll); } Console.WriteLine("BANKRUPT:{0} / WINNER: {1}", bankrupt, winner); } } }
run
|
edit
|
history
|
help
0
Please
log in
to post a comment.
Problem: fb_series
Chandramouli
temp1
Testing email address validation
The modifier 'private' is not valid for this item
Convert string to TimeSpan in C#
Coding Club 1-16-18
Heap sort
Fórum Parallel Threads ( Without Fun )
fun with yield return
Please log in to post a comment.