Beispiel #1
0
 public void Init(int initialX, int initialY)
 {
     chessBoard = new Element.ChessBoard();
     if (initialX == -1 && initialY == -1)
     {
         knight = new Knight(RandomPosition(), RandomPosition(), chessBoard);
     }
     else
     {
         knight = new Knight(initialX, initialY, chessBoard);
     }
     //knight = new Knight();
 }
Beispiel #2
0
        private void DrawBoard(Element.ChessBoard chessBoard)
        {
            tableLayoutPanel1.Controls.Clear();
            picturebox = new PictureBox[8, 8];
            bool isBoxDark = false;

            for (int i = 0; i < picturebox.GetLength(0); i++, isBoxDark = !isBoxDark)
            {
                for (int j = 0; j < picturebox.GetLength(1); j++, isBoxDark = !isBoxDark)
                {
                    picturebox[i, j] = getDarkBox(isBoxDark);
                    if (chessBoard != null)
                    {
                        WriteTextOnPictureBox(picturebox[i, j], chessBoard.Board[i, j].Order);
                        label7.Text = "" + (layoutNum + 1);
                        label9.Text = "" + results[layoutNum];
                    }
                    tableLayoutPanel1.Controls.Add(picturebox[i, j], i, j);
                }
            }
        }