public void displayCheckerBoard()
        {
            while (!movepiece.Exit)
            {
                Console.Clear();
                Console.WriteLine("   0   1   2   3   4   5   6   7");

                for (int r = 0; r < DIMEN; r++)
                {
                    Console.Write("  ");
                    for (int c = 0; c < DIMEN; c++)
                    {
                        Console.Write(CheckerBoardHoriz);
                    }
                    Console.Write("+\n");

                    for (int c = 0; c < DIMEN; c++)
                    {
                        if (c == 0)
                        {
                            Console.Write(r + " ");
                        }
                        Console.Write(CheckerBoardVert + Piece.pieces[r, c] + " ");
                    }
                    Console.Write("|\n");
                }

                Console.Write("  ");
                for (int c = 0; c < DIMEN; c++)
                {
                    Console.Write(CheckerBoardHoriz);
                }

                Console.Write("+\n\n");
                movepiece.miniMenu();
                movepiece.moveChoice();
            }
        }
Пример #2
0
        public void displayCheckerBoard()
        {
            while (!movepiece.Exit)
            {
                Console.Clear();                                                    //Clears the checkerboard
                Console.WriteLine("   0   1   2   3   4   5   6   7");              //Draws the Text present on the left and top of the checkerboard.

                for (int r = 0; r < DIMEN; r++)                                     //Begins a loop for the rows
                {
                    Console.Write("  ");                                            //Inputs the spaces
                    for (int c = 0; c < DIMEN; c++)                                 //Begins a loop for the columns
                    {
                        Console.Write(CheckerBoardHoriz);                           //Draws the horizontal graphical properties onto the board.
                    }
                    Console.Write("+\n");                                           //Inputs a new line

                    for (int c = 0; c < DIMEN; c++)                                 //Begins a loop for the columns
                    {
                        if (c == 0)                                                 //if column = Zero
                        {
                            Console.Write(r + " ");                                 //Draw the rows and input the spaces
                        }
                        Console.Write(CheckerBoardVert + Piece.pieces[r, c] + " "); //Draws the vertical graphical properties onto the board, along with the pieces and spaces.
                    }
                    Console.Write("|\n");                                           //Writes the other side of the checkerboard wall.
                }


                Console.Write("  ");
                for (int c = 0; c < DIMEN; c++)
                {
                    Console.Write(CheckerBoardHoriz);
                }

                Console.Write("+\n\n");
                movepiece.miniMenu();   //Displays the mini menu on the checkerboard

                movepiece.moveChoice(); //Displays the user selection to move pieces then moves the piece

                //ALL CODE BELOW - repeat of the ABOVE code but redraws the board again for the AI to make their move.
                Console.Clear();
                Console.WriteLine("   0   1   2   3   4   5   6   7");

                for (int r = 0; r < DIMEN; r++)
                {
                    Console.Write("  ");
                    for (int c = 0; c < DIMEN; c++)
                    {
                        Console.Write(CheckerBoardHoriz);
                    }
                    Console.Write("+\n");

                    for (int c = 0; c < DIMEN; c++)
                    {
                        if (c == 0)
                        {
                            Console.Write(r + " ");
                        }
                        Console.Write(CheckerBoardVert + Piece.pieces[r, c] + " ");
                    }
                    Console.Write("|\n");
                }

                Console.Write("  ");
                for (int c = 0; c < DIMEN; c++)
                {
                    Console.Write(CheckerBoardHoriz);
                }

                Console.Write("+\n\n");
                aimovepiece.aiMove(); //Displays the AI piece selection, then moves the AI's piece.
            }
        }