Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace fibb
- {
- class Program
- {
- const int Original_bet = 1;
- const int win_chance = 48;
- const int starting_cash = 1000;
- const int goal = 2000;
- static Random random = new Random();
- static Random pid = new Random();
- static void Main(string[] args)
- {
- List<int> fib_seq;
- Fib_seq(out fib_seq);
- int wins = 0;
- int loss = 0;
- int rotate = 5000;
- for(int i = 0; i < rotate; i++)
- {
- int end_cash = Cycle(fib_seq);
- Console.WriteLine((i+1).ToString()+": " + end_cash);
- Console.WriteLine();
- if (end_cash == 0)
- {
- loss++;
- }
- else
- {
- wins++;
- }
- }
- Console.WriteLine("\nTotal results:\nwins: " + wins);
- Console.WriteLine("loss: " + loss);
- Console.ReadLine();
- }
- static int Cycle(List<int> fib_seq)
- {
- int current_bet = Original_bet;
- int index = 0;
- int start_cash = starting_cash;
- int wins = 0;
- int loss = 0;
- int loss_streak = 0;
- int highest = 0;
- while (start_cash <= goal)
- {
- int randomNumber = random.Next(1, 101);
- current_bet = fib_seq[index];
- if (current_bet > start_cash)
- {
- current_bet = start_cash;
- }
- bool pass = false;
- int next = pid.Next(0, 2);
- if (next == 0)
- {
- if(randomNumber >= 100-win_chance)
- {
- pass = true;
- }
- else
- {
- pass = false;
- }
- }
- else
- {
- if (randomNumber > win_chance)
- {
- pass = true;
- }
- else
- {
- pass = false;
- }
- }
- if (pass)
- {
- start_cash += current_bet;
- index-=2;
- wins++;
- loss_streak = 0;
- }
- else
- {
- start_cash -= current_bet;
- index++;
- loss++;
- loss_streak++;
- }
- if (index < 0)
- {
- index = 0;
- }
- if (highest < loss_streak)
- {
- highest = loss_streak;
- }
- if (start_cash <= 0)
- {
- break;
- }
- }
- Console.WriteLine("wins: " + wins);
- Console.WriteLine("loss: " + loss);
- Console.WriteLine("loss_streak: " + highest);
- return start_cash;
- }
- static void Fib_seq(out List<int> fib_seq)
- {
- int n = 50;
- fib_seq = new List<int>();
- fib_seq.Add(Original_bet);
- fib_seq.Add(Original_bet);
- for (int i=2;i< n; i++)
- {
- fib_seq.Add(fib_seq[i - 1] + fib_seq[i - 2]);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement