Advertisement
laferrierejc

Oscar's Betting

Feb 20th, 2013
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.09 KB | None | 0 0
  1. #include <iostream>
  2. #include <stdio.h>
  3. #include <math.h>
  4. #include <vector>
  5. #include <time.h>
  6. #include <stdlib.h>
  7.  
  8. using namespace std;
  9.  
  10. int main()
  11. {
  12. srand ( time(NULL) );
  13.  
  14.  
  15. int money = 2000;
  16. int startingLine = money;
  17. int lastLost = 0;
  18. int lastWon = 0;
  19.  
  20. int bet = 1;
  21.  
  22. cout << "bet,run,money" << endl;
  23.  
  24. while (money > 0)
  25. {
  26.  
  27. int run = startingLine - money;;
  28.  
  29. int result = rand()%100 + 1;
  30.  
  31. //if (bet + run > 1)
  32. //needed to be
  33. //if ((bet + run) > 1)
  34. if ((money + bet) > (startingLine + 1))
  35. {
  36. //if (run < 0)
  37. //{
  38. //could result in infinitely reducing bet size?
  39. //bet = (run * -1) +1;
  40. //bet = money - startingLing +1;
  41. //bet = (valueLost * -1) + 1;
  42. //}
  43. bet = money - startingLine + 1;
  44. //else{ // could result in infinitely reducing bet size... need to compare to startingLine
  45. //need to compare to lastLost value...
  46. // bet = 1;
  47. //run = 0;
  48. //}
  49. }
  50.  
  51. /*
  52. if (run >= 1)
  53. {
  54. bet = 1;
  55. run = 0;
  56. startLine++;
  57.  
  58. }
  59. */
  60.  
  61.  
  62. cout << bet << "," << run << "," << money << endl;
  63.  
  64. //win if (run + bet)
  65. if(result >= 52)
  66. {
  67. money += bet;
  68. lastWon = bet;
  69. bet += 1;
  70. if (money > startingLine)
  71. {
  72. startingLine++;
  73. bet = 1;
  74. }
  75. //run += bet;
  76.  
  77. }
  78. //loss
  79. else{
  80. money -= bet;
  81. //run -= bet;
  82. lastLost = bet;
  83. bet = lastLost;
  84.  
  85. //can comment this
  86. /*
  87. bet -= 1;
  88. if (bet <= 0)
  89. {
  90. bet = 1;
  91. }
  92. */
  93. }
  94.  
  95.  
  96. }
  97.  
  98. //cout << "Hello world!" << endl;
  99. return 0;
  100. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement