Advertisement
Guest User

Untitled

a guest
Oct 19th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.87 KB | None | 0 0
  1. using System;
  2. using System.Threading;
  3.  
  4. namespace HearthStats
  5. {
  6. class Program
  7. {
  8. //Create enum "State", so we can
  9. public enum State
  10. {
  11. ROBBINGBANK, HAVINGGOODTIME, LAYINGLOW, FLEEING,
  12. }
  13.  
  14. private static Random rnd = new Random();
  15. private static State currentState = State.ROBBINGBANK;
  16. private static int wealth = 0, distanceToCop = 1, strength = 10;
  17.  
  18. static void Main(string[] args)
  19. {
  20.  
  21. Console.WriteLine("Wealth: " + wealth.ToString() + " Distance: " + distanceToCop.ToString() + " Strength: " + strength.ToString());
  22.  
  23. while (true)
  24. {
  25. switch(currentState)
  26. {
  27. case State.ROBBINGBANK: {
  28. wealth++;
  29. strength--;
  30. if (rnd.Next(0, 10) < 3) distanceToCop = 0;
  31. if (distanceToCop == 0)
  32. {
  33. currentState = State.FLEEING;
  34. Console.WriteLine("There's a cop, better start running!!"); break;
  35.  
  36. }
  37. if (wealth >= 5 && strength >= 5)
  38. {
  39. Console.WriteLine("I got enough money and feel strong enough to have a good time!");
  40. currentState = State.HAVINGGOODTIME; break;
  41. }
  42. if (strength == 0)
  43. {
  44. Console.WriteLine("I'm out of energy, i need rest!");
  45. currentState = State.LAYINGLOW;
  46. }
  47. Console.WriteLine("Status: Robbing the bank");
  48. Console.WriteLine("Wealth: " + wealth.ToString() + " Distance: " + distanceToCop.ToString() + " Strength: " + strength.ToString());
  49. break;
  50. }
  51. case State.HAVINGGOODTIME: {
  52. wealth--;
  53. strength--;
  54. if(rnd.Next(0, 10) < 3) distanceToCop = 0;
  55. if (distanceToCop == 0)
  56. {
  57. Console.WriteLine("There's a cop, better start running!!");
  58. currentState = State.FLEEING; break;
  59. }
  60. if (strength == 0)
  61. {
  62. Console.WriteLine("I 'm feeling weak, i should rest.");
  63. currentState = State.LAYINGLOW; break;
  64. }
  65. if(wealth == 0)
  66. {
  67. Console.WriteLine("I'm out of money, i should try to get some more.");
  68. currentState = State.ROBBINGBANK; break;
  69. }
  70. Console.WriteLine("Status: Having a good time");
  71. Console.WriteLine("Wealth: " + wealth.ToString() + " Distance: " + distanceToCop.ToString() + " Strength: " + strength.ToString());
  72. break;
  73. }
  74. case State.LAYINGLOW: {
  75. strength++;
  76.  
  77. if(strength >= 5 && wealth >= 5)
  78. {
  79. Console.WriteLine("Time to have a good time again!");
  80. currentState = State.HAVINGGOODTIME;
  81. }
  82. if (strength >= 5)
  83. {
  84. Console.WriteLine("I feel refreshed, let's go rob a bank again!");
  85. currentState = State.ROBBINGBANK; break;
  86. }
  87. Console.WriteLine("Status: Laying low");
  88. Console.WriteLine("Wealth: " + wealth.ToString() + " Distance: " + distanceToCop.ToString() + " Strength: " + strength.ToString());
  89. break;
  90. }
  91. case State.FLEEING: {
  92. strength--;
  93. distanceToCop++;
  94. if(distanceToCop > 2) {
  95. Console.WriteLine("I lost the cop, lets go rest");
  96. currentState = State.LAYINGLOW; break;
  97. }
  98. if (wealth >= 5 && strength >= 5)
  99. {
  100. Console.WriteLine("I lost the cop, i feel safe, time to have a good time!!");
  101. currentState = State.HAVINGGOODTIME; break;
  102. }
  103. if (strength > 0 && wealth < 5)
  104. {
  105. Console.WriteLine("I feel safe, let's go rob a bank again!");
  106. currentState = State.ROBBINGBANK; break;
  107. }
  108. if(strength == 0)
  109. {
  110. currentState = State.LAYINGLOW;
  111. }
  112. Console.WriteLine("Status: Fleeing!!");
  113. Console.WriteLine("Wealth: " + wealth.ToString() + " Distance: " + distanceToCop.ToString() + " Strength: " + strength.ToString());
  114. break;
  115. }
  116.  
  117. }
  118. Thread.Sleep(1000);
  119.  
  120. }
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128. }
  129. }
  130. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement