Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace ConsoleApp1
- {
- class Program
- {
- static void Main(string[] args)
- {
- /* LOOP
- * draw some stuff
- * get some input
- * do some simulation
- * decide if we should quit
- * loop again
- * */
- bool shouldQuit = false;
- int turnNumber = 0;
- // < <= > >= == !=
- // Boolean operators
- // && AND
- // || OR
- // ! NOT
- // Operate on a boolean value
- // ! negates the boolean value, so true becomes false, false becomes true
- int arrowCount = 0;
- int arrowIncrease = 1;
- // Press a key to spend all your arrows.
- // Now every turn you make more arrows based on the number of arrows you just spent.
- // Come up with a game, using this basic format, or keeping track of the turn number (maybe some other stuff)
- // printing out based on the state of the game
- // responding to inputs
- // Scope and variable declarations
- // This allocates an object of type Random using the new operator, and the initializer called Random
- Random random = new Random();
- while (!shouldQuit)
- {
- Console.Clear();
- Console.WriteLine("Hey gamer.");
- Console.WriteLine("Turn number is " + turnNumber);
- int r = random.Next();
- Console.WriteLine(r);
- int r2 = random.Next(100);
- Console.WriteLine(r2);
- // The second argument is EXCLUSIVE, so it wont ever go up to 1, only < 1
- int r3 = random.Next(-256, 1);
- Console.WriteLine(r3);
- /*
- * make a dice variable for a d4, d6, d8, d10, d12, and d20
- * Each time thru the game loop you roll all the dice
- * Make a variable which is the sum off all the dice
- * If that variable is the maximum value then quit the game
- * If the variable isn't the maximum, then press any key to re roll
- *
- * Generate another random number between 0 and 100
- * If any of the dice equal that value, also quit the game.
- * */
- int dice = random.Next(1, 21);
- Console.WriteLine("d20 is " + dice);
- if (dice == 20)
- {
- Console.WriteLine("NAT 20");
- }
- // The && AND operator, will evaluate to true if both sides are true, and false in any other case.
- if (dice > 12 && dice < 20)
- {
- Console.WriteLine("That was pretty okay");
- }
- if (dice < 12 && dice > 1)
- {
- Console.WriteLine("Not good");
- }
- if (dice == 1)
- {
- Console.WriteLine("CRITICAL FAIL BOO");
- }
- // || OR will evaluate to true if either side is true, and false if both sides are false
- if (dice < 2 || dice > 18)
- {
- Console.WriteLine("Thats extreme man");
- }
- ConsoleKey k = Console.ReadKey(true).Key;
- if (k == ConsoleKey.Escape)
- {
- shouldQuit = true;
- }
- turnNumber = turnNumber + 1;
- }
- Console.WriteLine("Goodbye World!");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement