static void Main(string[] args) { using (Game game = new Game()) { game.Run(60.0); } }
static void Main(string[] args) { Game g = new Game(); g.play(); Player winner = g.getWinner(); if (winner == null) Console.WriteLine("Tie game."); else Console.WriteLine("\nWinner = " + winner.getName()); Console.ReadKey(); }
static void Main(string[] args) { bool play = true; NewNumber getNewNumber = new NewNumber(); Game game = new Game(); Console.WriteLine("Play a game of High/Low, guesse if the next didget vill be higher, lower or the same as the previous one."); int next = getNewNumber.newInt(); //int random = getNewNumber.newInt(5, 10); // Ur samma klass kan vi oxå sätta ett bestämt värde. int previous; while (play) { Console.WriteLine("You've got number: {0}, is the next one Higher(h) or Lower(l)?", next); previous = next; string answer = Console.ReadLine(); next = getNewNumber.newInt(); Console.Clear(); Console.WriteLine("The new number is {0}.", next); game.Evaluate(previous, next, answer); } }
static void Main(string[] args) { //Main setup program char playAgain = 'y'; while (playAgain != 'n') { Program nim = new Program(); Game Nim = new Game(); List<List<int>> list = new List<List<int>>(); int piles, sticks; string num; bool turn = true; Console.Clear(); nim.gameIntro(); Console.Out.Write("\n\n How many Piles for today's game? "); num = Console.ReadLine(); piles = Convert.ToInt32(num); //Sets up the initial array for playing field int[] numOfPiles = new int[piles]; int pileNumber = 1; for (int i = 0; i < numOfPiles.Length; i++) { Console.Out.Write(" Enter the number sticks for pile " + pileNumber + ": "); // May want to get rid of piles num = Console.ReadLine(); sticks = Convert.ToInt32(num); numOfPiles[i] = sticks; pileNumber++; } turn = Nim.playerOrder(); //Console.Out.WriteLine("This needs to get put into arry: {0}", Nim.compDecide(Nim.getIndicator(numOfPiles),numOfPiles)); //to test the elements of the array. Console.Clear(); Console.Out.WriteLine("Sticks in each pile: \n"); for (int i = 0; i < numOfPiles.Length; i++) { Console.Out.Write("Pile " + (i+1) + ": " + numOfPiles[i] + " \n"); } while (Nim.getWinner(numOfPiles) == false)//winner method) { if (turn) { //method that handles player turn Console.Clear(); Console.Out.WriteLine("Sticks in each pile: \n"); for (int i = 0; i < numOfPiles.Length; i++) { Console.Out.Write("Pile " + (i + 1) + ": " + numOfPiles[i] + " \n"); } Console.Out.WriteLine("\n************************"); Console.Out.WriteLine("Player turn"); numOfPiles[Nim.choosePile(numOfPiles) - 1] -= Nim.chooseSticks(); ; //test to see if num of sticks is decreased from correct pile. //Console.Out.Write("Nuber of sticks in each pile: "); //for (int i = 0; i < numOfPiles.Length; i++) //{ // Console.Out.WriteLine(numOfPiles[i] + " "); //} turn = false; } else { //put computer turn here //Console.Out.WriteLine("Computer turn"); Nim.compDecide(Nim.getIndicator(numOfPiles), numOfPiles); //Console.Out.Write("Nuber of sticks in each pile: "); //for (int i = 0; i < numOfPiles.Length; i++) //{ // Console.Out.Write(numOfPiles[i] + " "); //} turn = true; } } //test to see winner playAgain = winner(turn); } progTerm(); //Terminate program }
/// <summary> /// Handles all player movement /// Is called on every frame update /// </summary> public void movement(Game game) { //Get the current keyboard state var keyState = OpenTK.Input.Keyboard.GetState(); //Call method to handle gravity (and other vertical environmental forces) fall(); //If the user presses escape, close the game if (keyState[Key.Escape]) game.Close(); //Call the method to handle grab state management grab(keyState[Key.Left], keyState[Key.Right], keyState[Key.Up]); //Call the method to handle left and right motion, and pass true or false for left and right arrow keys move(keyState[Key.Left], keyState[Key.Right]); //Call the methods to handle jumping and air state refreshing jump(keyState[Key.Space], keyState[Key.Left], keyState[Key.Right]); stateRefresh(keyState[Key.Space], keyState[Key.LShift] || keyState[Key.RShift]); //Call the method to handle dashing dash(keyState[Key.LShift] || keyState[Key.RShift], keyState[Key.Left], keyState[Key.Right], keyState[Key.Down]); //Call the method to handle horizontal environmental forces (friction, etc) decelerate(keyState[Key.Left], keyState[Key.Right]); //Update the character position position += velocity; }
static void Main(string[] args) { Game g = new Game(); g.Start(); Console.ReadKey(); }