void AddRun(TRuns Runs, int dir) { TCell Near; TCheck Who; TCheck W2; TRun R2; Near = Pos.Near(dir); if (Pole.Who(Near, out Who)) { if (Who == null) { Runs.Add(new TRun(this, Near)); } else { if (Who.C != C) { Near = Who.Pos.Near(dir); if (Pole.Who(Near, out W2)) { if (W2 == null) { R2 = new TRun(this, Near); R2.Killed.Add(Who); Runs.Add(R2); } } } } } }
public void AddRuns(TCheck Check, ref TRuns Runs) { for (int i = 0; i < Lists.Count; i++) { TNode Node = (TNode)Lists[i]; TRun Run = new TRun(Check, Node.Pos); ArrayList arr = Up(Node); for (int j = 0; j < arr.Count; j++) { Run.Killed.Add(((TNode)arr[j]).Killed); } Runs.Add(Run); TCell[] Addition = Node.Pos.NearsDama(Node.dir, Pole); for (int k = 1; k < Addition.Count(); k++) { TRun ARun = new TRun(Check, Addition[k]); for (int j = 0; j < Run.Killed.Count; j++) { ARun.Killed.Add(Run.Killed[j]); } Runs.Add(ARun); } } }
public bool Run(TPole Pole, TRun R) { TRuns RunsKill = GetRunsKill(Pole); if (RunsKill.Count > 0) { TRun Run; if (R == null) { Run = RunsKill.GetR(); } else { Run = R; } SetPos(Run.PosTo); for (int i = 0; i < Run.Killed.Count; i++) { TCheck K = (TCheck)Run.Killed[i]; g.Children.Remove(K.O[0]); g.Children.Remove(K.O[1]); if (K.C == WB.W) { Pole.CW.Remove(K); } else { Pole.CB.Remove(K); } } return(true); } TRuns Runs = GetRuns(Pole); if (Runs.Count > 0) { TRun Run; if (R == null) { Run = Runs.GetR(); } else { Run = R; } SetPos(Run.PosTo); return(true); } return(false); }
public void Add(TRun Run) { arr.Add(Run); }
private void cmClick(object sender, MouseButtonEventArgs e) { Point XY = e.GetPosition(gPole); TCell Z = Pole.GetCell(XY); if (CheckFor == null) { Pole.Who(Z, out CheckFor); if (CheckFor == null) { return; } if (CheckFor.C != WB.W) { CheckFor = null; return; } } else { ArrayList arr = new ArrayList(); TRun Run = new TRun(CheckFor, Z); TRuns Runs; TRuns RunsKill; for (int n = 0; n < Pole.CW.Count; n++) { RunsKill = Pole.CW[n].GetRunsKill(Pole); for (int k = 0; k < RunsKill.Count; k++) { arr.Add(RunsKill[k]); } } if (arr.Count > 0) { for (int k = 0; k < arr.Count; k++) { TRun R = (TRun)arr[k]; if ((Run.Check.Pos.Eq(R.Check.Pos)) && (Run.PosTo.Eq(R.PosTo))) { R.Check.Run(Pole, R); IsW = !IsW; cmRun(null, null); CheckFor = null; return; } } CheckFor = null; return; } else { arr.Clear(); for (int n = 0; n < Pole.CW.Count; n++) { Runs = Pole.CW[n].GetRuns(Pole); for (int k = 0; k < Runs.Count; k++) { arr.Add(Runs[k]); } } if (arr.Count > 0) { for (int k = 0; k < arr.Count; k++) { TRun R = (TRun)arr[k]; if ((Run.Check.Pos.Eq(R.Check.Pos)) && (Run.PosTo.Eq(R.PosTo))) { R.Check.Run(Pole, R); IsW = !IsW; cmRun(null, null); CheckFor = null; return; } } CheckFor = null; return; } else { IsGame = false; WB Cx; if (IsW) { Cx = WB.W; } else { Cx = WB.B; } Pole.GameOver(Cx); Pole = new TPole(gPole); } } } }