Пример #1
0
        public static void PrintInputPointFormat(Game_Data.Board i_OthelloBoard)
        {
            string inputPointFormat = string.Format("\nPlease enter the point in the following form - n,c where n is an iteger between 1 - {0} and c is a character between A - {1}\n", i_OthelloBoard.M_BoardSize, (char)('A' + i_OthelloBoard.M_BoardSize - 1));

            System.Console.WriteLine(inputPointFormat);
            System.Console.WriteLine("For your knowledge:\nplace your disc on the board by choosing a cell, in such a way that there is at least one straight (horizontal, vertical, or diagonal)\noccupied line between the new disc and another one of your discs, with one or more contiguous rival pieces between them.\n");
        }
Пример #2
0
        public static Game_Data.Board.Point RecievePointFromPlayer(Game_Data.Board i_OthelloBoard, Game_Data.Player i_Player, List <Game_Data.Board.Point> i_ValidPointsToChooseFrom)
        {
            Game_Data.Board.Point o_PlayerChosenPoint = null;
            string userInput      = null;
            bool   availablePoint = false;

            string message = string.Format("It is {0}'s turn ({1})!", i_Player.M_PlayerName, i_Player.M_Color);

            System.Console.WriteLine(message);

            if (i_Player.M_PlayerName != "PC")
            {
                while (availablePoint == false && userInput != "Q")
                {
                    System.Console.WriteLine("Please choose a point to place your disc in from the following options: ");
                    UI.Console.PrintValidPointsForPlayer(i_ValidPointsToChooseFrom);
                    userInput = System.Console.ReadLine();

                    if (IsValidInput(userInput, i_OthelloBoard.M_BoardSize))
                    {
                        if (Game_Data.Board.IsValidDiscPlacement(i_OthelloBoard, int.Parse(userInput[0].ToString()), userInput[2], i_Player))
                        {
                            o_PlayerChosenPoint = new Game_Data.Board.Point(int.Parse(userInput[0].ToString()), userInput[2], i_Player.M_Color);
                            availablePoint      = true;
                        }
                        else
                        {
                            System.Console.WriteLine("--------------------------------------------------\nYou can't place a disc there!");
                            System.Console.WriteLine("Please place your disc on the board by choosing a cell, in such a way that there is at least one straight (horizontal, vertical, or diagonal) occupied line between the new disc and another one of your discs, with one or more contiguous rival pieces between them.");
                        }
                    }
                    else if (userInput != "Q")
                    {
                        System.Console.WriteLine("Invalid Input!");
                    }
                }

                if (userInput == "Q")
                {
                    ExitSequence();
                }
            }
            else
            {
                /// It's PC's turn
                System.Random rand = new System.Random();
                o_PlayerChosenPoint = i_ValidPointsToChooseFrom[rand.Next(i_ValidPointsToChooseFrom.Count)];
            }

            return(o_PlayerChosenPoint);
        }
Пример #3
0
 public static void PrintBoard(Game_Data.Board i_OthelloBoard)
 {
     Game_Data.Board.PrintBoard(i_OthelloBoard);
 }