Advertisement
Guest User

Untitled

a guest
Sep 23rd, 2019
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.62 KB | None | 0 0
  1. using System;
  2.  
  3. namespace ConsoleApp1
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. /* LOOP
  10. * draw some stuff
  11. * get some input
  12. * do some simulation
  13. * decide if we should quit
  14. * loop again
  15. * */
  16.  
  17. bool shouldQuit = false;
  18. int turnNumber = 0;
  19. // < <= > >= == !=
  20.  
  21. // Boolean operators
  22. // && AND
  23. // || OR
  24. // ! NOT
  25. // Operate on a boolean value
  26. // ! negates the boolean value, so true becomes false, false becomes true
  27.  
  28. int arrowCount = 0;
  29. int arrowIncrease = 1;
  30. // Press a key to spend all your arrows.
  31. // Now every turn you make more arrows based on the number of arrows you just spent.
  32.  
  33. // Come up with a game, using this basic format, or keeping track of the turn number (maybe some other stuff)
  34. // printing out based on the state of the game
  35. // responding to inputs
  36.  
  37. // Scope and variable declarations
  38.  
  39. // This allocates an object of type Random using the new operator, and the initializer called Random
  40. Random random = new Random();
  41.  
  42. while (!shouldQuit)
  43. {
  44. Console.Clear();
  45. Console.WriteLine("Hey gamer.");
  46. Console.WriteLine("Turn number is " + turnNumber);
  47.  
  48. int r = random.Next();
  49. Console.WriteLine(r);
  50.  
  51. int r2 = random.Next(100);
  52. Console.WriteLine(r2);
  53.  
  54. // The second argument is EXCLUSIVE, so it wont ever go up to 1, only < 1
  55. int r3 = random.Next(-256, 1);
  56. Console.WriteLine(r3);
  57.  
  58. /*
  59. * make a dice variable for a d4, d6, d8, d10, d12, and d20
  60. * Each time thru the game loop you roll all the dice
  61. * Make a variable which is the sum off all the dice
  62. * If that variable is the maximum value then quit the game
  63. * If the variable isn't the maximum, then press any key to re roll
  64. *
  65. * Generate another random number between 0 and 100
  66. * If any of the dice equal that value, also quit the game.
  67. * */
  68.  
  69. int dice = random.Next(1, 21);
  70.  
  71. Console.WriteLine("d20 is " + dice);
  72.  
  73. if (dice == 20)
  74. {
  75. Console.WriteLine("NAT 20");
  76. }
  77.  
  78. // The && AND operator, will evaluate to true if both sides are true, and false in any other case.
  79. if (dice > 12 && dice < 20)
  80. {
  81. Console.WriteLine("That was pretty okay");
  82. }
  83. if (dice < 12 && dice > 1)
  84. {
  85. Console.WriteLine("Not good");
  86. }
  87.  
  88. if (dice == 1)
  89. {
  90. Console.WriteLine("CRITICAL FAIL BOO");
  91. }
  92.  
  93. // || OR will evaluate to true if either side is true, and false if both sides are false
  94. if (dice < 2 || dice > 18)
  95. {
  96. Console.WriteLine("Thats extreme man");
  97. }
  98.  
  99.  
  100.  
  101. ConsoleKey k = Console.ReadKey(true).Key;
  102.  
  103.  
  104.  
  105. if (k == ConsoleKey.Escape)
  106. {
  107. shouldQuit = true;
  108. }
  109.  
  110. turnNumber = turnNumber + 1;
  111. }
  112.  
  113. Console.WriteLine("Goodbye World!");
  114. }
  115. }
  116. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement