Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
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
https://www.fxp.co.il/showthread.php?t=21125499
online compiler
Numeric to graphical output using string extension method
Inheritiance
condicional "?"
Planet-D
Generic Factory pattern
Lab7
Клас cstatic
Encrption & Decryption C#