예제 #1
0
        public static void ChooseInputParameterForGame2()
        {
            //Printer.ClearingConsole();
            Console.Clear();
            //Printer.AskInputParameters();
            Console.WriteLine("What do you input: size(1) or arr(2)?");
            Console.Write("Choose a number = ");
            int choice = Convert.ToInt32(Console.ReadLine());

            if (choice == 1) // size
            {
                Console.Write("Type a size of your field ");
                //Printer.AskSize();
                int   size    = Convert.ToInt32(Console.ReadLine());
                Game2 player1 = new Game2(size);
                PlayGame2(player1);
            }
            else if (choice == 2) // arr
            {
                int[] numbers = CreateArr();
                Game2 player1 = new Game2(numbers);
                PlayGame2(player1);
            }
            else
            {
                ChooseInputParameterForGame3();
            }
        }
예제 #2
0
 public static void PlayGame2(Game2 player1)
 {
     Console.Clear();
     //Printer.ClearingConsole();
     Console.WriteLine("You can random your arr. If you want to random arr, add 'random'");
     //Printer.InfoAboutRandom();
     while (!player1.CheckWinSequence())
     {
         int value;
         Printer.Field(player1);
         //Printer.AskNumber();
         Console.Write("Type your number to move to zero ");
         string answer = Console.ReadLine();
         bool   number = Int32.TryParse(answer, out value);
         if (!number)
         {
             if (answer == "random")
             {
                 player1.RandomArr();
             }
             //Printer.ClearingConsole();
             Console.Clear();
         }
         else
         {
             Location n    = new Location(value, player1.Field);
             Location zero = new Location(0, player1.Field);
             if (player1.Shift(value, n, zero))
             {
                 player1.ChangeKnuckles(value, n, zero);
             }
             //Printer.ClearingConsole();
             Console.Clear();
         }
     }
     //Printer.AskNewGame();
     Console.Write("Do you want to play a new game: YES/NO ");
     if (Console.ReadLine().ToLower() == "yes")
     {
         ChooseTypeGame();
     }
     else
     {
         //Printer.End();
         Console.WriteLine("Good bye");
         Console.WriteLine("Add enter to exit from the game");
         Console.ReadLine();
     }
 }