public void UpdateBoard(ref Mancala game) { if (!game.leftTurn && game.aiActive) { int ai_index = game.get_ai_move(Mancala.max_depth, true)[1]; switch (ai_index) { case 7: btnR0.PerformClick(); break; case 8: btnR1.PerformClick(); break; case 9: btnR2.PerformClick(); break; case 10: btnR3.PerformClick(); break; case 11: btnR4.PerformClick(); break; case 12: btnR5.PerformClick(); break; } } if (game.isGameOver()) { game.captureAll(); } for (int i = 0; i < 7; i++) { LeftSide[i].Text = game.board[i].ToString(); RightSide[i].Text = game.board[i + 7].ToString(); } if (!game.gameOver) { lblTurn.Text = game.leftTurn ? "Left" : "Right"; } else { label1.Visible = false; lblTurn.Visible = false; lblGameOver.Visible = true; } }
public void UpdateBoard(ref Mancala game) { if (game.isGameOver()) { game.captureAll(); } for (int i = 0; i < 7; i++) { LeftSide[i].Text = game.board[i].ToString(); RightSide[i].Text = game.board[i + 7].ToString(); } if (!game.gameOver) { lblTurn.Text = game.leftTurn ? "Left" : "Right"; } else { label1.Visible = false; lblTurn.Visible = false; lblGameOver.Visible = true; } }