public static int GetBestStep(int p, int deph, CBoard brd) { if (deph > 3 || brd.CompFig + brd.PlayersFig == 60) { int k = brd.GetKrit(deph); return k; } List<int[]> l = brd.GetEnableSteps(p); int grade = -Int32.MaxValue; foreach (int[] s in l) { CBoard b = brd.Copy(); b.AddFig(s[0], s[1], p, true); int res = GetBestStep(-p, deph + 1, b); grade = MinMax(res, grade, deph); } return grade; }
private void InitBoard() { board = new CBoard(); panel1.Width = CBoard.w * CBoard.RectWidth; panel1.Height = CBoard.w * CBoard.RectWidth; label3.Text = "2"; label4.Text = "2"; }
public CBoard Copy() { CBoard b = new CBoard(); for (int i = 0; i < w; i++) { for (int j = 0; j < w; j++) { b.mat[i, j] = mat[i, j]; } } b.mCompFig = this.CompFig; b.mPlayersFig = this.PlayersFig; return b; }