private void InitializeBoardArray()//initialize the array of buttons { ButtonBoard = new Button[size, size]; flowLayoutPanel1.Controls.Clear(); flowLayoutPanel1.Size = new Size(50 * (size), 50 * (size)); N3liza = new Nliza(size, 1, UserO.SelectedIndex, -1, UserX.SelectedIndex, 0, 1, outPut); for (int i = 0; i < ButtonBoard.GetLength(0); i++) { for (int j = 0; j < ButtonBoard.GetLength(1); j++) { ButtonBoard[i, j] = new Button(); ButtonBoard[i, j].Location = new System.Drawing.Point(35 * i, 35 * j); ButtonBoard[i, j].Name = "/" + i + "/" + j; ButtonBoard[i, j].Size = new System.Drawing.Size(50, 50); ButtonBoard[i, j].TabIndex = 0; ButtonBoard[i, j].Margin = new System.Windows.Forms.Padding(0); ButtonBoard[i, j].UseVisualStyleBackColor = true; ButtonBoard[i, j].Text = ""; ButtonBoard[i, j].Font = new System.Drawing.Font("Microsoft Sans Serif", 27.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(161))); ButtonBoard[i, j].Click += new System.EventHandler(possitionClicked); flowLayoutPanel1.Controls.Add(ButtonBoard[i, j]); } } }
public Form1() { InitializeComponent(); N3liza = new Nliza(size, 1, 7, -1, 7, 0, 1, outPut); initializeUserSelection(); InitializeBoardArray(); NextStep.Hide(); AutoPlayBot.Checked = true; changeCurrentPlayerOnScreen(parseID(N3liza.currentPlayer.id)); if (N3liza.currentPlayer.GetType() != typeof(player.Human) && autoMoveBots) { N3liza.play(); } }