Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <stdio.h>
- #include <math.h>
- #include <vector>
- #include <time.h>
- #include <stdlib.h>
- using namespace std;
- int main()
- {
- srand ( time(NULL) );
- int money = 2000;
- int startingLine = money;
- int lastLost = 0;
- int lastWon = 0;
- int bet = 1;
- cout << "bet,run,money" << endl;
- while (money > 0)
- {
- int run = startingLine - money;;
- int result = rand()%100 + 1;
- //if (bet + run > 1)
- //needed to be
- //if ((bet + run) > 1)
- if ((money + bet) > (startingLine + 1))
- {
- //if (run < 0)
- //{
- //could result in infinitely reducing bet size?
- //bet = (run * -1) +1;
- //bet = money - startingLing +1;
- //bet = (valueLost * -1) + 1;
- //}
- bet = money - startingLine + 1;
- //else{ // could result in infinitely reducing bet size... need to compare to startingLine
- //need to compare to lastLost value...
- // bet = 1;
- //run = 0;
- //}
- }
- /*
- if (run >= 1)
- {
- bet = 1;
- run = 0;
- startLine++;
- }
- */
- cout << bet << "," << run << "," << money << endl;
- //win if (run + bet)
- if(result >= 52)
- {
- money += bet;
- lastWon = bet;
- bet += 1;
- if (money > startingLine)
- {
- startingLine++;
- bet = 1;
- }
- //run += bet;
- }
- //loss
- else{
- money -= bet;
- //run -= bet;
- lastLost = bet;
- bet = lastLost;
- //can comment this
- /*
- bet -= 1;
- if (bet <= 0)
- {
- bet = 1;
- }
- */
- }
- }
- //cout << "Hello world!" << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement